Skip to content

Commit

Permalink
Add nodes in factory xml for status bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhcad committed Nov 2, 2011
1 parent 3bd290d commit 1078d13
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
25 changes: 17 additions & 8 deletions code/pkg_AppUI/Modules/FrameXtp/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ BOOL CMainFrame::InitRibbonBars(CXTPCommandBars* pCommandBars)
void CMainFrame::SetRibbonFont()
{
CXTPOffice2007Theme* pOfficeTheme = (CXTPOffice2007Theme*)(m_pCommandBars->GetPaintManager());
std::wstring fontcfg(x3::GetStringValue(L"FrameXtp", L"RibbonFont"));
CString fontname, sizestr;

std::wstring fontcfg(x3::GetStringValue(m_appname.c_str(), L"RibbonFont"));
if (fontcfg.empty())
fontcfg = x3::GetStringValue(L"FrameXtp", L"RibbonFont");

AfxExtractSubString(fontname, fontcfg.c_str(), 0, ',');
AfxExtractSubString(sizestr, fontcfg.c_str(), 1, ',');
long fontsize = _wtol(sizestr);
Expand Down Expand Up @@ -184,16 +187,22 @@ BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra,

BOOL CMainFrame::CreateStatusBar()
{
static UINT indicators[] =
std::vector<UINT> indicators(1, ID_SEPARATOR);
Cx_ConfigSection items(m_frameNode.GetSection(L"statusbar/indicators"));

for (int i = 0; ; i++)
{
ID_SEPARATOR,
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
Cx_ConfigSection item(items.GetSectionByIndex(L"item", i));
UINT id = GetNodeID(item, L"id");
if (0 == id)
break;
indicators.push_back(id);
if (ID_SEPARATOR == id && indicators.front() == id)
indicators.erase(indicators.begin());
}

VERIFY(m_wndStatusBar.Create(m_pMainWnd)
&& m_wndStatusBar.SetIndicators(indicators, _countof(indicators)));
&& m_wndStatusBar.SetIndicators(&indicators[0], x3::GetSize(indicators)));

m_wndStatusBar.SetCommandBars(m_pCommandBars);
m_wndStatusBar.SetDrawDisabledText(FALSE);
Expand Down
7 changes: 4 additions & 3 deletions code/pkg_Example/Modules/HelloFrame/HelloApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ END_MESSAGE_MAP()

void CHelloApp::OnCommands(UINT nID)
{
CString str;
str.Format(L"OnCommands: %d", nID);
AfxMessageBox(str);
CString str, text;
str.LoadString(nID);
text.Format(L"OnCommands: %d\n%s", nID, str);
AfxMessageBox(text);
}
6 changes: 6 additions & 0 deletions code/pkg_Example/Modules/HelloFrame/uifactory.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<button id="7614 ID_EDIT_SELECT"/>
</toolbar>
</toolbars>
<statusbar>
<indicators>
<item id="0xE701 ID_INDICATOR_CAPS"/>
<item id="0xE702 ID_INDICATOR_NUM"/>
</indicators>
</statusbar>
</mainframe>
<ribbon>
<tabs>
Expand Down

0 comments on commit 1078d13

Please sign in to comment.