added wxSplitterWindow to XRC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2003-01-26 23:19:04 +00:00
parent e4da1035e4
commit 2f5b93fb9f
24 changed files with 367 additions and 12 deletions

View File

@ -47,5 +47,6 @@
#include "wx/xrc/xh_gdctl.h"
#include "wx/xrc/xh_frame.h"
#include "wx/xrc/xh_scwin.h"
#include "wx/xrc/xh_split.h"
#endif // _WX_XMLRES_H_

View File

@ -0,0 +1,28 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_split.h
// Purpose: XRC resource for wxSplitterWindow
// Author: panga@freemail.hu, Vaclav Slavik
// Created: 2003/01/26
// RCS-ID: $Id$
// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_SPLIT_H_
#define _WX_XH_SPLIT_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "xh_split.h"
#endif
#include "wx/xrc/xmlres.h"
class WXXMLDLLEXPORT wxSplitterWindowXmlHandler : public wxXmlResourceHandler
{
public:
wxSplitterWindowXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_SPLIT_H_

View File

@ -380,6 +380,34 @@
</object>
</object>
</object>
<object class="notebookpage">
<label>wxSplitterWindow</label>
<object class="wxPanel" name="panel">
<object class="wxFlexGridSizer">
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0</growablecols>
<growablerows>0</growablerows>
<object class="sizeritem">
<flag>wxALIGN_CENTRE|wxALL</flag>
<border>5</border>
<object class="wxSplitterWindow">
<minsize>50</minsize>
<sashpos>100</sashpos>
<size>400,200</size>
<object class="wxPanel" name="controls_panel">
<bg>#0000FF</bg>
</object>
<object class="wxPanel" name="controls_panel">
<bg>#00FF00</bg>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="notebookpage">
<label>wxRadioButton</label>
<object class="wxPanel" name="radiobutton">

View File

@ -24,7 +24,8 @@ HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \
xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \
xh_sttxt.h xh_text.h xh_listb.h xml.h xmlres.h xh_toolb.h \
xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h xh_scwin.h
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h xh_scwin.h \
xh_split.h
OBJECTS=$(EXPAT_OBJECTS) \
xml.o xmlres.o xmlrsall.o \
@ -33,7 +34,7 @@ OBJECTS=$(EXPAT_OBJECTS) \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o xh_gdctl.o xh_scwin.o
xh_frame.o xh_gdctl.o xh_scwin.o xh_split.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS)

View File

@ -200,6 +200,10 @@ SOURCE=.\xh_spin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_split.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbmp.cpp
# End Source File
# Begin Source File

View File

@ -27,7 +27,8 @@ OBJECTS=$(EXPAT_OBJECTS) \
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj xh_scwin.obj
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj xh_scwin.obj \
xh_split.obj
!include $(WXDIR)\src\makelib.b32

View File

@ -28,7 +28,7 @@ OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o xh_gdctl.o xh_scwin.o
xh_frame.o xh_gdctl.o xh_scwin.o xh_split.o
include $(WXDIR)/src/makelib.g95

View File

@ -57,7 +57,8 @@ OBJECTS=$(EXPAT_OBJS) \
$(D)\xh_text.obj $(D)\xh_listb.obj $(D)\xh_toolb.obj \
$(D)\xh_bmpbt.obj $(D)\xh_cald.obj $(D)\xh_listc.obj $(D)\xh_scrol.obj \
$(D)\xh_stbox.obj $(D)\xh_tree.obj $(D)\xh_stlin.obj $(D)\xh_bmp.obj \
$(D)\xh_unkwn.obj $(D)\xh_gdctl.obj $(D)\xh_scwin.obj
$(D)\xh_unkwn.obj $(D)\xh_gdctl.obj $(D)\xh_scwin.obj \
$(D)\xh_split.obj
!include $(WXDIR)\src\makelib.vc

View File

@ -18,7 +18,7 @@ OBJECTS=xml.obj xmlres.obj xmlrsall.obj &
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj &
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj &
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj &
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_scwin.obj
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_scwin.obj xh_split.obj
all: $(WXXMLLIB)

View File

@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_split.cpp
// Purpose: XRC resource for wxSplitterWindow
// Author: panga@freemail.hu, Vaclav Slavik
// Created: 2003/01/26
// RCS-ID: $Id$
// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_split.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_split.h"
#include "wx/splitter.h"
#include "wx/log.h"
wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
{
XRC_ADD_STYLE(wxSP_3D);
XRC_ADD_STYLE(wxSP_3DSASH);
XRC_ADD_STYLE(wxSP_3DBORDER);
XRC_ADD_STYLE(wxSP_FULLSASH);
XRC_ADD_STYLE(wxSP_BORDER);
XRC_ADD_STYLE(wxSP_NOBORDER);
XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT);
XRC_ADD_STYLE(wxSP_LIVE_UPDATE);
AddWindowStyles();
}
wxObject *wxSplitterWindowXmlHandler::DoCreateResource()
{
XRC_MAKE_INSTANCE(splitter, wxSplitterWindow);
splitter->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_3D),
GetName());
SetupWindow(splitter);
long sashpos = GetLong(wxT("sashpos"), 0);
long minpanesize = GetLong(wxT("minsize"), -1);
if (minpanesize != -1)
splitter->SetMinimumPaneSize(minpanesize);
wxWindow *win1 = NULL, *win2 = NULL;
wxXmlNode *n = m_node->GetChildren();
while (n)
{
if ((n->GetType() == wxXML_ELEMENT_NODE) &&
(n->GetName() == wxT("object") ||
n->GetName() == wxT("object_ref")))
{
wxObject *created = CreateResFromNode(n, splitter, NULL);
wxWindow *win = wxDynamicCast(created, wxWindow);
if (win1 == NULL)
{
win1 = win;
}
else
{
win2 = win;
break;
}
}
n = n->GetNext();
}
if (win1 == NULL)
wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
bool horizontal = (GetParamValue(wxT("orientation")) != wxT("vertical"));
if (win1 && win2)
{
if (horizontal)
splitter->SplitHorizontally(win1, win2, sashpos);
else
splitter->SplitVertically(win1, win2, sashpos);
}
else
{
splitter->Initialize(win1);
}
return splitter;
}
bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSplitterWindow"));
}

View File

@ -95,4 +95,5 @@ void wxXmlResource::InitAllHandlers()
#endif
AddHandler(new wxFrameXmlHandler);
AddHandler(new wxScrolledWindowXmlHandler);
AddHandler(new wxSplitterWindowXmlHandler);
}

View File

@ -25,6 +25,7 @@ wxBase:
All GUI ports:
- added wxSplitterWindow handler to XRC
- added wxFlexGridSizer::SetFlexibleDirection() (Szczepan Holyszewski)
- implemented GetEditControl for wxGenericTreeCtrl (Peter Stieber)
- improved contrib/utils/convertrc parsing (David J. Cooke)

View File

@ -303,6 +303,24 @@ size Size -1,-1
style Style[wxScrolledWindow] wxHSCROLL | wxVSCROLL
wxSplitterWindow
----------------
position Position -1,-1
size Size -1,-1
style Style[wxSplitterWindow] wxSP_3D
sashpos Integer 0
(Initial sash position)
minsize Integer -1
(Minimal panel size)
orientation "horizontal"|"vertical" horizontal
wxSplitterWindow must have at least one and at most two children objects.
If there's only one child object, it is passed to wxSplitterWindow::Initialize
and the splitter is created unsplitted. If there are two children, the
splitter is created splitted, either horizontally or vertically depending
on the value of "orientation" attribute.
wxToolBar
---------
position Position -1,-1

View File

@ -47,5 +47,6 @@
#include "wx/xrc/xh_gdctl.h"
#include "wx/xrc/xh_frame.h"
#include "wx/xrc/xh_scwin.h"
#include "wx/xrc/xh_split.h"
#endif // _WX_XMLRES_H_

28
include/wx/xrc/xh_split.h Normal file
View File

@ -0,0 +1,28 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_split.h
// Purpose: XRC resource for wxSplitterWindow
// Author: panga@freemail.hu, Vaclav Slavik
// Created: 2003/01/26
// RCS-ID: $Id$
// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XH_SPLIT_H_
#define _WX_XH_SPLIT_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "xh_split.h"
#endif
#include "wx/xrc/xmlres.h"
class WXXMLDLLEXPORT wxSplitterWindowXmlHandler : public wxXmlResourceHandler
{
public:
wxSplitterWindowXmlHandler();
virtual wxObject *DoCreateResource();
virtual bool CanHandle(wxXmlNode *node);
};
#endif // _WX_XH_SPLIT_H_

View File

@ -380,6 +380,34 @@
</object>
</object>
</object>
<object class="notebookpage">
<label>wxSplitterWindow</label>
<object class="wxPanel" name="panel">
<object class="wxFlexGridSizer">
<cols>1</cols>
<rows>0</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0</growablecols>
<growablerows>0</growablerows>
<object class="sizeritem">
<flag>wxALIGN_CENTRE|wxALL</flag>
<border>5</border>
<object class="wxSplitterWindow">
<minsize>50</minsize>
<sashpos>100</sashpos>
<size>400,200</size>
<object class="wxPanel" name="controls_panel">
<bg>#0000FF</bg>
</object>
<object class="wxPanel" name="controls_panel">
<bg>#00FF00</bg>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="notebookpage">
<label>wxRadioButton</label>
<object class="wxPanel" name="radiobutton">

View File

