use a programmer-friendly macro for subclassing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2001-12-29 16:14:04 +00:00
parent daa85ee3af
commit 544fee32ee
60 changed files with 618 additions and 984 deletions

View File

@ -33,14 +33,11 @@ wxObject *wxBitmapXmlHandler::DoCreateResource()
return new wxBitmap(GetBitmap(wxT("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
@ -51,10 +48,7 @@ wxObject *wxIconXmlHandler::DoCreateResource()
return new wxIcon(GetIcon(wxT("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxIcon"));
}

View File

@ -25,25 +25,27 @@
wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_AUTODRAW);
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
XRC_ADD_STYLE(wxBU_AUTODRAW);
XRC_ADD_STYLE(wxBU_LEFT);
XRC_ADD_STYLE(wxBU_RIGHT);
XRC_ADD_STYLE(wxBU_TOP);
XRC_ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
{
wxBitmapButton *button = new wxBitmapButton(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
XRC_MAKE_INSTANCE(button, wxBitmapButton)
button->Create(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0))
button->SetDefault();
SetupWindow(button);
if (!GetParamValue(wxT("selected")).IsEmpty())
@ -56,11 +58,7 @@ wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmapButton"));
}

View File

@ -26,20 +26,16 @@
wxButtonXmlHandler::wxButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
XRC_ADD_STYLE(wxBU_LEFT);
XRC_ADD_STYLE(wxBU_RIGHT);
XRC_ADD_STYLE(wxBU_TOP);
XRC_ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxButtonXmlHandler::DoCreateResource()
{
wxButton *button = wxStaticCast(m_instance, wxButton);
if (!button)
button = new wxButton;
XRC_MAKE_INSTANCE(button, wxButton)
button->Create(m_parentAsWindow,
GetID(),
@ -49,17 +45,14 @@ wxObject *wxButtonXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
if (GetBool(wxT("default"), 0))
button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxButton"));
}

View File

@ -27,21 +27,18 @@
wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxCAL_SUNDAY_FIRST);
ADD_STYLE(wxCAL_MONDAY_FIRST);
ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
XRC_ADD_STYLE(wxCAL_SUNDAY_FIRST);
XRC_ADD_STYLE(wxCAL_MONDAY_FIRST);
XRC_ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
XRC_ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
XRC_ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
AddWindowStyles();
}
wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
{
wxCalendarCtrl *calendar = wxStaticCast(m_instance, wxCalendarCtrl);
if (!calendar)
calendar = new wxCalendarCtrl;
XRC_MAKE_INSTANCE(calendar, wxCalendarCtrl);
calendar->Create(m_parentAsWindow,
GetID(),
@ -56,11 +53,7 @@ wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
return calendar;
}
bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCalendarCtrl"));
}

View File

@ -32,10 +32,7 @@ wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
wxObject *wxCheckBoxXmlHandler::DoCreateResource()
{
wxCheckBox *control = wxStaticCast(m_instance, wxCheckBox);
if (!control)
control = new wxCheckBox;
XRC_MAKE_INSTANCE(control, wxCheckBox)
control->Create(m_parentAsWindow,
GetID(),
@ -45,14 +42,12 @@ wxObject *wxCheckBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
control->SetValue( GetBool( wxT("checked")));
control->SetValue(GetBool( wxT("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCheckBox"));

View File

@ -37,18 +37,15 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
m_insideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
for(int i = 0; i < count; i++)
strings[i] = strList[i];
}
wxCheckListBox *control = wxStaticCast(m_instance, wxCheckListBox);
if (!control)
control = new wxCheckListBox;
XRC_MAKE_INSTANCE(control, wxCheckListBox)
control->Create(m_parentAsWindow,
GetID(),
@ -81,8 +78,8 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -93,20 +90,15 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
// handle <item checked="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxCheckList")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -25,7 +25,7 @@
wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SORT);
XRC_ADD_STYLE(wxCB_SORT);
AddWindowStyles();
}
@ -34,24 +34,21 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
if( m_class == wxT("wxChoice"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
wxChoice *control = wxStaticCast(m_instance, wxChoice);
if (!control)
control = new wxChoice;
XRC_MAKE_INSTANCE(control, wxChoice)
control->Create(m_parentAsWindow,
GetID(),
@ -62,13 +59,13 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -79,20 +76,14 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxChoice")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -27,10 +27,10 @@
wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SIMPLE);
ADD_STYLE(wxCB_SORT);
ADD_STYLE(wxCB_READONLY);
ADD_STYLE(wxCB_DROPDOWN);
XRC_ADD_STYLE(wxCB_SIMPLE);
XRC_ADD_STYLE(wxCB_SORT);
XRC_ADD_STYLE(wxCB_READONLY);
XRC_ADD_STYLE(wxCB_DROPDOWN);
AddWindowStyles();
}
@ -43,23 +43,19 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
XRC_MAKE_INSTANCE(control, wxComboBox)
wxComboBox *control = wxStaticCast(m_instance, wxComboBox);
if (!control)
control = new wxComboBox;
control->Create(m_parentAsWindow,
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
@ -69,13 +65,13 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -86,20 +82,16 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxComboBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}
#endif

View File

@ -27,25 +27,24 @@
wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxDIALOG_MODAL);
ADD_STYLE(wxDIALOG_MODELESS);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxCAPTION);
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
XRC_ADD_STYLE(wxTHICK_FRAME);
XRC_ADD_STYLE(wxSYSTEM_MENU);
XRC_ADD_STYLE(wxRESIZE_BORDER);
XRC_ADD_STYLE(wxRESIZE_BOX);
XRC_ADD_STYLE(wxDIALOG_MODAL);
XRC_ADD_STYLE(wxDIALOG_MODELESS);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxDialogXmlHandler::DoCreateResource()
{
wxDialog *dlg = wxDynamicCast(m_instance, wxDialog);
@ -58,10 +57,12 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
GetName());
if (HasParam(wxT("size")))
dlg->SetClientSize(GetSize());
if (HasParam(wxT("pos")))
dlg->Move(GetPosition());
SetupWindow(dlg);
CreateChildren(dlg);
@ -72,11 +73,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
return dlg;
}
bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxDialog"));
}

View File

@ -27,30 +27,29 @@
wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxDEFAULT_FRAME_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxCAPTION);
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
XRC_ADD_STYLE(wxDEFAULT_FRAME_STYLE);
XRC_ADD_STYLE(wxTHICK_FRAME);
XRC_ADD_STYLE(wxSYSTEM_MENU);
XRC_ADD_STYLE(wxRESIZE_BORDER);
XRC_ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxFRAME_TOOL_WINDOW);
ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
ADD_STYLE(wxMAXIMIZE_BOX);
ADD_STYLE(wxMINIMIZE_BOX);
ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxFRAME_TOOL_WINDOW);
XRC_ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
XRC_ADD_STYLE(wxMAXIMIZE_BOX);
XRC_ADD_STYLE(wxMINIMIZE_BOX);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxFrameXmlHandler::DoCreateResource()
{
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
@ -58,15 +57,17 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance."));
frame->Create(m_parentAsWindow,
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
GetName());
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
GetName());
if (HasParam(wxT("size")))
frame->SetClientSize(GetSize());
if (HasParam(wxT("pos")))
frame->Move(GetPosition());
SetupWindow(frame);
CreateChildren(frame);
@ -77,11 +78,7 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
return frame;
}
bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxFrame"));
}

View File

