bool kwxLinearRegulatorHandler::CanHandle(wxXmlNode *node) { // this function tells XRC system that this handler can parse // the <object class="MyControl"> tags return IsOfClass(node, wxT("kwxLinearRegulator")); }
bool wxScrolledWindowXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxScrolledWindow")); }
bool MaxBitmapComboBoxXmlHandler::CanHandle(wxXmlNode *node) { return ((!m_isInside && IsOfClass(node, wxT("wxBitmapComboBox"))) || (m_isInside && IsOfClass(node, wxT("ownerdrawnitem")))); }
bool wxDateCtrlXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxDatePickerCtrl")); }
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")) { // This may be a stretch spacer (the default) or a non-stretch one bool hasProportion = HasParam(wxS("proportion")); bool hasWidth = HasParam(wxS("width")); if (hasProportion && hasWidth) { ReportError("A space can't both stretch and have width"); return NULL; } if (hasWidth) { m_toolbar->AddSpacer ( GetLong(wxS("width")) ); } else { m_toolbar->AddStretchSpacer ( GetLong(wxS("proportion"), 1l) ); } } else if (m_class == wxS("label")) { m_toolbar->AddLabel ( GetID(), GetText(wxS("label")), GetLong(wxS("width"), -1l) ); } return m_toolbar; // must return non-NULL } else /*<object class="wxAuiToolBar">*/ { int style = GetStyle(wxS("style"), wxNO_BORDER | wxTB_HORIZONTAL); #ifdef __WXMSW__ if (!(style & wxNO_BORDER)) style |= wxNO_BORDER; #endif XRC_MAKE_INSTANCE(toolbar, wxAuiToolBar) toolbar->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), style); toolbar->SetName(GetName()); SetupWindow(toolbar); m_toolSize = GetSize(wxS("bitmapsize")); if (!(m_toolSize == wxDefaultSize)) toolbar->SetToolBitmapSize(m_toolSize); wxSize margins = GetSize(wxS("margins")); if (!(margins == wxDefaultSize)) toolbar->SetMargins(margins.x, margins.y); long packing = GetLong(wxS("packing"), -1); if (packing != -1) toolbar->SetToolPacking(packing); long separation = GetLong(wxS("separation"), -1); if (separation != -1) toolbar->SetToolSeparation(separation); wxXmlNode *children_node = GetParamNode(wxS("object")); if (!children_node) children_node = GetParamNode(wxS("object_ref")); if (children_node == NULL) return toolbar; m_isInside = true; m_toolbar = toolbar; wxXmlNode *n = children_node; while (n) { if (IsObjectNode(n)) { wxObject *created = CreateResFromNode(n, toolbar, NULL); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxS("tool")) && !IsOfClass(n, wxS("separator")) && !IsOfClass(n, wxS("label")) && !IsOfClass(n, wxS("space")) && control != NULL) toolbar->AddControl(control); } n = GetNodeNext(n); } m_isInside = false; m_toolbar = NULL; toolbar->Realize(); return toolbar; } }
bool wxActivityIndicatorXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxS("wxActivityIndicator")); }
bool wxScrollingDialogXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxScrollingDialog")); }
bool wxGenericDirCtrlXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxGenericDirCtrl")); }
wxObject *wxToolBarXmlHandler::DoCreateResource() { if (m_class == wxT("tool")) { if ( !m_toolbar ) { ReportError("tool only allowed inside a wxToolBar"); return NULL; } wxItemKind kind = wxITEM_NORMAL; if (GetBool(wxT("radio"))) kind = wxITEM_RADIO; if (GetBool(wxT("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 ) { if ( kind != wxITEM_NORMAL ) { ReportParamError ( "dropdown", "drop-down tool can't have neither <radio> nor <toggle> properties" ); } kind = wxITEM_DROPDOWN; // also check for the menu specified inside dropdown (it is // optional and may be absent for e.g. dynamically-created // menus) wxXmlNode * const nodeMenu = nodeDropdown->GetChildren(); 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 ( nodeMenu->GetNext() ) { ReportError ( nodeMenu->GetNext(), "unexpected extra contents under drop-down tool" ); } } } #endif wxToolBarToolBase * const tool = m_toolbar->AddTool ( GetID(), GetText(wxT("label")), GetBitmap(wxT("bitmap"), wxART_TOOLBAR, m_toolSize), GetBitmap(wxT("bitmap2"), wxART_TOOLBAR, m_toolSize), kind, GetText(wxT("tooltip")), GetText(wxT("longhelp")) ); if ( GetBool(wxT("disabled")) ) m_toolbar->EnableTool(GetID(), false); #if wxUSE_MENUS if ( menu ) tool->SetDropdownMenu(menu); #endif return m_toolbar; // must return non-NULL } else if (m_class == wxT("separator") || m_class == wxT("space")) { if ( !m_toolbar ) { ReportError("separators only allowed inside wxToolBar"); return NULL; } if ( m_class == wxT("separator") ) m_toolbar->AddSeparator(); else m_toolbar->AddStretchableSpace(); return m_toolbar; // must return non-NULL } else /*<object class="wxToolBar">*/ { int style = GetStyle(wxT("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()); SetupWindow(toolbar); m_toolSize = GetSize(wxT("bitmapsize")); if (!(m_toolSize == wxDefaultSize)) toolbar->SetToolBitmapSize(m_toolSize); wxSize margins = GetSize(wxT("margins")); if (!(margins == wxDefaultSize)) toolbar->SetMargins(margins.x, margins.y); long packing = GetLong(wxT("packing"), -1); if (packing != -1) toolbar->SetToolPacking(packing); long separation = GetLong(wxT("separation"), -1); if (separation != -1) toolbar->SetToolSeparation(separation); wxXmlNode *children_node = GetParamNode(wxT("object")); if (!children_node) children_node = GetParamNode(wxT("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() == wxT("object") || n->GetName() == wxT("object_ref"))) { wxObject *created = CreateResFromNode(n, toolbar, NULL); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxT("tool")) && !IsOfClass(n, wxT("separator")) && !IsOfClass(n, wxT("space")) && control != NULL) toolbar->AddControl(control); } n = n->GetNext(); } m_isInside = false; m_toolbar = NULL; toolbar->Realize(); if (m_parentAsWindow && !GetBool(wxT("dontattachtoframe"))) { wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame); if (parentFrame) parentFrame->SetToolBar(toolbar); } return toolbar; } }
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxStaticText")); }
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxPanel")); }
bool ctlCheckTreeViewXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("ctlCheckTreeView")); }
wxObject *wxToolBarXmlHandlerEx::DoCreateResource() { if (m_class == wxT("tool")) { wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XRC resource: tool not within a toolbar!")); if (GetPosition() != wxDefaultPosition) { m_toolbar->AddTool(GetID(), GetBitmap(wxT("bitmap"), wxART_TOOLBAR), GetBitmap(wxT("bitmap2"), wxART_TOOLBAR), GetBool(wxT("toggle")), GetPosition().x, GetPosition().y, NULL, GetText(wxT("tooltip")), GetText(wxT("longhelp"))); } else { wxItemKind kind = wxITEM_NORMAL; if (GetBool(wxT("radio"))) kind = wxITEM_RADIO; if (GetBool(wxT("toggle"))) { wxASSERT_MSG( kind == wxITEM_NORMAL, _T("can't have both toggleable and radion button at once") ); kind = wxITEM_CHECK; } m_toolbar->AddTool(GetID(), GetText(wxT("label")), GetBitmap(wxT("bitmap"), wxART_TOOLBAR, m_iconSize), GetBitmap(wxT("bitmap2"), wxART_TOOLBAR, m_iconSize), kind, GetText(wxT("tooltip")), GetText(wxT("longhelp"))); if ( GetBool(wxT("disabled")) ) m_toolbar->EnableTool(GetID(), false); } return m_toolbar; // must return non-NULL } else if (m_class == wxT("separator")) { wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XRC resource: separator not within a toolbar!")); m_toolbar->AddSeparator(); return m_toolbar; // must return non-NULL } else /*<object class="wxToolBar">*/ { int style = GetStyle(wxT("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; if (m_iconSize.IsFullySpecified()) bmpsize = m_iconSize; else bmpsize = GetSize(wxT("bitmapsize")); if (!(bmpsize == wxDefaultSize)) toolbar->SetToolBitmapSize(bmpsize); wxSize margins = GetSize(wxT("margins")); if (!(margins == wxDefaultSize)) toolbar->SetMargins(margins.x, margins.y); long packing = GetLong(wxT("packing"), -1); if (packing != -1) toolbar->SetToolPacking(packing); long separation = GetLong(wxT("separation"), -1); if (separation != -1) toolbar->SetToolSeparation(separation); if (HasParam(wxT("bg"))) toolbar->SetBackgroundColour(GetColour(wxT("bg"))); wxXmlNode *children_node = GetParamNode(wxT("object")); if (!children_node) children_node = GetParamNode(wxT("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() == wxT("object") || n->GetName() == wxT("object_ref"))) { wxObject *created = CreateResFromNode(n, toolbar, NULL); wxControl *control = wxDynamicCast(created, wxControl); if (!IsOfClass(n, wxT("tool")) && !IsOfClass(n, wxT("separator")) && control != NULL) toolbar->AddControl(control); } n = n->GetNext(); } m_isInside = false; m_toolbar = NULL; toolbar->Realize(); if (m_parentAsWindow && !GetBool(wxT("dontattachtoframe"))) { wxFrame *parentFrame = wxDynamicCast(m_parent, wxFrame); if (parentFrame) parentFrame->SetToolBar(toolbar); } return toolbar; } }
bool wxToolBarXmlHandlerEx::CanHandle(wxXmlNode *node) { return ((!m_isInside && IsOfClass(node, wxT("wxToolBar"))) || (m_isInside && IsOfClass(node, wxT("tool"))) || (m_isInside && IsOfClass(node, wxT("separator")))); }
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxSlider")); }
bool CGToggleButton::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxToggleButton")); }
bool wxTreebookXmlHandler::CanHandle(wxXmlNode *node) { return ((!m_isInside && IsOfClass(node, wxT("wxTreebook"))) || (m_isInside && IsOfClass(node, wxT("treebookpage")))); }
bool ProjectListBoxXmlHandler::CanHandle(wxXmlNode* node) { return IsOfClass(node, wxT("ProjectListBox")); }
bool wxStatusBarXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxStatusBar")); }
bool wxTimeSpinXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxTimeSpinCtrl")); }
wxObject *wxToolBarAddOnXmlHandler::DoCreateResource() { wxToolBar* toolbar=NULL; if (m_class == _T("tool")) { wxCHECK_MSG(m_toolbar, NULL, _("Incorrect syntax of XRC resource: tool not within a toolbar!")); wxSize bitmapSize = m_toolbar->GetToolBitmapSize(); if (GetPosition() != wxDefaultPosition) { m_toolbar->AddTool(GetID(), #if wxCHECK_VERSION(2, 9, 0) wxEmptyString, #endif GetCenteredBitmap(_T("bitmap"), wxART_TOOLBAR, bitmapSize), GetCenteredBitmap(_T("bitmap2"), wxART_TOOLBAR, bitmapSize), #if !wxCHECK_VERSION(2, 9, 0) GetBool(_T("toggle")), GetPosition().x, GetPosition().y, NULL, #else wxITEM_NORMAL, #endif GetText(_T("tooltip")), GetText(_T("longhelp"))); if (GetBool(_T("disabled"))) { m_toolbar->Realize(); m_toolbar->EnableTool(GetID(),false); } } else { wxItemKind kind = wxITEM_NORMAL; if (GetBool(_T("radio"))) kind = wxITEM_RADIO; if (GetBool(_T("toggle"))) { wxASSERT_MSG( kind == wxITEM_NORMAL, _("can't have both toggleable and radion button at once") ); kind = wxITEM_CHECK; } m_toolbar->AddTool(GetID(), GetText(_T("label")), GetCenteredBitmap(_T("bitmap"), wxART_TOOLBAR, bitmapSize), GetCenteredBitmap(_T("bitmap2"), wxART_TOOLBAR, bitmapSize), kind, GetText(_T("tooltip")), GetText(_T("longhelp"))); if (GetBool(_T("disabled"))) { 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; } }
bool LimitsDialog::ListCtrl::XmlHandler::CanHandle(wxXmlNode* node) { return IsOfClass(node, wxT("LimitsDialog::ListCtrl")); }
// Returns true if we know how to create a control for the given node. bool wxStaticPictureXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxStaticPicture")); }
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node) { return (IsOfClass(node, wxT("wxComboBox")) || (m_insideBox && node->GetName() == wxT("item"))); }
bool wxCalendarBoxXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxCalendarBox")); }
bool wxPropertySheetDialogXmlHandler::CanHandle(wxXmlNode *node) { return ((!m_isInside && IsOfClass(node, wxT("wxPropertySheetDialog"))) || (m_isInside && IsOfClass(node, wxT("propertysheetpage")))); }
bool wxFileCtrlXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxFileCtrl")); }
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("wxSpinButton")); }
bool MyRearrangeListXmlHandler::CanHandle(wxXmlNode* node) { return (IsOfClass(node, wxT("wxRearrangeList")) || (m_insideBox && node->GetName() == wxT("item"))); }
bool ctlSQLBoxXmlHandler::CanHandle(wxXmlNode *node) { return IsOfClass(node, wxT("ctlSQLBox")); }