@ -24,7 +24,8 @@ HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \
xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \
xh_sttxt.h xh_text.h xh_listb.h xml.h xmlres.h xh_toolb.h \
xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h xh_scwin.h
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h xh_gdctl.h xh_scwin.h \
xh_split.h
OBJECTS=$(EXPAT_OBJECTS) \
xml.o xmlres.o xmlrsall.o \
@ -33,7 +34,7 @@ OBJECTS=$(EXPAT_OBJECTS) \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o xh_gdctl.o xh_scwin.o
xh_frame.o xh_gdctl.o xh_scwin.o xh_split.o
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS)

View File

@ -200,6 +200,10 @@ SOURCE=.\xh_spin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_split.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbmp.cpp
# End Source File
# Begin Source File

View File

@ -27,7 +27,8 @@ OBJECTS=$(EXPAT_OBJECTS) \
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj xh_scwin.obj
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_gdctl.obj xh_scwin.obj \
xh_split.obj
!include $(WXDIR)\src\makelib.b32

View File

@ -28,7 +28,7 @@ OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o xh_gdctl.o xh_scwin.o
xh_frame.o xh_gdctl.o xh_scwin.o xh_split.o
include $(WXDIR)/src/makelib.g95

View File

@ -57,7 +57,8 @@ OBJECTS=$(EXPAT_OBJS) \
$(D)\xh_text.obj $(D)\xh_listb.obj $(D)\xh_toolb.obj \
$(D)\xh_bmpbt.obj $(D)\xh_cald.obj $(D)\xh_listc.obj $(D)\xh_scrol.obj \
$(D)\xh_stbox.obj $(D)\xh_tree.obj $(D)\xh_stlin.obj $(D)\xh_bmp.obj \
$(D)\xh_unkwn.obj $(D)\xh_gdctl.obj $(D)\xh_scwin.obj
$(D)\xh_unkwn.obj $(D)\xh_gdctl.obj $(D)\xh_scwin.obj \
$(D)\xh_split.obj
!include $(WXDIR)\src\makelib.vc

View File

@ -18,7 +18,7 @@ OBJECTS=xml.obj xmlres.obj xmlrsall.obj &
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj &
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj &
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj &
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_scwin.obj
xh_tree.obj xh_unkwn.obj xh_frame.obj xh_scwin.obj xh_split.obj
all: $(WXXMLLIB)

103
src/xrc/xh_split.cpp Normal file
View File

@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_split.cpp
// Purpose: XRC resource for wxSplitterWindow
// Author: panga@freemail.hu, Vaclav Slavik
// Created: 2003/01/26
// RCS-ID: $Id$
// Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_split.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_split.h"
#include "wx/splitter.h"
#include "wx/log.h"
wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
{
XRC_ADD_STYLE(wxSP_3D);
XRC_ADD_STYLE(wxSP_3DSASH);
XRC_ADD_STYLE(wxSP_3DBORDER);
XRC_ADD_STYLE(wxSP_FULLSASH);
XRC_ADD_STYLE(wxSP_BORDER);
XRC_ADD_STYLE(wxSP_NOBORDER);
XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT);
XRC_ADD_STYLE(wxSP_LIVE_UPDATE);
AddWindowStyles();
}
wxObject *wxSplitterWindowXmlHandler::DoCreateResource()
{
XRC_MAKE_INSTANCE(splitter, wxSplitterWindow);
splitter->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxSP_3D),
GetName());
SetupWindow(splitter);
long sashpos = GetLong(wxT("sashpos"), 0);
long minpanesize = GetLong(wxT("minsize"), -1);
if (minpanesize != -1)
splitter->SetMinimumPaneSize(minpanesize);
wxWindow *win1 = NULL, *win2 = NULL;
wxXmlNode *n = m_node->GetChildren();
while (n)
{
if ((n->GetType() == wxXML_ELEMENT_NODE) &&
(n->GetName() == wxT("object") ||
n->GetName() == wxT("object_ref")))
{
wxObject *created = CreateResFromNode(n, splitter, NULL);
wxWindow *win = wxDynamicCast(created, wxWindow);
if (win1 == NULL)
{
win1 = win;
}
else
{
win2 = win;
break;
}
}
n = n->GetNext();
}
if (win1 == NULL)
wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
bool horizontal = (GetParamValue(wxT("orientation")) != wxT("vertical"));
if (win1 && win2)
{
if (horizontal)
splitter->SplitHorizontally(win1, win2, sashpos);
else
splitter->SplitVertically(win1, win2, sashpos);
}
else
{
splitter->Initialize(win1);
}
return splitter;
}
bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSplitterWindow"));
}

View File

@ -95,4 +95,5 @@ void wxXmlResource::InitAllHandlers()
#endif
AddHandler(new wxFrameXmlHandler);
AddHandler(new wxScrolledWindowXmlHandler);
AddHandler(new wxSplitterWindowXmlHandler);
}