@ -27,52 +27,46 @@
wxGaugeXmlHandler::wxGaugeXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxGA_HORIZONTAL );
ADD_STYLE( wxGA_VERTICAL );
ADD_STYLE( wxGA_PROGRESSBAR );
ADD_STYLE( wxGA_SMOOTH ); // windows only
XRC_ADD_STYLE(wxGA_HORIZONTAL);
XRC_ADD_STYLE(wxGA_VERTICAL);
XRC_ADD_STYLE(wxGA_PROGRESSBAR);
XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
AddWindowStyles();
}
wxObject *wxGaugeXmlHandler::DoCreateResource()
{
wxGauge *control = wxStaticCast(m_instance, wxGauge);
if (!control)
control = new wxGauge;
XRC_MAKE_INSTANCE(control, wxGauge)
control->Create(m_parentAsWindow,
GetID(),
GetLong( wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetLong(wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if( HasParam( wxT("value") ))
if( HasParam(wxT("value")))
{
control->SetValue( GetLong( wxT("value") ));
control->SetValue(GetLong(wxT("value")));
}
if( HasParam( wxT("shadow") ))
if( HasParam(wxT("shadow")))
{
control->SetShadowWidth( GetDimension( wxT("shadow") ));
control->SetShadowWidth(GetDimension(wxT("shadow")));
}
if( HasParam( wxT("bezel") ))
if( HasParam(wxT("bezel")))
{
control->SetBezelFace( GetDimension( wxT("bezel") ));
control->SetBezelFace(GetDimension(wxT("bezel")));
}
SetupWindow(control);
return control;
}
bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxGauge"));
}
#endif // wxUSE_GAUGE

View File

@ -30,14 +30,14 @@
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxHW_SCROLLBAR_NEVER);
ADD_STYLE(wxHW_SCROLLBAR_AUTO);
XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER);
XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO);
AddWindowStyles();
}
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
{
wxHtmlWindow *control = wxStaticCast(m_instance, wxHtmlWindow);
XRC_MAKE_INSTANCE(control, wxHtmlWindow)
control->Create(m_parentAsWindow,
GetID(),
@ -50,7 +50,7 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
control->SetBorders(GetDimension(wxT("borders")));
}
if( HasParam(wxT("url")))
if (HasParam(wxT("url")))
{
wxString url = GetParamValue(wxT("url"));
wxFileSystem& fsys = GetCurFileSystem();
@ -75,8 +75,6 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
return control;
}
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxHtmlWindow"));

View File

@ -25,13 +25,13 @@
wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxLB_SINGLE);
ADD_STYLE(wxLB_MULTIPLE);
ADD_STYLE(wxLB_EXTENDED);
ADD_STYLE(wxLB_HSCROLL);
ADD_STYLE(wxLB_ALWAYS_SB);
ADD_STYLE(wxLB_NEEDED_SB);
ADD_STYLE(wxLB_SORT);
XRC_ADD_STYLE(wxLB_SINGLE);
XRC_ADD_STYLE(wxLB_MULTIPLE);
XRC_ADD_STYLE(wxLB_EXTENDED);
XRC_ADD_STYLE(wxLB_HSCROLL);
XRC_ADD_STYLE(wxLB_ALWAYS_SB);
XRC_ADD_STYLE(wxLB_NEEDED_SB);
XRC_ADD_STYLE(wxLB_SORT);
AddWindowStyles();
}
@ -40,24 +40,21 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
if( m_class == wxT("wxListBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
wxListBox *control = wxStaticCast(m_instance, wxListBox);
if (!control)
control = new wxListBox;
XRC_MAKE_INSTANCE(control, wxListBox)
control->Create(m_parentAsWindow,
GetID(),
@ -68,13 +65,13 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -85,20 +82,14 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxListBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -27,46 +27,40 @@
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLC_LIST);
ADD_STYLE(wxLC_REPORT);
ADD_STYLE(wxLC_ICON);
ADD_STYLE(wxLC_SMALL_ICON);
ADD_STYLE(wxLC_ALIGN_TOP);
ADD_STYLE(wxLC_ALIGN_LEFT);
ADD_STYLE(wxLC_AUTOARRANGE);
ADD_STYLE(wxLC_USER_TEXT);
ADD_STYLE(wxLC_EDIT_LABELS);
ADD_STYLE(wxLC_NO_HEADER);
ADD_STYLE(wxLC_SINGLE_SEL);
ADD_STYLE(wxLC_SORT_ASCENDING);
ADD_STYLE(wxLC_SORT_DESCENDING);
XRC_ADD_STYLE(wxLC_LIST);
XRC_ADD_STYLE(wxLC_REPORT);
XRC_ADD_STYLE(wxLC_ICON);
XRC_ADD_STYLE(wxLC_SMALL_ICON);
XRC_ADD_STYLE(wxLC_ALIGN_TOP);
XRC_ADD_STYLE(wxLC_ALIGN_LEFT);
XRC_ADD_STYLE(wxLC_AUTOARRANGE);
XRC_ADD_STYLE(wxLC_USER_TEXT);
XRC_ADD_STYLE(wxLC_EDIT_LABELS);
XRC_ADD_STYLE(wxLC_NO_HEADER);
XRC_ADD_STYLE(wxLC_SINGLE_SEL);
XRC_ADD_STYLE(wxLC_SORT_ASCENDING);
XRC_ADD_STYLE(wxLC_SORT_DESCENDING);
AddWindowStyles();
}
wxObject *wxListCtrlXmlHandler::DoCreateResource()
{
wxListCtrl *list = wxStaticCast(m_instance, wxListCtrl);
XRC_MAKE_INSTANCE(list, wxListCtrl)
if (!list)
list = new wxListCtrl;
list->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
list->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
/* TODO: columns definition */
// FIXME: add columns definition
SetupWindow(list);
return list;
}
bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxListCtrl"));

View File

@ -27,11 +27,9 @@
wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_insideMenu(FALSE)
{
ADD_STYLE(wxMENU_TEAROFF);
XRC_ADD_STYLE(wxMENU_TEAROFF);
}
wxObject *wxMenuXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxMenu"))
@ -103,16 +101,11 @@ bool wxMenuXmlHandler::CanHandle(wxXmlNode *node)
);
}
wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxMB_DOCKABLE);
XRC_ADD_STYLE(wxMB_DOCKABLE);
}
wxObject *wxMenuBarXmlHandler::DoCreateResource()
{
wxMenuBar *menubar = new wxMenuBar(GetStyle());
@ -134,4 +127,3 @@ bool wxMenuBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenuBar"));
}

View File

@ -30,23 +30,21 @@
wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_notebook(NULL)
{
ADD_STYLE(wxNB_FIXEDWIDTH);
ADD_STYLE(wxNB_LEFT);
ADD_STYLE(wxNB_RIGHT);
ADD_STYLE(wxNB_BOTTOM);
XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
XRC_ADD_STYLE(wxNB_LEFT);
XRC_ADD_STYLE(wxNB_RIGHT);
XRC_ADD_STYLE(wxNB_BOTTOM);
AddWindowStyles();
}
wxObject *wxNotebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("notebookpage"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if (n)
{
@ -70,17 +68,15 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
}
}
else {
wxNotebook *nb = wxStaticCast(m_instance, wxNotebook);
else
{
XRC_MAKE_INSTANCE(nb, wxNotebook)
if ( !nb )
nb = new wxNotebook;
nb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" )),
GetName());
nb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style")),
GetName());
wxNotebook *old_par = m_notebook;
m_notebook = nb;
@ -97,8 +93,6 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
}
}
bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxNotebook"))) ||

View File

@ -25,21 +25,16 @@
wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxPanelXmlHandler::DoCreateResource()
{
wxPanel *panel = wxDynamicCast(m_instance, wxPanel);
if (!panel)
panel = new wxPanel;
XRC_MAKE_INSTANCE(panel, wxPanel)
panel->Create(m_parentAsWindow,
GetID(),
@ -53,7 +48,6 @@ wxObject *wxPanelXmlHandler::DoCreateResource()
return panel;
}
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxPanel"));

View File

@ -27,7 +27,7 @@
wxRadioButtonXmlHandler::wxRadioButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxRB_GROUP );
XRC_ADD_STYLE(wxRB_GROUP);
AddWindowStyles();
}
@ -40,10 +40,7 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource()
* normal radio button.
*/
wxRadioButton *control = wxStaticCast(m_instance, wxRadioButton);
if (!control)
control = new wxRadioButton;
XRC_MAKE_INSTANCE(control, wxRadioButton)
control->Create(m_parentAsWindow,
GetID(),
@ -53,18 +50,15 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
control->SetValue( GetBool(wxT("value"), 0));
control->SetValue(GetBool(wxT("value"), 0));
SetupWindow(control);
return control;
}
bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxRadioButton"));
}
#endif

View File

@ -25,12 +25,12 @@
#if wxUSE_RADIOBOX
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
: wxXmlResourceHandler(), m_insideBox(FALSE)
{
ADD_STYLE(wxRA_SPECIFY_COLS);
ADD_STYLE(wxRA_HORIZONTAL);
ADD_STYLE(wxRA_SPECIFY_ROWS);
ADD_STYLE(wxRA_VERTICAL);
XRC_ADD_STYLE(wxRA_SPECIFY_COLS);
XRC_ADD_STYLE(wxRA_HORIZONTAL);
XRC_ADD_STYLE(wxRA_SPECIFY_ROWS);
XRC_ADD_STYLE(wxRA_VERTICAL);
AddWindowStyles();
}
@ -53,10 +53,7 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
strings[i]=strList[i];
}
wxRadioBox *control = wxStaticCast(m_instance, wxRadioBox);
if (!control)
control = new wxRadioBox;
XRC_MAKE_INSTANCE(control, wxRadioBox)
control->Create(m_parentAsWindow,
GetID(),
@ -69,13 +66,13 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -86,20 +83,17 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
// handle <item selected="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxRadioBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}
#endif

View File

@ -26,17 +26,14 @@
wxScrollBarXmlHandler::wxScrollBarXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSB_HORIZONTAL );
ADD_STYLE( wxSB_VERTICAL );
XRC_ADD_STYLE(wxSB_HORIZONTAL);
XRC_ADD_STYLE(wxSB_VERTICAL);
AddWindowStyles();
}
wxObject *wxScrollBarXmlHandler::DoCreateResource()
{
wxScrollBar *control = wxStaticCast(m_instance, wxScrollBar);
if (!control)
control = new wxScrollBar;
XRC_MAKE_INSTANCE(control, wxScrollBar)
control->Create(m_parentAsWindow,
GetID(),
@ -48,21 +45,14 @@ wxObject *wxScrollBarXmlHandler::DoCreateResource()
control->SetScrollbar(GetLong( wxT("value"), 0),
GetLong( wxT("thumbsize"),1),
GetLong( wxT("range"), 10),
GetLong( wxT("pagesize"),1)
);
GetLong( wxT("pagesize"),1));
SetupWindow(control);
return control;
}
bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxScrollBar"));
}

View File

@ -39,35 +39,35 @@ bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_parentSizer(NULL)
{
ADD_STYLE(wxHORIZONTAL);
ADD_STYLE(wxVERTICAL);
XRC_ADD_STYLE(wxHORIZONTAL);
XRC_ADD_STYLE(wxVERTICAL);
// and flags
ADD_STYLE(wxLEFT);
ADD_STYLE(wxRIGHT);
ADD_STYLE(wxTOP);
ADD_STYLE(wxBOTTOM);
ADD_STYLE(wxNORTH);
ADD_STYLE(wxSOUTH);
ADD_STYLE(wxEAST);
ADD_STYLE(wxWEST);
ADD_STYLE(wxALL);
XRC_ADD_STYLE(wxLEFT);
XRC_ADD_STYLE(wxRIGHT);
XRC_ADD_STYLE(wxTOP);
XRC_ADD_STYLE(wxBOTTOM);
XRC_ADD_STYLE(wxNORTH);
XRC_ADD_STYLE(wxSOUTH);
XRC_ADD_STYLE(wxEAST);
XRC_ADD_STYLE(wxWEST);
XRC_ADD_STYLE(wxALL);
ADD_STYLE(wxGROW);
ADD_STYLE(wxEXPAND);
ADD_STYLE(wxSHAPED);
ADD_STYLE(wxSTRETCH_NOT);
XRC_ADD_STYLE(wxGROW);
XRC_ADD_STYLE(wxEXPAND);
XRC_ADD_STYLE(wxSHAPED);
XRC_ADD_STYLE(wxSTRETCH_NOT);
ADD_STYLE(wxALIGN_CENTER);
ADD_STYLE(wxALIGN_CENTRE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_TOP);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_BOTTOM);
ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTER_VERTICAL);
ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
XRC_ADD_STYLE(wxALIGN_CENTER);
XRC_ADD_STYLE(wxALIGN_CENTRE);
XRC_ADD_STYLE(wxALIGN_LEFT);
XRC_ADD_STYLE(wxALIGN_TOP);
XRC_ADD_STYLE(wxALIGN_RIGHT);
XRC_ADD_STYLE(wxALIGN_BOTTOM);
XRC_ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
XRC_ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
XRC_ADD_STYLE(wxALIGN_CENTER_VERTICAL);
XRC_ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
}

View File

@ -27,25 +27,22 @@
wxSliderXmlHandler::wxSliderXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSL_HORIZONTAL );
ADD_STYLE( wxSL_VERTICAL );
ADD_STYLE( wxSL_AUTOTICKS );
ADD_STYLE( wxSL_LABELS );
ADD_STYLE( wxSL_LEFT );
ADD_STYLE( wxSL_TOP );
ADD_STYLE( wxSL_RIGHT );
ADD_STYLE( wxSL_BOTTOM );
ADD_STYLE( wxSL_BOTH );
ADD_STYLE( wxSL_SELRANGE );
XRC_ADD_STYLE(wxSL_HORIZONTAL);
XRC_ADD_STYLE(wxSL_VERTICAL);
XRC_ADD_STYLE(wxSL_AUTOTICKS);
XRC_ADD_STYLE(wxSL_LABELS);
XRC_ADD_STYLE(wxSL_LEFT);
XRC_ADD_STYLE(wxSL_TOP);
XRC_ADD_STYLE(wxSL_RIGHT);
XRC_ADD_STYLE(wxSL_BOTTOM);
XRC_ADD_STYLE(wxSL_BOTH);
XRC_ADD_STYLE(wxSL_SELRANGE);
AddWindowStyles();
}
wxObject *wxSliderXmlHandler::DoCreateResource()
{
wxSlider *control = wxStaticCast(m_instance, wxSlider);
if (!control)
control = new wxSlider;
XRC_MAKE_INSTANCE(control, wxSlider)
control->Create(m_parentAsWindow,
GetID(),
@ -57,29 +54,29 @@ wxObject *wxSliderXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( HasParam( wxT("tickfreq") ))
if( HasParam(wxT("tickfreq")))
{
control->SetTickFreq( GetLong( wxT("tickfreq") ), 0 );
control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
}
if( HasParam( wxT("pagesize") ))
if( HasParam(wxT("pagesize")))
{
control->SetPageSize( GetLong( wxT("pagesize") ) );
control->SetPageSize(GetLong(wxT("pagesize")));
}
if( HasParam( wxT("linesize") ))
if( HasParam(wxT("linesize")))
{
control->SetLineSize( GetLong( wxT("linesize") ));
control->SetLineSize(GetLong(wxT("linesize")));
}
if( HasParam( wxT("thumb") ))
if( HasParam(wxT("thumb")))
{
control->SetThumbLength( GetLong( wxT("thumb") ));
control->SetThumbLength(GetLong(wxT("thumb")));
}
if( HasParam( wxT("tick") ))
if( HasParam(wxT("tick")))
{
control->SetTick( GetLong( wxT("tick") ));
control->SetTick(GetLong(wxT("tick")));
}
if( HasParam( wxT("selmin") ) && HasParam( wxT("selmax")) )
if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
{
control->SetSelection( GetLong( wxT("selmin") ), GetLong( wxT("selmax")) );
control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
}
SetupWindow(control);
@ -87,12 +84,9 @@ wxObject *wxSliderXmlHandler::DoCreateResource()
return control;
}
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSlider"));
}
#endif

View File

@ -27,19 +27,16 @@
wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
XRC_ADD_STYLE(wxSP_HORIZONTAL);
XRC_ADD_STYLE(wxSP_VERTICAL);
XRC_ADD_STYLE(wxSP_ARROW_KEYS);
XRC_ADD_STYLE(wxSP_WRAP);
AddWindowStyles();
}
wxObject *wxSpinButtonXmlHandler::DoCreateResource()
{
wxSpinButton *control = wxStaticCast(m_instance, wxSpinButton);
if (!control)
control = new wxSpinButton;
XRC_MAKE_INSTANCE(control, wxSpinButton)
control->Create(m_parentAsWindow,
GetID(),
@ -47,16 +44,14 @@ wxObject *wxSpinButtonXmlHandler::DoCreateResource()
GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
GetName());
control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) );
control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX) );
control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong(wxT("max"), wxSP_DEFAULT_MAX));
SetupWindow(control);
return control;
}
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinButton"));
@ -69,32 +64,31 @@ bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
XRC_ADD_STYLE(wxSP_HORIZONTAL);
XRC_ADD_STYLE(wxSP_VERTICAL);
XRC_ADD_STYLE(wxSP_ARROW_KEYS);
XRC_ADD_STYLE(wxSP_WRAP);
}
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
{
wxSpinCtrl *control = new wxSpinCtrl(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_ARROW_KEYS ),
GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX),
GetLong( wxT("value"), wxSP_DEFAULT_VALUE),
GetName()
);
XRC_MAKE_INSTANCE(control, wxSpinCtrl)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_ARROW_KEYS),
GetLong(wxT("min"), wxSP_DEFAULT_MIN),
GetLong(wxT("max"), wxSP_DEFAULT_MAX),
GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
GetName());
SetupWindow(control);
return control;
}
bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinCtrl"));

View File

@ -30,10 +30,7 @@ wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
{
wxStaticBitmap *bmp = wxStaticCast(m_instance, wxStaticBitmap);
if (!bmp)
bmp = new wxStaticBitmap;
XRC_MAKE_INSTANCE(bmp, wxStaticBitmap)
bmp->Create(m_parentAsWindow,
GetID(),
@ -47,11 +44,7 @@ wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
return bmp;
}
bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBitmap"));
}

View File

@ -30,10 +30,7 @@ wxStaticBoxXmlHandler::wxStaticBoxXmlHandler()
wxObject *wxStaticBoxXmlHandler::DoCreateResource()
{
wxStaticBox *box = wxStaticCast(m_instance, wxStaticBox);
if (!box)
box = new wxStaticBox;
XRC_MAKE_INSTANCE(box, wxStaticBox)
box->Create(m_parentAsWindow,
GetID(),
@ -47,11 +44,7 @@ wxObject *wxStaticBoxXmlHandler::DoCreateResource()
return box;
}
bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBox"));
}

View File

@ -27,17 +27,14 @@
wxStaticLineXmlHandler::wxStaticLineXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLI_HORIZONTAL);
ADD_STYLE(wxLI_VERTICAL);
XRC_ADD_STYLE(wxLI_HORIZONTAL);
XRC_ADD_STYLE(wxLI_VERTICAL);
AddWindowStyles();
}
wxObject *wxStaticLineXmlHandler::DoCreateResource()
{
wxStaticLine *line = wxStaticCast(m_instance, wxStaticLine);
if (!line)
line = new wxStaticLine;
XRC_MAKE_INSTANCE(line, wxStaticLine)
line->Create(m_parentAsWindow,
GetID(),
@ -50,8 +47,6 @@ wxObject *wxStaticLineXmlHandler::DoCreateResource()
return line;
}
bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticLine"));

View File

@ -25,19 +25,16 @@
wxStaticTextXmlHandler::wxStaticTextXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxST_NO_AUTORESIZE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_CENTRE);
XRC_ADD_STYLE(wxST_NO_AUTORESIZE);
XRC_ADD_STYLE(wxALIGN_LEFT);
XRC_ADD_STYLE(wxALIGN_RIGHT);
XRC_ADD_STYLE(wxALIGN_CENTRE);
AddWindowStyles();
}
wxObject *wxStaticTextXmlHandler::DoCreateResource()
{
wxStaticText *text = wxStaticCast(m_instance, wxStaticText);
if (!text)
text = new wxStaticText;
XRC_MAKE_INSTANCE(text, wxStaticText)
text->Create(m_parentAsWindow,
GetID(),
@ -51,11 +48,7 @@ wxObject *wxStaticTextXmlHandler::DoCreateResource()
return text;
}
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticText"));
}

View File

@ -24,40 +24,33 @@
wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxTE_PROCESS_ENTER);
ADD_STYLE(wxTE_PROCESS_TAB);
ADD_STYLE(wxTE_MULTILINE);
ADD_STYLE(wxTE_PASSWORD);
ADD_STYLE(wxTE_READONLY);
ADD_STYLE(wxHSCROLL);
XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
XRC_ADD_STYLE(wxTE_PROCESS_TAB);
XRC_ADD_STYLE(wxTE_MULTILINE);
XRC_ADD_STYLE(wxTE_PASSWORD);
XRC_ADD_STYLE(wxTE_READONLY);
XRC_ADD_STYLE(wxHSCROLL);
AddWindowStyles();
}
wxObject *wxTextCtrlXmlHandler::DoCreateResource()
{
wxTextCtrl *text = wxStaticCast(m_instance, wxTextCtrl);
XRC_MAKE_INSTANCE(text, wxTextCtrl)
if ( !text )
text = new wxTextCtrl;
text->Create( m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName() );
text->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
SetupWindow(text);
return text;
}
bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTextCtrl"));
}

View File

@ -28,14 +28,12 @@
wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL)
{
ADD_STYLE(wxTB_FLAT);
ADD_STYLE(wxTB_DOCKABLE);
ADD_STYLE(wxTB_VERTICAL);
ADD_STYLE(wxTB_HORIZONTAL);
XRC_ADD_STYLE(wxTB_FLAT);
XRC_ADD_STYLE(wxTB_DOCKABLE);
XRC_ADD_STYLE(wxTB_VERTICAL);
XRC_ADD_STYLE(wxTB_HORIZONTAL);
}
wxObject *wxToolBarXmlHandler::DoCreateResource()
{
if (m_class == wxT("tool"))
@ -67,10 +65,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
#endif
wxToolBar *toolbar = wxStaticCast(m_instance, wxToolBar);
if ( !toolbar )
toolbar = new wxToolBar;
XRC_MAKE_INSTANCE(toolbar, wxToolBar)
toolbar->Create(m_parentAsWindow,
GetID(),
@ -135,8 +130,6 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
}
}
bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxToolBar"))) ||

View File

@ -26,21 +26,17 @@
wxTreeCtrlXmlHandler::wxTreeCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxTR_HAS_BUTTONS);
ADD_STYLE(wxTR_EDIT_LABELS);
ADD_STYLE(wxTR_MULTIPLE);
XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
XRC_ADD_STYLE(wxTR_EDIT_LABELS);
XRC_ADD_STYLE(wxTR_MULTIPLE);
AddWindowStyles();
}
wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
{
wxTreeCtrl *tree = wxStaticCast(m_instance, wxTreeCtrl);
XRC_MAKE_INSTANCE(tree, wxTreeCtrl)
if (!tree)
tree = new wxTreeCtrl;
tree->Create( m_parentAsWindow,
tree->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
@ -52,11 +48,7 @@ wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
return tree;
}
bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTreeCtrl"));
}

View File

@ -33,14 +33,11 @@ wxObject *wxBitmapXmlHandler::DoCreateResource()
return new wxBitmap(GetBitmap(wxT("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
@ -51,10 +48,7 @@ wxObject *wxIconXmlHandler::DoCreateResource()
return new wxIcon(GetIcon(wxT("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxIcon"));
}

View File

@ -25,25 +25,27 @@
wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_AUTODRAW);
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
XRC_ADD_STYLE(wxBU_AUTODRAW);
XRC_ADD_STYLE(wxBU_LEFT);
XRC_ADD_STYLE(wxBU_RIGHT);
XRC_ADD_STYLE(wxBU_TOP);
XRC_ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
{
wxBitmapButton *button = new wxBitmapButton(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
XRC_MAKE_INSTANCE(button, wxBitmapButton)
button->Create(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0))
button->SetDefault();
SetupWindow(button);
if (!GetParamValue(wxT("selected")).IsEmpty())
@ -56,11 +58,7 @@ wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmapButton"));
}

View File

@ -26,20 +26,16 @@
wxButtonXmlHandler::wxButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
XRC_ADD_STYLE(wxBU_LEFT);
XRC_ADD_STYLE(wxBU_RIGHT);
XRC_ADD_STYLE(wxBU_TOP);
XRC_ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxButtonXmlHandler::DoCreateResource()
{
wxButton *button = wxStaticCast(m_instance, wxButton);
if (!button)
button = new wxButton;
XRC_MAKE_INSTANCE(button, wxButton)
button->Create(m_parentAsWindow,
GetID(),
@ -49,17 +45,14 @@ wxObject *wxButtonXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
if (GetBool(wxT("default"), 0))
button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxButton"));
}

View File

@ -27,21 +27,18 @@
wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxCAL_SUNDAY_FIRST);
ADD_STYLE(wxCAL_MONDAY_FIRST);
ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
XRC_ADD_STYLE(wxCAL_SUNDAY_FIRST);
XRC_ADD_STYLE(wxCAL_MONDAY_FIRST);
XRC_ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
XRC_ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
XRC_ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
AddWindowStyles();
}
wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
{
wxCalendarCtrl *calendar = wxStaticCast(m_instance, wxCalendarCtrl);
if (!calendar)
calendar = new wxCalendarCtrl;
XRC_MAKE_INSTANCE(calendar, wxCalendarCtrl);
calendar->Create(m_parentAsWindow,
GetID(),
@ -56,11 +53,7 @@ wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
return calendar;
}
bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCalendarCtrl"));
}

View File

@ -32,10 +32,7 @@ wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
wxObject *wxCheckBoxXmlHandler::DoCreateResource()
{
wxCheckBox *control = wxStaticCast(m_instance, wxCheckBox);
if (!control)
control = new wxCheckBox;
XRC_MAKE_INSTANCE(control, wxCheckBox)
control->Create(m_parentAsWindow,
GetID(),
@ -45,14 +42,12 @@ wxObject *wxCheckBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
control->SetValue( GetBool( wxT("checked")));
control->SetValue(GetBool( wxT("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCheckBox"));

View File

@ -37,18 +37,15 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
m_insideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
for(int i = 0; i < count; i++)
strings[i] = strList[i];
}
wxCheckListBox *control = wxStaticCast(m_instance, wxCheckListBox);
if (!control)
control = new wxCheckListBox;
XRC_MAKE_INSTANCE(control, wxCheckListBox)
control->Create(m_parentAsWindow,
GetID(),
@ -81,8 +78,8 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -93,20 +90,15 @@ wxObject *wxCheckListXmlHandler::DoCreateResource()
// handle <item checked="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxCheckList")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -25,7 +25,7 @@
wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SORT);
XRC_ADD_STYLE(wxCB_SORT);
AddWindowStyles();
}
@ -34,24 +34,21 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
if( m_class == wxT("wxChoice"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
wxChoice *control = wxStaticCast(m_instance, wxChoice);
if (!control)
control = new wxChoice;
XRC_MAKE_INSTANCE(control, wxChoice)
control->Create(m_parentAsWindow,
GetID(),
@ -62,13 +59,13 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -79,20 +76,14 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxChoice")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -27,10 +27,10 @@
wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SIMPLE);
ADD_STYLE(wxCB_SORT);
ADD_STYLE(wxCB_READONLY);
ADD_STYLE(wxCB_DROPDOWN);
XRC_ADD_STYLE(wxCB_SIMPLE);
XRC_ADD_STYLE(wxCB_SORT);
XRC_ADD_STYLE(wxCB_READONLY);
XRC_ADD_STYLE(wxCB_DROPDOWN);
AddWindowStyles();
}
@ -43,23 +43,19 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
XRC_MAKE_INSTANCE(control, wxComboBox)
wxComboBox *control = wxStaticCast(m_instance, wxComboBox);
if (!control)
control = new wxComboBox;
control->Create(m_parentAsWindow,
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
@ -69,13 +65,13 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -86,20 +82,16 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxComboBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}
#endif

View File

@ -27,25 +27,24 @@
wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxDIALOG_MODAL);
ADD_STYLE(wxDIALOG_MODELESS);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxCAPTION);
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
XRC_ADD_STYLE(wxTHICK_FRAME);
XRC_ADD_STYLE(wxSYSTEM_MENU);
XRC_ADD_STYLE(wxRESIZE_BORDER);
XRC_ADD_STYLE(wxRESIZE_BOX);
XRC_ADD_STYLE(wxDIALOG_MODAL);
XRC_ADD_STYLE(wxDIALOG_MODELESS);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxDialogXmlHandler::DoCreateResource()
{
wxDialog *dlg = wxDynamicCast(m_instance, wxDialog);
@ -58,10 +57,12 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
GetName());
if (HasParam(wxT("size")))
dlg->SetClientSize(GetSize());
if (HasParam(wxT("pos")))
dlg->Move(GetPosition());
SetupWindow(dlg);
CreateChildren(dlg);
@ -72,11 +73,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
return dlg;
}
bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxDialog"));
}

View File

@ -27,30 +27,29 @@
wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxDEFAULT_FRAME_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxCAPTION);
XRC_ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
XRC_ADD_STYLE(wxDEFAULT_FRAME_STYLE);
XRC_ADD_STYLE(wxTHICK_FRAME);
XRC_ADD_STYLE(wxSYSTEM_MENU);
XRC_ADD_STYLE(wxRESIZE_BORDER);
XRC_ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxFRAME_TOOL_WINDOW);
ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
ADD_STYLE(wxMAXIMIZE_BOX);
ADD_STYLE(wxMINIMIZE_BOX);
ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxFRAME_TOOL_WINDOW);
XRC_ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
XRC_ADD_STYLE(wxMAXIMIZE_BOX);
XRC_ADD_STYLE(wxMINIMIZE_BOX);
XRC_ADD_STYLE(wxSTAY_ON_TOP);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxFrameXmlHandler::DoCreateResource()
{
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
@ -58,15 +57,17 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
wxASSERT_MSG(frame, _("XRC resource: Cannot create dialog without instance."));
frame->Create(m_parentAsWindow,
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
GetName());
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_FRAME_STYLE),
GetName());
if (HasParam(wxT("size")))
frame->SetClientSize(GetSize());
if (HasParam(wxT("pos")))
frame->Move(GetPosition());
SetupWindow(frame);
CreateChildren(frame);
@ -77,11 +78,7 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
return frame;
}
bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxFrame"));
}

View File

@ -27,52 +27,46 @@
wxGaugeXmlHandler::wxGaugeXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxGA_HORIZONTAL );
ADD_STYLE( wxGA_VERTICAL );
ADD_STYLE( wxGA_PROGRESSBAR );
ADD_STYLE( wxGA_SMOOTH ); // windows only
XRC_ADD_STYLE(wxGA_HORIZONTAL);
XRC_ADD_STYLE(wxGA_VERTICAL);
XRC_ADD_STYLE(wxGA_PROGRESSBAR);
XRC_ADD_STYLE(wxGA_SMOOTH); // windows only
AddWindowStyles();
}
wxObject *wxGaugeXmlHandler::DoCreateResource()
{
wxGauge *control = wxStaticCast(m_instance, wxGauge);
if (!control)
control = new wxGauge;
XRC_MAKE_INSTANCE(control, wxGauge)
control->Create(m_parentAsWindow,
GetID(),
GetLong( wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetLong(wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if( HasParam( wxT("value") ))
if( HasParam(wxT("value")))
{
control->SetValue( GetLong( wxT("value") ));
control->SetValue(GetLong(wxT("value")));
}
if( HasParam( wxT("shadow") ))
if( HasParam(wxT("shadow")))
{
control->SetShadowWidth( GetDimension( wxT("shadow") ));
control->SetShadowWidth(GetDimension(wxT("shadow")));
}
if( HasParam( wxT("bezel") ))
if( HasParam(wxT("bezel")))
{
control->SetBezelFace( GetDimension( wxT("bezel") ));
control->SetBezelFace(GetDimension(wxT("bezel")));
}
SetupWindow(control);
return control;
}
bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxGauge"));
}
#endif // wxUSE_GAUGE

View File

@ -30,14 +30,14 @@
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxHW_SCROLLBAR_NEVER);
ADD_STYLE(wxHW_SCROLLBAR_AUTO);
XRC_ADD_STYLE(wxHW_SCROLLBAR_NEVER);
XRC_ADD_STYLE(wxHW_SCROLLBAR_AUTO);
AddWindowStyles();
}
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
{
wxHtmlWindow *control = wxStaticCast(m_instance, wxHtmlWindow);
XRC_MAKE_INSTANCE(control, wxHtmlWindow)
control->Create(m_parentAsWindow,
GetID(),
@ -50,7 +50,7 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
control->SetBorders(GetDimension(wxT("borders")));
}
if( HasParam(wxT("url")))
if (HasParam(wxT("url")))
{
wxString url = GetParamValue(wxT("url"));
wxFileSystem& fsys = GetCurFileSystem();
@ -75,8 +75,6 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
return control;
}
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxHtmlWindow"));

View File

@ -25,13 +25,13 @@
wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxLB_SINGLE);
ADD_STYLE(wxLB_MULTIPLE);
ADD_STYLE(wxLB_EXTENDED);
ADD_STYLE(wxLB_HSCROLL);
ADD_STYLE(wxLB_ALWAYS_SB);
ADD_STYLE(wxLB_NEEDED_SB);
ADD_STYLE(wxLB_SORT);
XRC_ADD_STYLE(wxLB_SINGLE);
XRC_ADD_STYLE(wxLB_MULTIPLE);
XRC_ADD_STYLE(wxLB_EXTENDED);
XRC_ADD_STYLE(wxLB_HSCROLL);
XRC_ADD_STYLE(wxLB_ALWAYS_SB);
XRC_ADD_STYLE(wxLB_NEEDED_SB);
XRC_ADD_STYLE(wxLB_SORT);
AddWindowStyles();
}
@ -40,24 +40,21 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
if( m_class == wxT("wxListBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
if (strList.GetCount() > 0)
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
for (int i = 0; i < count; i++)
strings[i]=strList[i];
}
wxListBox *control = wxStaticCast(m_instance, wxListBox);
if (!control)
control = new wxListBox;
XRC_MAKE_INSTANCE(control, wxListBox)
control->Create(m_parentAsWindow,
GetID(),
@ -68,13 +65,13 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -85,20 +82,14 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxListBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}

View File

@ -27,46 +27,40 @@
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLC_LIST);
ADD_STYLE(wxLC_REPORT);
ADD_STYLE(wxLC_ICON);
ADD_STYLE(wxLC_SMALL_ICON);
ADD_STYLE(wxLC_ALIGN_TOP);
ADD_STYLE(wxLC_ALIGN_LEFT);
ADD_STYLE(wxLC_AUTOARRANGE);
ADD_STYLE(wxLC_USER_TEXT);
ADD_STYLE(wxLC_EDIT_LABELS);
ADD_STYLE(wxLC_NO_HEADER);
ADD_STYLE(wxLC_SINGLE_SEL);
ADD_STYLE(wxLC_SORT_ASCENDING);
ADD_STYLE(wxLC_SORT_DESCENDING);
XRC_ADD_STYLE(wxLC_LIST);
XRC_ADD_STYLE(wxLC_REPORT);
XRC_ADD_STYLE(wxLC_ICON);
XRC_ADD_STYLE(wxLC_SMALL_ICON);
XRC_ADD_STYLE(wxLC_ALIGN_TOP);
XRC_ADD_STYLE(wxLC_ALIGN_LEFT);
XRC_ADD_STYLE(wxLC_AUTOARRANGE);
XRC_ADD_STYLE(wxLC_USER_TEXT);
XRC_ADD_STYLE(wxLC_EDIT_LABELS);
XRC_ADD_STYLE(wxLC_NO_HEADER);
XRC_ADD_STYLE(wxLC_SINGLE_SEL);
XRC_ADD_STYLE(wxLC_SORT_ASCENDING);
XRC_ADD_STYLE(wxLC_SORT_DESCENDING);
AddWindowStyles();
}
wxObject *wxListCtrlXmlHandler::DoCreateResource()
{
wxListCtrl *list = wxStaticCast(m_instance, wxListCtrl);
XRC_MAKE_INSTANCE(list, wxListCtrl)
if (!list)
list = new wxListCtrl;
list->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
list->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
/* TODO: columns definition */
// FIXME: add columns definition
SetupWindow(list);
return list;
}
bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxListCtrl"));

View File

@ -27,11 +27,9 @@
wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_insideMenu(FALSE)
{
ADD_STYLE(wxMENU_TEAROFF);
XRC_ADD_STYLE(wxMENU_TEAROFF);
}
wxObject *wxMenuXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxMenu"))
@ -103,16 +101,11 @@ bool wxMenuXmlHandler::CanHandle(wxXmlNode *node)
);
}
wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxMB_DOCKABLE);
XRC_ADD_STYLE(wxMB_DOCKABLE);
}
wxObject *wxMenuBarXmlHandler::DoCreateResource()
{
wxMenuBar *menubar = new wxMenuBar(GetStyle());
@ -134,4 +127,3 @@ bool wxMenuBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenuBar"));
}

View File

@ -30,23 +30,21 @@
wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_notebook(NULL)
{
ADD_STYLE(wxNB_FIXEDWIDTH);
ADD_STYLE(wxNB_LEFT);
ADD_STYLE(wxNB_RIGHT);
ADD_STYLE(wxNB_BOTTOM);
XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
XRC_ADD_STYLE(wxNB_LEFT);
XRC_ADD_STYLE(wxNB_RIGHT);
XRC_ADD_STYLE(wxNB_BOTTOM);
AddWindowStyles();
}
wxObject *wxNotebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("notebookpage"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if ( !n )
n = GetParamNode(wxT("object_ref"));
if (n)
{
@ -70,17 +68,15 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
}
}
else {
wxNotebook *nb = wxStaticCast(m_instance, wxNotebook);
else
{
XRC_MAKE_INSTANCE(nb, wxNotebook)
if ( !nb )
nb = new wxNotebook;
nb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" )),
GetName());
nb->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style")),
GetName());
wxNotebook *old_par = m_notebook;
m_notebook = nb;
@ -97,8 +93,6 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
}
}
bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxNotebook"))) ||

View File

@ -25,21 +25,16 @@
wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
XRC_ADD_STYLE(wxNO_3D);
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
XRC_ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxPanelXmlHandler::DoCreateResource()
{
wxPanel *panel = wxDynamicCast(m_instance, wxPanel);
if (!panel)
panel = new wxPanel;
XRC_MAKE_INSTANCE(panel, wxPanel)
panel->Create(m_parentAsWindow,
GetID(),
@ -53,7 +48,6 @@ wxObject *wxPanelXmlHandler::DoCreateResource()
return panel;
}
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxPanel"));

View File

@ -27,7 +27,7 @@
wxRadioButtonXmlHandler::wxRadioButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxRB_GROUP );
XRC_ADD_STYLE(wxRB_GROUP);
AddWindowStyles();
}
@ -40,10 +40,7 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource()
* normal radio button.
*/
wxRadioButton *control = wxStaticCast(m_instance, wxRadioButton);
if (!control)
control = new wxRadioButton;
XRC_MAKE_INSTANCE(control, wxRadioButton)
control->Create(m_parentAsWindow,
GetID(),
@ -53,18 +50,15 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
control->SetValue( GetBool(wxT("value"), 0));
control->SetValue(GetBool(wxT("value"), 0));
SetupWindow(control);
return control;
}
bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxRadioButton"));
}
#endif

View File

@ -25,12 +25,12 @@
#if wxUSE_RADIOBOX
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
: wxXmlResourceHandler(), m_insideBox(FALSE)
{
ADD_STYLE(wxRA_SPECIFY_COLS);
ADD_STYLE(wxRA_HORIZONTAL);
ADD_STYLE(wxRA_SPECIFY_ROWS);
ADD_STYLE(wxRA_VERTICAL);
XRC_ADD_STYLE(wxRA_SPECIFY_COLS);
XRC_ADD_STYLE(wxRA_HORIZONTAL);
XRC_ADD_STYLE(wxRA_SPECIFY_ROWS);
XRC_ADD_STYLE(wxRA_VERTICAL);
AddWindowStyles();
}
@ -53,10 +53,7 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
strings[i]=strList[i];
}
wxRadioBox *control = wxStaticCast(m_instance, wxRadioBox);
if (!control)
control = new wxRadioBox;
XRC_MAKE_INSTANCE(control, wxRadioBox)
control->Create(m_parentAsWindow,
GetID(),
@ -69,13 +66,13 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( selection != -1 )
control->SetSelection( selection );
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
if( strings != NULL )
delete [] strings;
if (strings != NULL)
delete[] strings;
strList.Clear(); // dump the strings
return control;
@ -86,20 +83,17 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
// handle <item selected="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
strList.Add(GetNodeContent(m_node));
return NULL;
}
}
bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxRadioBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
(m_insideBox && node->GetName() == wxT("item")));
}
#endif

View File

@ -26,17 +26,14 @@
wxScrollBarXmlHandler::wxScrollBarXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSB_HORIZONTAL );
ADD_STYLE( wxSB_VERTICAL );
XRC_ADD_STYLE(wxSB_HORIZONTAL);
XRC_ADD_STYLE(wxSB_VERTICAL);
AddWindowStyles();
}
wxObject *wxScrollBarXmlHandler::DoCreateResource()
{
wxScrollBar *control = wxStaticCast(m_instance, wxScrollBar);
if (!control)
control = new wxScrollBar;
XRC_MAKE_INSTANCE(control, wxScrollBar)
control->Create(m_parentAsWindow,
GetID(),
@ -48,21 +45,14 @@ wxObject *wxScrollBarXmlHandler::DoCreateResource()
control->SetScrollbar(GetLong( wxT("value"), 0),
GetLong( wxT("thumbsize"),1),
GetLong( wxT("range"), 10),
GetLong( wxT("pagesize"),1)
);
GetLong( wxT("pagesize"),1));
SetupWindow(control);
return control;
}
bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxScrollBar"));
}

View File

@ -39,35 +39,35 @@ bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_parentSizer(NULL)
{
ADD_STYLE(wxHORIZONTAL);
ADD_STYLE(wxVERTICAL);
XRC_ADD_STYLE(wxHORIZONTAL);
XRC_ADD_STYLE(wxVERTICAL);
// and flags
ADD_STYLE(wxLEFT);
ADD_STYLE(wxRIGHT);
ADD_STYLE(wxTOP);
ADD_STYLE(wxBOTTOM);
ADD_STYLE(wxNORTH);
ADD_STYLE(wxSOUTH);
ADD_STYLE(wxEAST);
ADD_STYLE(wxWEST);
ADD_STYLE(wxALL);
XRC_ADD_STYLE(wxLEFT);
XRC_ADD_STYLE(wxRIGHT);
XRC_ADD_STYLE(wxTOP);
XRC_ADD_STYLE(wxBOTTOM);
XRC_ADD_STYLE(wxNORTH);
XRC_ADD_STYLE(wxSOUTH);
XRC_ADD_STYLE(wxEAST);
XRC_ADD_STYLE(wxWEST);
XRC_ADD_STYLE(wxALL);
ADD_STYLE(wxGROW);
ADD_STYLE(wxEXPAND);
ADD_STYLE(wxSHAPED);
ADD_STYLE(wxSTRETCH_NOT);
XRC_ADD_STYLE(wxGROW);
XRC_ADD_STYLE(wxEXPAND);
XRC_ADD_STYLE(wxSHAPED);
XRC_ADD_STYLE(wxSTRETCH_NOT);
ADD_STYLE(wxALIGN_CENTER);
ADD_STYLE(wxALIGN_CENTRE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_TOP);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_BOTTOM);
ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTER_VERTICAL);
ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
XRC_ADD_STYLE(wxALIGN_CENTER);
XRC_ADD_STYLE(wxALIGN_CENTRE);
XRC_ADD_STYLE(wxALIGN_LEFT);
XRC_ADD_STYLE(wxALIGN_TOP);
XRC_ADD_STYLE(wxALIGN_RIGHT);
XRC_ADD_STYLE(wxALIGN_BOTTOM);
XRC_ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
XRC_ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
XRC_ADD_STYLE(wxALIGN_CENTER_VERTICAL);
XRC_ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
}

View File

@ -27,25 +27,22 @@
wxSliderXmlHandler::wxSliderXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSL_HORIZONTAL );
ADD_STYLE( wxSL_VERTICAL );
ADD_STYLE( wxSL_AUTOTICKS );
ADD_STYLE( wxSL_LABELS );
ADD_STYLE( wxSL_LEFT );
ADD_STYLE( wxSL_TOP );
ADD_STYLE( wxSL_RIGHT );
ADD_STYLE( wxSL_BOTTOM );
ADD_STYLE( wxSL_BOTH );
ADD_STYLE( wxSL_SELRANGE );
XRC_ADD_STYLE(wxSL_HORIZONTAL);
XRC_ADD_STYLE(wxSL_VERTICAL);
XRC_ADD_STYLE(wxSL_AUTOTICKS);
XRC_ADD_STYLE(wxSL_LABELS);
XRC_ADD_STYLE(wxSL_LEFT);
XRC_ADD_STYLE(wxSL_TOP);
XRC_ADD_STYLE(wxSL_RIGHT);
XRC_ADD_STYLE(wxSL_BOTTOM);
XRC_ADD_STYLE(wxSL_BOTH);
XRC_ADD_STYLE(wxSL_SELRANGE);
AddWindowStyles();
}
wxObject *wxSliderXmlHandler::DoCreateResource()
{
wxSlider *control = wxStaticCast(m_instance, wxSlider);
if (!control)
control = new wxSlider;
XRC_MAKE_INSTANCE(control, wxSlider)
control->Create(m_parentAsWindow,
GetID(),
@ -57,29 +54,29 @@ wxObject *wxSliderXmlHandler::DoCreateResource()
wxDefaultValidator,
GetName());
if( HasParam( wxT("tickfreq") ))
if( HasParam(wxT("tickfreq")))
{
control->SetTickFreq( GetLong( wxT("tickfreq") ), 0 );
control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
}
if( HasParam( wxT("pagesize") ))
if( HasParam(wxT("pagesize")))
{
control->SetPageSize( GetLong( wxT("pagesize") ) );
control->SetPageSize(GetLong(wxT("pagesize")));
}
if( HasParam( wxT("linesize") ))
if( HasParam(wxT("linesize")))
{
control->SetLineSize( GetLong( wxT("linesize") ));
control->SetLineSize(GetLong(wxT("linesize")));
}
if( HasParam( wxT("thumb") ))
if( HasParam(wxT("thumb")))
{
control->SetThumbLength( GetLong( wxT("thumb") ));
control->SetThumbLength(GetLong(wxT("thumb")));
}
if( HasParam( wxT("tick") ))
if( HasParam(wxT("tick")))
{
control->SetTick( GetLong( wxT("tick") ));
control->SetTick(GetLong(wxT("tick")));
}
if( HasParam( wxT("selmin") ) && HasParam( wxT("selmax")) )
if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
{
control->SetSelection( GetLong( wxT("selmin") ), GetLong( wxT("selmax")) );
control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
}
SetupWindow(control);
@ -87,12 +84,9 @@ wxObject *wxSliderXmlHandler::DoCreateResource()
return control;
}
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSlider"));
}
#endif

View File

@ -27,19 +27,16 @@
wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
XRC_ADD_STYLE(wxSP_HORIZONTAL);
XRC_ADD_STYLE(wxSP_VERTICAL);
XRC_ADD_STYLE(wxSP_ARROW_KEYS);
XRC_ADD_STYLE(wxSP_WRAP);
AddWindowStyles();
}
wxObject *wxSpinButtonXmlHandler::DoCreateResource()
{
wxSpinButton *control = wxStaticCast(m_instance, wxSpinButton);
if (!control)
control = new wxSpinButton;
XRC_MAKE_INSTANCE(control, wxSpinButton)
control->Create(m_parentAsWindow,
GetID(),
@ -47,16 +44,14 @@ wxObject *wxSpinButtonXmlHandler::DoCreateResource()
GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
GetName());
control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) );
control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX) );
control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong(wxT("max"), wxSP_DEFAULT_MAX));
SetupWindow(control);
return control;
}
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinButton"));
@ -69,32 +64,31 @@ bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
XRC_ADD_STYLE(wxSP_HORIZONTAL);
XRC_ADD_STYLE(wxSP_VERTICAL);
XRC_ADD_STYLE(wxSP_ARROW_KEYS);
XRC_ADD_STYLE(wxSP_WRAP);
}
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
{
wxSpinCtrl *control = new wxSpinCtrl(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_ARROW_KEYS ),
GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX),
GetLong( wxT("value"), wxSP_DEFAULT_VALUE),
GetName()
);
XRC_MAKE_INSTANCE(control, wxSpinCtrl)
control->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_ARROW_KEYS),
GetLong(wxT("min"), wxSP_DEFAULT_MIN),
GetLong(wxT("max"), wxSP_DEFAULT_MAX),
GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
GetName());
SetupWindow(control);
return control;
}
bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinCtrl"));

View File

@ -30,10 +30,7 @@ wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
{
wxStaticBitmap *bmp = wxStaticCast(m_instance, wxStaticBitmap);
if (!bmp)
bmp = new wxStaticBitmap;
XRC_MAKE_INSTANCE(bmp, wxStaticBitmap)
bmp->Create(m_parentAsWindow,
GetID(),
@ -47,11 +44,7 @@ wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
return bmp;
}
bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBitmap"));
}

View File

@ -30,10 +30,7 @@ wxStaticBoxXmlHandler::wxStaticBoxXmlHandler()
wxObject *wxStaticBoxXmlHandler::DoCreateResource()
{
wxStaticBox *box = wxStaticCast(m_instance, wxStaticBox);
if (!box)
box = new wxStaticBox;
XRC_MAKE_INSTANCE(box, wxStaticBox)
box->Create(m_parentAsWindow,
GetID(),
@ -47,11 +44,7 @@ wxObject *wxStaticBoxXmlHandler::DoCreateResource()
return box;
}
bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBox"));
}

View File

@ -27,17 +27,14 @@
wxStaticLineXmlHandler::wxStaticLineXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLI_HORIZONTAL);
ADD_STYLE(wxLI_VERTICAL);
XRC_ADD_STYLE(wxLI_HORIZONTAL);
XRC_ADD_STYLE(wxLI_VERTICAL);
AddWindowStyles();
}
wxObject *wxStaticLineXmlHandler::DoCreateResource()
{
wxStaticLine *line = wxStaticCast(m_instance, wxStaticLine);
if (!line)
line = new wxStaticLine;
XRC_MAKE_INSTANCE(line, wxStaticLine)
line->Create(m_parentAsWindow,
GetID(),
@ -50,8 +47,6 @@ wxObject *wxStaticLineXmlHandler::DoCreateResource()
return line;
}
bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticLine"));

View File

@ -25,19 +25,16 @@
wxStaticTextXmlHandler::wxStaticTextXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxST_NO_AUTORESIZE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_CENTRE);
XRC_ADD_STYLE(wxST_NO_AUTORESIZE);
XRC_ADD_STYLE(wxALIGN_LEFT);
XRC_ADD_STYLE(wxALIGN_RIGHT);
XRC_ADD_STYLE(wxALIGN_CENTRE);
AddWindowStyles();
}
wxObject *wxStaticTextXmlHandler::DoCreateResource()
{
wxStaticText *text = wxStaticCast(m_instance, wxStaticText);
if (!text)
text = new wxStaticText;
XRC_MAKE_INSTANCE(text, wxStaticText)
text->Create(m_parentAsWindow,
GetID(),
@ -51,11 +48,7 @@ wxObject *wxStaticTextXmlHandler::DoCreateResource()
return text;
}
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticText"));
}

View File

@ -24,40 +24,33 @@
wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxTE_PROCESS_ENTER);
ADD_STYLE(wxTE_PROCESS_TAB);
ADD_STYLE(wxTE_MULTILINE);
ADD_STYLE(wxTE_PASSWORD);
ADD_STYLE(wxTE_READONLY);
ADD_STYLE(wxHSCROLL);
XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
XRC_ADD_STYLE(wxTE_PROCESS_TAB);
XRC_ADD_STYLE(wxTE_MULTILINE);
XRC_ADD_STYLE(wxTE_PASSWORD);
XRC_ADD_STYLE(wxTE_READONLY);
XRC_ADD_STYLE(wxHSCROLL);
AddWindowStyles();
}
wxObject *wxTextCtrlXmlHandler::DoCreateResource()
{
wxTextCtrl *text = wxStaticCast(m_instance, wxTextCtrl);
XRC_MAKE_INSTANCE(text, wxTextCtrl)
if ( !text )
text = new wxTextCtrl;
text->Create( m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName() );
text->Create(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
SetupWindow(text);
return text;
}
bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTextCtrl"));
}

View File

@ -28,14 +28,12 @@
wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL)
{
ADD_STYLE(wxTB_FLAT);
ADD_STYLE(wxTB_DOCKABLE);
ADD_STYLE(wxTB_VERTICAL);
ADD_STYLE(wxTB_HORIZONTAL);
XRC_ADD_STYLE(wxTB_FLAT);
XRC_ADD_STYLE(wxTB_DOCKABLE);
XRC_ADD_STYLE(wxTB_VERTICAL);
XRC_ADD_STYLE(wxTB_HORIZONTAL);
}
wxObject *wxToolBarXmlHandler::DoCreateResource()
{
if (m_class == wxT("tool"))
@ -67,10 +65,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
#endif
wxToolBar *toolbar = wxStaticCast(m_instance, wxToolBar);
if ( !toolbar )
toolbar = new wxToolBar;
XRC_MAKE_INSTANCE(toolbar, wxToolBar)
toolbar->Create(m_parentAsWindow,
GetID(),
@ -135,8 +130,6 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
}
}
bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxToolBar"))) ||

View File

@ -26,21 +26,17 @@
wxTreeCtrlXmlHandler::wxTreeCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxTR_HAS_BUTTONS);
ADD_STYLE(wxTR_EDIT_LABELS);
ADD_STYLE(wxTR_MULTIPLE);
XRC_ADD_STYLE(wxTR_HAS_BUTTONS);
XRC_ADD_STYLE(wxTR_EDIT_LABELS);
XRC_ADD_STYLE(wxTR_MULTIPLE);
AddWindowStyles();
}
wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
{
wxTreeCtrl *tree = wxStaticCast(m_instance, wxTreeCtrl);
XRC_MAKE_INSTANCE(tree, wxTreeCtrl)
if (!tree)
tree = new wxTreeCtrl;
tree->Create( m_parentAsWindow,
tree->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
@ -52,11 +48,7 @@ wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
return tree;
}
bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTreeCtrl"));
}