本文整理汇总了C++中GetParamNode函数的典型用法代码示例。如果您正苦于以下问题:C++ GetParamNode函数的具体用法?C++ GetParamNode怎么用?C++ GetParamNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetParamNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: XRC_MAKE_INSTANCE
wxObject *CGBmpButton::DoCreateResource()
{
XRC_MAKE_INSTANCE(button, wxBitmapButton)
button->Create(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap"), wxART_BUTTON),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0))
button->SetDefault();
SetupWindow(button);
if (GetParamNode(wxT("selected")))
button->SetBitmapSelected(GetBitmap(wxT("selected")));
if (GetParamNode(wxT("focus")))
button->SetBitmapFocus(GetBitmap(wxT("focus")));
if (GetParamNode(wxT("disabled")))
button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
if (GetParamNode(wxT("hover")))
button->SetBitmapHover(GetBitmap(wxT("hover")));
return button;
}
开发者ID:k3a,项目名称:Panther3D-2,代码行数:26,代码来源:CGBmpButton.cpp
示例2: CreateChildrenPrivately
wxObject * MaxCheckListBoxXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxCheckListBox"))
{
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
XRC_MAKE_INSTANCE(control, MaxCheckListBox)
control->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList,
GetStyle(),
wxDefaultValidator,
GetName());
// step through children myself (again.)
wxXmlNode *n = GetParamNode(wxT("content"));
if (n)
n = n->GetChildren();
int i = 0;
while (n)
{
if (n->GetType() != wxXML_ELEMENT_NODE ||
n->GetName() != wxT("item"))
{ n = n->GetNext(); continue; }
// checking boolean is a bit ugly here (see GetBool() )
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower();
if (v == wxT("1"))
control->Check( i, true );
i++;
n = n->GetNext();
}
control->MaxBind(_wx_wxchecklistbox_wxCheckListBox__xrcNew(control));
SetupWindow(control);
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item checked="boolean">Label</item>
// add to the list
wxString str = GetNodeContent(m_node);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
str = wxGetTranslation(str, m_resource->GetDomain());
strList.Add(str);
return NULL;
}
}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:60,代码来源:glue.cpp
示例3: GetParamNode
wxObject *wxSimplebookXmlHandler::DoCreateResource()
{
if (m_class == wxS("simplebookpage"))
{
wxXmlNode *n = GetParamNode(wxS("object"));
if ( !n )
n = GetParamNode(wxS("object_ref"));
if (n)
{
bool old_ins = m_isInside;
m_isInside = false;
wxObject *item = CreateResFromNode(n, m_simplebook, NULL);
m_isInside = old_ins;
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (wnd)
{
m_simplebook->AddPage(wnd, GetText(wxS("label")),
GetBool(wxS("selected")));
}
else
{
ReportError(n, "simplebookpage child must be a window");
}
return wnd;
}
else
{
ReportError("simplebookpage must have a window child");
return NULL;
}
}
else
{
XRC_MAKE_INSTANCE(sb, wxSimplebook)
sb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxS("style")),
GetName());
SetupWindow(sb);
wxSimplebook *old_par = m_simplebook;
m_simplebook = sb;
bool old_ins = m_isInside;
m_isInside = true;
CreateChildren(m_simplebook, true/*only this handler*/);
m_isInside = old_ins;
m_simplebook = old_par;
return sb;
}
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:58,代码来源:xh_simplebook.cpp
示例4: GetParamNode
wxObject *wxCollapsiblePaneXmlHandler::DoCreateResource()
{
if (m_class == wxT("panewindow")) // read the XRC for the pane window
{
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if (n)
{
bool old_ins = m_isInside;
m_isInside = false;
wxObject *item = CreateResFromNode(n, m_collpane->GetPane(), NULL);
m_isInside = old_ins;
return item;
}
else
{
ReportError("no control within panewindow");
return NULL;
}
}
else
{
XRC_MAKE_INSTANCE(ctrl, wxCollapsiblePane)
wxString label = GetText(wxT("label"));
if (label.empty())
{
ReportParamError("label", "label cannot be empty");
return NULL;
}
ctrl->Create(m_parentAsWindow,
GetID(),
label,
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxCP_DEFAULT_STYLE),
wxDefaultValidator,
GetName());
ctrl->Collapse(GetBool(wxT("collapsed")));
SetupWindow(ctrl);
wxCollapsiblePane *old_par = m_collpane;
m_collpane = ctrl;
bool old_ins = m_isInside;
m_isInside = true;
CreateChildren(m_collpane, true/*only this handler*/);
m_isInside = old_ins;
m_collpane = old_par;
return ctrl;
}
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:57,代码来源:xh_collpane.cpp
示例5: XRC_MAKE_INSTANCE
wxObject *wxButtonXmlHandler::DoCreateResource()
{
XRC_MAKE_INSTANCE(button, wxButton)
button->Create(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0))
button->SetDefault();
if ( GetParamNode("bitmap") )
{
wxDirection dir;
const wxString dirstr = GetParamValue("direction");
if ( dirstr.empty() || dirstr == "wxLEFT" )
dir = wxLEFT;
else if ( dirstr == "wxRIGHT" )
dir = wxRIGHT;
else if ( dirstr == "wxTOP" )
dir = wxTOP;
else if ( dirstr == "wxBOTTOM" )
dir = wxBOTTOM;
else
{
ReportError
(
GetParamNode("bitmapposition"),
wxString::Format
(
"Invalid bitmap position \"%s\": must be one of "
"wxLEFT|wxRIGHT|wxTOP|wxBOTTOM.",
dirstr
)
);
dir = wxLEFT;
}
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON), dir);
}
SetupWindow(button);
return button;
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:50,代码来源:xh_bttn.cpp
示例6: ReportError
wxObject *wxBitmapComboBoxXmlHandler::DoCreateResource()
{
if (m_class == wxT("ownerdrawnitem"))
{
if ( !m_combobox )
{
ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox");
return NULL;
}
m_combobox->Append(GetText(wxT("text")),
GetBitmap(wxT("bitmap")));
return m_combobox;
}
else /*if( m_class == wxT("wxBitmapComboBox"))*/
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
XRC_MAKE_INSTANCE(control, wxBitmapComboBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
0,
NULL,
GetStyle(),
wxDefaultValidator,
GetName());
m_isInside = true;
m_combobox = control;
wxXmlNode *children_node = GetParamNode(wxT("object"));
wxXmlNode *n = children_node;
while (n)
{
if ((n->GetType() == wxXML_ELEMENT_NODE) &&
(n->GetName() == wxT("object")))
{
CreateResFromNode(n, control, NULL);
}
n = n->GetNext();
}
m_isInside = false;
m_combobox = NULL;
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
return control;
}
}
开发者ID:beanhome,项目名称:dev,代码行数:60,代码来源:xh_bmpcbox.cpp
示例7: XRC_MAKE_INSTANCE
wxObject *wxButtonXmlHandler::DoCreateResource()
{
XRC_MAKE_INSTANCE(button, wxButton)
button->Create(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0))
button->SetDefault();
if ( GetParamNode("bitmap") )
{
button->SetBitmap(GetBitmap("bitmap", wxART_BUTTON),
GetDirection("bitmapposition"));
}
SetupWindow(button);
return button;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:25,代码来源:xh_bttn.cpp
示例8: GetParamNode
wxObject* wxSizerXmlHandler::Handle_sizeritem()
{
// find the item to be managed by this sizeritem
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
// did we find one?
if (n)
{
// create a sizer item for it
wxSizerItem* sitem = MakeSizerItem();
// now fetch the item to be managed
bool old_gbs = m_isGBS;
bool old_ins = m_isInside;
wxSizer *old_par = m_parentSizer;
m_isInside = false;
if (!IsSizerNode(n)) m_parentSizer = NULL;
wxObject *item = CreateResFromNode(n, m_parent, NULL);
m_isInside = old_ins;
m_parentSizer = old_par;
m_isGBS = old_gbs;
// and figure out what type it is
wxSizer *sizer = wxDynamicCast(item, wxSizer);
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (sizer)
sitem->AssignSizer(sizer);
else if (wnd)
sitem->AssignWindow(wnd);
else
ReportError(n, "unexpected item in sizer");
// finally, set other wxSizerItem attributes
SetSizerItemAttributes(sitem);
AddSizerItem(sitem);
return item;
}
else /*n == NULL*/
{
ReportError("no window/sizer/spacer within sizeritem object");
return NULL;
}
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:47,代码来源:xh_sizer.cpp
示例9: wxASSERT
wxObject *wxStdDialogButtonSizerXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxStdDialogButtonSizer"))
{
wxASSERT( !m_parentSizer );
wxSizer *s = m_parentSizer = new wxStdDialogButtonSizer;
m_isInside = true;
CreateChildren(m_parent, true/*only this handler*/);
m_parentSizer->Realize();
m_isInside = false;
m_parentSizer = NULL;
return s;
}
else // m_class == "button"
{
wxASSERT( m_parentSizer );
// find the item to be managed by this sizeritem
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
// did we find one?
if (n)
{
wxObject *item = CreateResFromNode(n, m_parent, NULL);
wxButton *button = wxDynamicCast(item, wxButton);
if (button)
m_parentSizer->AddButton(button);
else
ReportError(n, "expected wxButton");
return item;
}
else /*n == NULL*/
{
ReportError("no button within wxStdDialogButtonSizer");
return NULL;
}
}
}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:47,代码来源:xh_sizer.cpp
示例10: GetLong
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxRadioBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
XRC_MAKE_INSTANCE(control, wxRadioBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetLong(wxT("dimension"), 1),
GetStyle(),
wxDefaultValidator,
GetName());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item selected="boolean">Label</item>
// add to the list
wxString str = GetNodeContent(m_node);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
str = wxGetTranslation(str);
strList.Add(str);
return NULL;
}
}
开发者ID:mentat,项目名称:YardSale,代码行数:58,代码来源:xh_radbx.cpp
示例11: GetParamNode
wxObject* MyWxSimplebookXmlHandler::DoCreateResource()
{
if(m_class == wxT("simplebookpage")) {
wxXmlNode* n = GetParamNode(wxT("object"));
if(!n) n = GetParamNode(wxT("object_ref"));
if(n) {
bool old_ins = m_isInside;
m_isInside = false;
wxObject* item = CreateResFromNode(n, m_notebook, NULL);
m_isInside = old_ins;
wxWindow* wnd = wxDynamicCast(item, wxWindow);
if(wnd) {
m_notebook->AddPage(wnd, GetText(wxT("label")), GetBool(wxT("selected")), wxNOT_FOUND);
} else
wxLogError(wxT("Error in resource."));
return wnd;
} else {
wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
return NULL;
}
}
else {
wxSimplebook* nb =
new wxSimplebook(m_parentAsWindow, GetID(), GetPosition(), GetSize(), GetStyle(wxT("style")));
wxString showEffect = GetText("effect", false);
nb->SetEffect(wxCrafter::ShowEffectFromString(showEffect));
nb->SetName(GetName());
SetupWindow(nb);
wxSimplebook* old_par = m_notebook;
m_notebook = nb;
bool old_ins = m_isInside;
m_isInside = true;
CreateChildren(m_notebook, true /*only this handler*/);
m_isInside = old_ins;
m_notebook = old_par;
return nb;
}
}
开发者ID:eranif,项目名称:codelite,代码行数:45,代码来源:myxh_simplebook.cpp
示例12: wxCHECK_MSG
wxObject * MaxBitmapComboBoxXmlHandler::DoCreateResource()
{
if (m_class == wxT("ownerdrawnitem"))
{
wxCHECK_MSG(m_combobox, NULL, wxT("Incorrect syntax of XRC resource: ownerdrawnitem not within a bitmapcombobox!"));
m_combobox->Append(GetText(wxT("text")), GetBitmap(wxT("bitmap"), wxART_MISSING_IMAGE));
return m_combobox;
}
else /*if( m_class == wxT("wxBitmapComboBox"))*/
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
XRC_MAKE_INSTANCE(control, MaxBitmapComboBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
0,
NULL,
GetStyle(),
wxDefaultValidator,
GetName());
control->MaxBind(_wx_wxbitmapcombobox_wxBitmapComboBox__xrcNew(control));
m_isInside = true;
m_combobox = control;
wxXmlNode *children_node = GetParamNode(wxT("object"));
wxXmlNode *n = children_node;
while (n)
{
if ((n->GetType() == wxXML_ELEMENT_NODE) &&
(n->GetName() == wxT("object")))
{
CreateResFromNode(n, control, NULL);
}
n = n->GetNext();
}
m_isInside = false;
m_combobox = NULL;
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
return control;
}
}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:57,代码来源:glue.cpp
示例13: GetLong
wxObject * MaxOwnerDrawnComboBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxOwnerDrawnComboBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
XRC_MAKE_INSTANCE(control, MaxOwnerDrawnComboBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
strList,
GetStyle(),
wxDefaultValidator,
GetName());
control->MaxBind(_wx_wxownerdrawncombobox_wxOwnerDrawnComboBox__xrcNew(control));
wxSize sizeBtn=GetSize(wxT("buttonsize"));
if (sizeBtn != wxDefaultSize)
control->SetButtonPosition(sizeBtn.GetWidth(), sizeBtn.GetHeight());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
wxString str = GetNodeContent(m_node);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
str = wxGetTranslation(str, m_resource->GetDomain());
strList.Add(str);
return NULL;
}
}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:52,代码来源:glue.cpp
示例14: XRC_MAKE_INSTANCE
wxObject *wxEditableListBoxXmlHandler::DoCreateResource()
{
if ( m_class == EDITLBOX_CLASS_NAME )
{
// create the control itself
XRC_MAKE_INSTANCE(control, wxEditableListBox)
control->Create
(
m_parentAsWindow,
GetID(),
GetText("label"),
GetPosition(),
GetSize(),
GetStyle(),
GetName()
);
SetupWindow(control);
// if any items are given, add them to the control
wxXmlNode * const contents = GetParamNode("content");
if ( contents )
{
m_insideBox = true;
CreateChildrenPrivately(NULL, contents);
m_insideBox = false;
control->SetStrings(m_items);
m_items.clear();
}
return control;
}
else if ( m_insideBox && m_node->GetName() == EDITLBOX_ITEM_NAME )
{
wxString str = GetNodeContent(m_node);
if ( m_resource->GetFlags() & wxXRC_USE_LOCALE )
str = wxGetTranslation(str, m_resource->GetDomain());
m_items.push_back(str);
return NULL;
}
else
{
ReportError("Unexpected node inside wxEditableListBox");
return NULL;
}
}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:49,代码来源:xh_editlbox.cpp
示例15: GetLong
wxObject *wxComboBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxComboBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
XRC_MAKE_INSTANCE(control, wxComboBox)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
strList,
GetStyle(),
wxDefaultValidator,
GetName());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
const wxString hint = GetText(wxS("hint"));
if ( !hint.empty() )
control->SetHint(hint);
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add(GetNodeText(m_node, wxXRC_TEXT_NO_ESCAPE));
return NULL;
}
}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:46,代码来源:xh_combo.cpp
示例16: GetLong
wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource()
{
if ( m_class == wxT("wxSimpleHtmlListBox"))
{
// find the selection
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
m_insideBox = false;
XRC_MAKE_INSTANCE(control, wxSimpleHtmlListBox)
control->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList,
GetStyle(wxT("style"), wxHLB_DEFAULT_STYLE),
wxDefaultValidator,
GetName());
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
wxString str = GetNodeContent(m_node);
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
str = wxGetTranslation(str, m_resource->GetDomain());
strList.Add(str);
return NULL;
}
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:44,代码来源:xh_htmllbox.cpp
示例17: GetParamNode
wxObject *wxAuiNotebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("notebookpage"))
{
wxXmlNode *anb = GetParamNode(wxT("object"));
if (!anb)
anb = GetParamNode(wxT("object_ref"));
if (anb)
{
bool old_ins = m_isInside;
m_isInside = false;
wxObject *item = CreateResFromNode(anb, m_notebook, NULL);
m_isInside = old_ins;
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (wnd)
{
if ( HasParam(wxT("bitmap")) )
{
m_notebook->AddPage(wnd,
GetText(wxT("label")),
GetBool(wxT("selected")),
GetBitmap(wxT("bitmap"), wxART_OTHER));
}
else
{
m_notebook->AddPage(wnd,
GetText(wxT("label")),
GetBool(wxT("selected")));
}
}
else
{
ReportError(anb, "notebookpage child must be a window");
}
return wnd;
}
else
{
ReportError("notebookpage must have a window child");
return NULL;
}
}
else
{
XRC_MAKE_INSTANCE(anb, wxAuiNotebook)
anb->Create(m_parentAsWindow,
GetID(),
GetPosition(),
GetSize(),
GetStyle(wxT("style")));
SetupWindow(anb);
wxAuiNotebook *old_par = m_notebook;
m_notebook = anb;
bool old_ins = m_isInside;
m_isInside = true;
CreateChildren(m_notebook, true/*only this handler*/);
m_isInside = old_ins;
m_notebook = old_par;
return anb;
}
}
开发者ID:chromylei,项目名称:third_party,代码行数:68,代码来源:xh_auinotbk.cpp
示例18: wxCHECK_MSG
//.........这里部分代码省略.........
{
m_toolbar->Realize();
m_toolbar->EnableTool(GetID(),false);
}
}
return m_toolbar; // must return non-NULL
}
else if (m_class == _T("separator"))
{
wxCHECK_MSG(m_toolbar, NULL, _("Incorrect syntax of XRC resource: separator not within a toolbar!"));
m_toolbar->AddSeparator();
return m_toolbar; // must return non-NULL
}
else /*<object class="wxToolBar">*/
{
m_isAddon=(m_class == _T("wxToolBarAddOn"));
if(m_isAddon)
{ // special case: Only add items to toolbar
toolbar=(wxToolBar*)m_instance;
// XRC_MAKE_INSTANCE(toolbar, wxToolBar);
}
else
{
int style = GetStyle(_T("style"), wxNO_BORDER | wxTB_HORIZONTAL);
#ifdef __WXMSW__
if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
#endif
XRC_MAKE_INSTANCE(toolbar, wxToolBar)
toolbar->Create(m_parentAsWindow,
GetID(),
GetPosition(),
GetSize(),
style,
GetName());
wxSize bmpsize = GetSize(_T("bitmapsize"));
if (!(bmpsize == wxDefaultSize))
toolbar->SetToolBitmapSize(bmpsize);
wxSize margins = GetSize(_T("margins"));
if (!(margins == wxDefaultSize))
toolbar->SetMargins(margins.x, margins.y);
long packing = GetLong(_T("packing"), -1);
if (packing != -1)
toolbar->SetToolPacking(packing);
long separation = GetLong(_T("separation"), -1);
if (separation != -1)
toolbar->SetToolSeparation(separation);
}
wxXmlNode *children_node = GetParamNode(_T("object"));
if (!children_node)
children_node = GetParamNode(_T("object_ref"));
if (children_node == NULL) return toolbar;
m_isInside = TRUE;
m_toolbar = toolbar;
wxXmlNode *n = children_node;
while (n)
{
if ((n->GetType() == wxXML_ELEMENT_NODE) &&
(n->GetName() == _T("object") || n->GetName() == _T("object_ref")))
{
wxObject *created = CreateResFromNode(n, toolbar, NULL);
wxControl *control = wxDynamicCast(created, wxControl);
if (!IsOfClass(n, _T("tool")) &&
!IsOfClass(n, _T("separator")) &&
control != NULL &&
control != toolbar)
{
//Manager::Get()->GetLogManager()->DebugLog(F(_T("control=%p, parent=%p, toolbar=%p"), control, control->GetParent(), toolbar));
toolbar->AddControl(control);
}
}
n = n->GetNext();
}
toolbar->Realize();
m_isInside = FALSE;
m_toolbar = NULL;
if(!m_isAddon)
{
if (m_parentAsWindow && !GetBool(_T("dontattachtoframe")))
{
wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame);
if (parentFrame)
parentFrame->SetToolBar(toolbar);
}
}
m_isAddon=false;
return toolbar;
}
}
开发者ID:stahta01,项目名称:codeblocks_r7456,代码行数:101,代码来源:xtra_res.cpp
示例19: ReportError
wxObject *wxAuiToolBarXmlHandler::DoCreateResource()
{
if (m_class == wxS("tool"))
{
if ( !m_toolbar )
{
ReportError("tool only allowed inside a wxAuiToolBar");
return NULL;
}
wxItemKind kind = wxITEM_NORMAL;
if (GetBool(wxS("radio")))
kind = wxITEM_RADIO;
if (GetBool(wxS("toggle")))
{
if ( kind != wxITEM_NORMAL )
{
ReportParamError
(
"toggle",
"tool can't have both <radio> and <toggle> properties"
);
}
kind = wxITEM_CHECK;
}
#if wxUSE_MENUS
// check whether we have dropdown tag inside
wxMenu *menu = NULL; // menu for drop down items
wxXmlNode * const nodeDropdown = GetParamNode("dropdown");
if ( nodeDropdown )
{
// also check for the menu specified inside dropdown (it is
// optional and may be absent for e.g. dynamically-created
// menus)
wxXmlNode * const nodeMenu = GetNodeChildren(nodeDropdown);
if ( nodeMenu )
{
wxObject *res = CreateResFromNode(nodeMenu, NULL);
menu = wxDynamicCast(res, wxMenu);
if ( !menu )
{
ReportError
(
nodeMenu,
"drop-down tool contents can only be a wxMenu"
);
}
if ( GetNodeNext(nodeMenu) )
{
ReportError
(
GetNodeNext(nodeMenu),
"unexpected extra contents under drop-down tool"
);
}
}
}
#endif
wxAuiToolBarItem * const tool =
m_toolbar->AddTool
(
GetID(),
GetText(wxS("label")),
GetBitmap(wxS("bitmap"), wxART_TOOLBAR, m_toolSize),
GetBitmap(wxS("bitmap2"), wxART_TOOLBAR, m_toolSize),
kind,
GetText(wxS("tooltip")),
GetText(wxS("longhelp")),
NULL
);
if ( GetBool(wxS("disabled")) )
m_toolbar->EnableTool(GetID(), false);
#if wxUSE_MENUS
if (menu)
{
tool->SetHasDropDown(true);
tool->SetUserData(m_menuHandler.RegisterMenu(m_toolbar, GetID(), menu));
}
#endif
return m_toolbar; // must return non-NULL
}
else if (m_class == wxS("separator") || m_class == wxS("space") || m_class == wxS("label"))
{
if ( !m_toolbar )
{
ReportError("separators only allowed inside wxAuiToolBar");
return NULL;
}
if ( m_class == wxS("separator") )
m_toolbar->AddSeparator();
else if (m_class == wxS("space"))
//.........这里部分代码省略.........
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:101,代码来源:xh_auitoolb.cpp
示例20: XRC_MAKE_INSTANCE
wxObject *wxTreebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxTreebook"))
{
XRC_MAKE_INSTANCE(tbk, wxTreebook)
tbk->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style")),
GetName());
wxTreebook * old_par = m_tbk;
m_tbk = tbk;
bool old_ins = m_isInside;
m_isInside = true;
wxArrayTbkPageIndexes old_treeContext = m_treeContext;
m_treeContext.Clear();
CreateChildren(m_tbk, true/*only this handler*/);
m_treeContext = old_treeContext;
m_isInside = old_ins;
m_tbk = old_par;
return tbk;
}
// else ( m_class == wxT("treebookpage") )
wxXmlNode *n = GetParamNode(wxT("object"));
wxWindow *wnd = NULL;
if ( !n )
n = GetParamNode(wxT("object_ref"));
if (n)
{
bool old_ins = m_isInside;
m_isInside = false;
wxObject *item = CreateResFromNode(n, m_tbk, NULL);
m_isInside = old_ins;
wnd = wxDynamicCast(item, wxWindow);
if (wnd == NULL && item != NULL)
wxLogError(wxT("Error in resource: control within treebook's <page> tag is not a window."));
}
size_t depth = GetLong( wxT("depth") );
if( depth <= m_treeContext.Count() )
{
// first prepare the icon
int imgIndex = wxNOT_FOUND;
if ( HasParam(wxT("bitmap")) )
{
wxBitmap bmp = GetBitmap(wxT("bitmap"), wxART_OTHER);
wxImageList *imgList = m_tbk->GetImageList();
if ( imgList == NULL )
{
imgList = new wxImageList( bmp.GetWidth(), bmp.GetHeight() );
m_tbk->AssignImageList( imgList );
}
imgIndex = imgList->Add(bmp);
}
// then add the page to the corresponding parent
if( depth < m_treeContext.Count() )
m_treeContext.RemoveAt(depth, m_treeContext.Count() - depth );
if( depth == 0)
{
m_tbk->AddPage(wnd,
GetText(wxT("label")), GetBool(wxT("selected")), imgIndex);
}
else
{
m_tbk->InsertSubPage(m_treeContext.Item(depth - 1), wnd,
GetText(wxT("label")), GetBool(wxT("selected")), imgIndex);
}
m_treeContext.Add( m_tbk->GetPageCount() - 1);
}
else
wxLogError(wxT("Error in resource. wxTreebookPage has an invalid depth."));
return wnd;
}
开发者ID:AlexHayton,项目名称:decoda,代码行数:88,代码来源:xh_treebk.cpp
注:本文中的GetParamNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论