📄 theme.cpp
字号:
m_oLastError = string("the <TogglePanel> tag needs a Panel attribute");
return kError_ParseError;
}
pPanel = FindPanel(oAttrMap["Panel"]);
if (pPanel == NULL)
{
m_oLastError = string("Undefined Panel ") +
oAttrMap["Panel"] +
string(" in tag <TogglePanel>");
return kError_InvalidParam;
}
((ButtonControl *)m_pCurrentControl)->SetPanelToggle(pPanel);
return kError_NoErr;
}
if (oElement == string("DockPosition"))
{
Pos oPos;
if (m_pCurrentControl)
{
m_oLastError = string("The <DockPosition> tag cannot be inside of a "
"<XXXXControl> tag");
return kError_InvalidParam;
}
if (m_pCurrentWindow == NULL)
{
m_oLastError = string("The <DockPosition> tag must be inside of a "
"<Window> tag");
return kError_InvalidParam;
}
if (oAttrMap.find("Pos") == oAttrMap.end())
{
m_oLastError = string("the <DockPosition> tag needs a Pos attribute");
return kError_ParseError;
}
eRet = ParsePos(oAttrMap["Pos"], oPos);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Pos coordinates: ") +
oAttrMap["Pos"];
return kError_InvalidParam;
}
m_pCurrentWindow->SetDockPosition(oPos);
return kError_NoErr;
}
if (oElement == string("Position"))
{
Rect oRect;
Pos oPos;
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <Position> tag must be inside of a "
"<XXXXControl> tag");
return kError_InvalidParam;
}
if (oAttrMap.find("Rect") == oAttrMap.end() &&
oAttrMap.find("Pos") == oAttrMap.end())
{
m_oLastError = string("the <Position> tag needs a Rect or a Pos attribute");
return kError_ParseError;
}
if (oAttrMap.find("Pos") != oAttrMap.end() &&
m_eCurrentControl != eButtonControl &&
m_eCurrentControl != eMultiStateControl &&
m_eCurrentControl != ePixSliderControl)
{
m_oLastError = string("the Pos attribute in the <Position> tag can only be used "
"for a MultiStateControl or a ButtonControl");
return kError_ParseError;
}
if (oAttrMap.find("Rect") != oAttrMap.end())
{
eRet = ParseRect(oAttrMap["Rect"], oRect);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Rect coordinates: ") +
oAttrMap["Rect"];
return kError_InvalidParam;
}
m_pCurrentControl->SetRect(oRect);
}
if (oAttrMap.find("Pos") != oAttrMap.end())
{
eRet = ParsePos(oAttrMap["Pos"], oPos);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Pos coordinates: ") +
oAttrMap["Pos"];
return kError_InvalidParam;
}
m_pCurrentControl->SetPos(oPos);
}
m_bPosDefined = true;
return kError_NoErr;
}
if (oElement == string("ControlBitmap"))
{
Bitmap *pBitmap = NULL;
Rect oRect;
bool bHoriz = true;
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <ControlBitmap> tag must be inside of a "
"<XXXXControl> tag");
return kError_InvalidParam;
}
if (oAttrMap.find("Rect") == oAttrMap.end())
{
m_oLastError = string("the <ControlBitmap> tag needs a Rect attribute");
return kError_ParseError;
}
if (oAttrMap.find("Name") == oAttrMap.end())
{
m_oLastError = string("the <ControlBitmap> tag needs a Name attribute");
return kError_ParseError;
}
if (oAttrMap.find("Style") != oAttrMap.end())
{
if (oAttrMap["Style"] == string("Vert"))
bHoriz = false;
}
eRet = ParseRect(oAttrMap["Rect"], oRect);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Rect coordinates: ") +
oAttrMap["Rect"];
return kError_InvalidParam;
}
pBitmap = FindBitmap(oAttrMap["Name"]);
if (pBitmap == NULL)
{
m_oLastError = string("Undefined bitmap ") +
oAttrMap["Name"] +
string(" in tag <ControlBitmap>");
return kError_InvalidParam;
}
m_pCurrentControl->SetBitmap(pBitmap, oRect, bHoriz);
m_bBitmapDefined = true;
return kError_NoErr;
}
if (oElement == string("SliderTroughBitmap"))
{
Bitmap *pBitmap = NULL;
Rect oRect;
bool bHoriz = true;
int iDelta = 0;
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <SliderTroughBitmap> tag must be inside of a <XXXXControl> tag");
return kError_InvalidParam;
}
if (m_eCurrentControl != eSliderControl &&
m_eCurrentControl != eVSliderControl)
{
m_oLastError = string("the <SliderTroughBitmap> tag can only be used "
"for a SliderControl or a VSliderControl");
return kError_ParseError;
}
if (oAttrMap.find("Rect") == oAttrMap.end())
{
m_oLastError = string("the <SliderTroughBitmap> tag needs a Rect attribute");
return kError_ParseError;
}
if (oAttrMap.find("Name") == oAttrMap.end())
{
m_oLastError = string("the <SliderTroughBitmap> tag needs a Name attribute");
return kError_ParseError;
}
if (oAttrMap.find("NumFrames") == oAttrMap.end())
{
m_oLastError = string("the <SliderTroughBitmap> tag needs a NumFrames attribute");
return kError_ParseError;
}
if (oAttrMap.find("Style") != oAttrMap.end())
{
if (oAttrMap["Style"] == string("Vert"))
bHoriz = false;
}
eRet = ParseRect(oAttrMap["Rect"], oRect);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Rect coordinates: ") +
oAttrMap["Rect"];
return kError_InvalidParam;
}
pBitmap = FindBitmap(oAttrMap["Name"]);
if (pBitmap == NULL)
{
m_oLastError = string("Undefined bitmap ") +
oAttrMap["Name"] +
string(" in tag <ControlBitmap>");
return kError_InvalidParam;
}
int iFrames = atoi(oAttrMap["NumFrames"].c_str());
if (oAttrMap.find("DeltaBetweenFrames") != oAttrMap.end())
{
iDelta = atoi(oAttrMap["DeltaBetweenFrames"].c_str());
}
bool bMiddle = false;
if (oAttrMap.find("MaxInCenter") != oAttrMap.end())
{
if (oAttrMap["MaxInCenter"] == string("true"))
bMiddle = true;
}
if (m_eCurrentControl == eSliderControl)
((SliderControl *)m_pCurrentControl)->SetTroughBitmap(pBitmap, oRect,
iFrames,
bHoriz,
iDelta,
bMiddle);
else
((VSliderControl *)m_pCurrentControl)->SetTroughBitmap(pBitmap, oRect,
iFrames,
bHoriz,
iDelta,
bMiddle);
return kError_NoErr;
}
if (oElement == string("ActivationBitmap"))
{
Bitmap *pBitmap = NULL;
Rect oRect;
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <ActivationBitmap> tag must be inside of a <XXXXControl> tag");
return kError_InvalidParam;
}
if (m_eCurrentControl != ePixSliderControl)
{
m_oLastError = string("the <ActivationBitmap> tag can only be used "
"for a PixSliderControl");
return kError_ParseError;
}
if (oAttrMap.find("Rect") == oAttrMap.end())
{
m_oLastError = string("the <ActivationBitmap> tag needs a Rect attribute");
return kError_ParseError;
}
if (oAttrMap.find("Name") == oAttrMap.end())
{
m_oLastError = string("the <ActivationBitmap> tag needs a Name attribute");
return kError_ParseError;
}
eRet = ParseRect(oAttrMap["Rect"], oRect);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Rect coordinates: ") +
oAttrMap["Rect"];
return kError_InvalidParam;
}
pBitmap = FindBitmap(oAttrMap["Name"]);
if (pBitmap == NULL)
{
m_oLastError = string("Undefined bitmap ") +
oAttrMap["Name"] +
string(" in tag <ActivationBitmap>");
return kError_InvalidParam;
}
((PixSliderControl *)m_pCurrentControl)->SetActivationBitmap(pBitmap,
oRect,
true);
return kError_NoErr;
}
if (oElement == string("ControlStateBitmap"))
{
Bitmap *pBitmap = NULL;
Rect oRect;
ControlStateEnum eState;
int iFrameSet = 0;
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <ControlStateBitmap> tag must be inside of a <XXXXControl> tag");
return kError_InvalidParam;
}
if (oAttrMap.find("Rect") == oAttrMap.end())
{
m_oLastError = string("the <ControlStateBitmap> tag needs a Rect attribute");
return kError_ParseError;
}
if (oAttrMap.find("Name") == oAttrMap.end())
{
m_oLastError = string("the <ControlStateBitmap> tag needs a Name attribute");
return kError_ParseError;
}
if (oAttrMap.find("State") == oAttrMap.end())
{
m_oLastError = string("the <ControlStateBitmap> tag needs a State attribute");
return kError_ParseError;
}
if (oAttrMap.find("StateNum") != oAttrMap.end())
{
iFrameSet = atoi(oAttrMap["StateNum"].c_str());
}
eRet = ParseRect(oAttrMap["Rect"], oRect);
if (eRet != kError_NoErr)
{
m_oLastError = string("Improperly formatted Rect coordinates: ") +
oAttrMap["Rect"];
return kError_InvalidParam;
}
eRet = ParseState(oAttrMap["State"], eState);
if (eRet != kError_NoErr)
{
m_oLastError = string("Unknown State: ") + oAttrMap["State"];
return kError_InvalidParam;
}
pBitmap = FindBitmap(oAttrMap["Name"]);
if (pBitmap == NULL)
{
m_oLastError = string("Undefined bitmap ") +
oAttrMap["Name"] +
string(" in tag <ControlStateBitmap>");
return kError_InvalidParam;
}
m_pCurrentControl->SetStateBitmap(pBitmap, oRect, eState, iFrameSet);
m_bBitmapDefined = true;
return kError_NoErr;
}
if (oElement == string("Info"))
{
if (m_pCurrentControl == NULL)
{
m_oLastError = string("The <Info> tag must be inside of a "
"<XXXXControl> tag");
return kError_InvalidParam;
}
if (oAttrMap.find("Desc") != oAttrMap.end())
m_pCurrentControl->SetDesc(oAttrMap["Desc"]);
if (oAttrMap.find("Tip") != oAttrMap.end())
m_pCurrentControl->SetTip(oAttrMap["Tip"]);
m_bInfoDefined = true;
return kError_NoErr;
}
if (oElement == string("ThemeInfo"))
{
if (m_pCurrentControl != NULL)
{
m_oLastError = string("The <ThemeInfo> tag must be top level tag");
return kError_InvalidParam;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -