Hi guys, struggling here trying to test out this skinning framework by converting my app to use it. The User Guide is severely lacking.
I make use of CDialogBars, and the constructor: CDialogBar::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID)
These of course are not skinned, but the skin framework offers a skinnable CXTPDialogBar. Drop-in replacement, right? Nope.
Unfortunately there is no similar constructor in CXTPDialogBar, and I'm at a loss as to how to convert between the two.
There are two ways to construct CXTPDialogBar. One is without any template, which doesn't make much sense, and another requires use of a string class name. There is no constructor that allows use of a nIDTemplate integer.
So, I used the User's guide search feature to search for CXTPDialogBar, but the word does not exist.
So, how can I use CXTPDialogBar with a dialog resource ID template?
EDIT: Ok, after a while it's coming together. Despite the user guide, there are a lot of good examples where most of this can be learned, by searching through the source for the functions to learn.
Instead of the MFC method of creating the CToolBar member in the OnCreate function of CMainFrame using CToolBar::Create (or CDialogBar::Create), we aren't supposed to create CXTPToolbars and dialog bars via their create functions. A toolbar should be created by adding it first to the commandBar, and then LOADING the gui-generated toolbar template as so:
CXTPToolBar* pToolBar = (CXTPToolBar*) pCommandBars->Add(_T("Main"), xtpBarTop); pToolBar->LoadToolBar(IDR_MAINFRAME);
Likewise, dialog-based command bars are not to be create() ed with a template, rather they are to be added to the command bar, sized, and then a child dialog or wnd is attached with SetChild:
CXTPDialogBar* pPalBar = (CXTPDialogBar*) pCommandBars->Add(_T("Palette"), xtpBarRight,RUNTIME_CLASS(CXTPDialogBar)); m_wndColorPalette.Create(0,0,WS_VISIBLE | WS_CHILD,CRect(),pPalBar,0); pPalBar->SetChild(&m_wndColorPalette);
By setting the DialogBar to be aware of its child, it will update the child dialog or window size during scaling and docking transitions.
|