Gave the sash and splitter windows Create and Init methods
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
The basic idea behind a box sizer is that windows will most often be laid out in rather
|
||||
simple basic geomerty, typically in a row or a column or several hierachies of either.
|
||||
|
||||
As an exmaple, we will construct a dialog that will contain a text field at the top and
|
||||
As an example, we will construct a dialog that will contain a text field at the top and
|
||||
two buttons at the bottom. This can be seen as a top-hierarchy column with the text at
|
||||
the top and buttons at the bottom and a low-hierchary row with an OK button to the left
|
||||
and a Cancel button to the right. In many cases (particulary dialogs under Unix and
|
||||
|
@@ -141,7 +141,18 @@ class WXDLLEXPORT wxSashLayoutWindow: public wxSashWindow
|
||||
{
|
||||
DECLARE_CLASS(wxSashLayoutWindow)
|
||||
public:
|
||||
wxSashLayoutWindow()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
wxSashLayoutWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow")
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "layoutWindow");
|
||||
|
||||
// Accessors
|
||||
@@ -161,7 +172,10 @@ public:
|
||||
|
||||
// Called by layout algorithm to retrieve information about the window.
|
||||
void OnQueryLayoutInfo(wxQueryLayoutInfoEvent& event);
|
||||
protected:
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
wxLayoutAlignment m_alignment;
|
||||
wxLayoutOrientation m_orientation;
|
||||
wxSize m_defaultSize;
|
||||
|
@@ -74,13 +74,24 @@ public:
|
||||
// Public API
|
||||
|
||||
// Default constructor
|
||||
wxSashWindow();
|
||||
wxSashWindow()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// Normal constructor
|
||||
wxSashWindow(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow");
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow")
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
~wxSashWindow();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = wxSW_3D|wxCLIP_CHILDREN, const wxString& name = "sashWindow");
|
||||
|
||||
// Set whether there's a sash in this position
|
||||
void SetSashVisible(wxSashEdgePosition edge, bool sash);
|
||||
|
||||
@@ -151,7 +162,9 @@ public:
|
||||
// Initialize colours
|
||||
void InitColours();
|
||||
|
||||
protected:
|
||||
private:
|
||||
void Init();
|
||||
|
||||
wxSashEdge m_sashes[4];
|
||||
int m_dragMode;
|
||||
wxSashEdgePosition m_draggingEdge;
|
||||
|
@@ -60,16 +60,30 @@ public:
|
||||
// Public API
|
||||
|
||||
// Default constructor
|
||||
wxSplitterWindow();
|
||||
wxSplitterWindow()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// Normal constructor
|
||||
wxSplitterWindow(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_3D|wxCLIP_CHILDREN,
|
||||
const wxString& name = "splitter");
|
||||
const wxString& name = "splitter")
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
~wxSplitterWindow();
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_3D|wxCLIP_CHILDREN,
|
||||
const wxString& name = "splitter");
|
||||
|
||||
// Gets the only or left/top pane
|
||||
wxWindow *GetWindow1() const { return m_windowOne; }
|
||||
|
||||
@@ -191,6 +205,10 @@ protected:
|
||||
|
||||
void SendUnsplitEvent(wxWindow *winRemoved);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
|
||||
int m_splitMode;
|
||||
bool m_permitUnsplitAlways;
|
||||
bool m_needUpdating; // when in live mode, set the to TRUE to resize children in idle
|
||||
|
@@ -90,7 +90,7 @@ DECLARE_EVENT_TABLE()
|
||||
class MyCanvas: public wxScrolledWindow
|
||||
{
|
||||
public:
|
||||
MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name);
|
||||
MyCanvas(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxString& name = "");
|
||||
virtual ~MyCanvas();
|
||||
|
||||
virtual void OnDraw(wxDC& dc);
|
||||
@@ -170,12 +170,12 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons
|
||||
wxSize sz( m_splitter->GetSize() );
|
||||
wxLogMessage( "Initial splitter size: %d %d\n", (int)sz.x, (int)sz.y );
|
||||
|
||||
m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, 0, 0, 400, 400, "Test1" );
|
||||
m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, wxPoint(0, 0), wxSize(400, 400), "Test1" );
|
||||
m_leftCanvas->SetBackgroundColour(*wxRED);
|
||||
m_leftCanvas->SetScrollbars(20, 20, 50, 50);
|
||||
m_leftCanvas->SetCursor(wxCursor(wxCURSOR_MAGNIFIER));
|
||||
|
||||
m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, 0, 0, 400, 400, "Test2" );
|
||||
m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, wxPoint(0, 0), wxSize(400, 400), "Test2" );
|
||||
m_rightCanvas->SetBackgroundColour(*wxCYAN);
|
||||
m_rightCanvas->SetScrollbars(20, 20, 50, 50);
|
||||
m_rightCanvas->Show(FALSE);
|
||||
@@ -256,8 +256,8 @@ void MyFrame::UpdatePosition()
|
||||
SetStatusText(str);
|
||||
}
|
||||
|
||||
MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name ) :
|
||||
wxScrolledWindow(parent, id, wxPoint(x, y), wxSize(w, h), 0, name )
|
||||
MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, const wxPoint& point, const wxSize& size, const wxString &name ) :
|
||||
wxScrolledWindow(parent, id, point, size, 0, name )
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -41,9 +41,13 @@ BEGIN_EVENT_TABLE(wxSashLayoutWindow, wxSashWindow)
|
||||
EVT_QUERY_LAYOUT_INFO(wxSashLayoutWindow::OnQueryLayoutInfo)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxSashLayoutWindow::wxSashLayoutWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name):
|
||||
wxSashWindow(parent, id, pos, size, style, name)
|
||||
bool wxSashLayoutWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name)
|
||||
{
|
||||
return wxSashWindow::Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
void wxSashLayoutWindow::Init()
|
||||
{
|
||||
m_orientation = wxLAYOUT_HORIZONTAL;
|
||||
m_alignment = wxLAYOUT_TOP;
|
||||
|
@@ -45,28 +45,19 @@ BEGIN_EVENT_TABLE(wxSashWindow, wxWindow)
|
||||
EVT_MOUSE_EVENTS(wxSashWindow::OnMouseEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxSashWindow::wxSashWindow()
|
||||
bool wxSashWindow::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name)
|
||||
{
|
||||
m_draggingEdge = wxSASH_NONE;
|
||||
m_dragMode = wxSASH_DRAG_NONE;
|
||||
m_oldX = 0;
|
||||
m_oldY = 0;
|
||||
m_firstX = 0;
|
||||
m_firstY = 0;
|
||||
m_borderSize = 3 ;
|
||||
m_extraBorderSize = 0;
|
||||
m_sashCursorWE = NULL;
|
||||
m_sashCursorNS = NULL;
|
||||
|
||||
m_minimumPaneSizeX = 0;
|
||||
m_minimumPaneSizeY = 0;
|
||||
m_maximumPaneSizeX = 10000;
|
||||
m_maximumPaneSizeY = 10000;
|
||||
return wxWindow::Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
const wxSize& size, long style, const wxString& name)
|
||||
:wxWindow(parent, id, pos, size, style, name)
|
||||
wxSashWindow::~wxSashWindow()
|
||||
{
|
||||
delete m_sashCursorWE;
|
||||
delete m_sashCursorNS;
|
||||
}
|
||||
|
||||
void wxSashWindow::Init()
|
||||
{
|
||||
m_draggingEdge = wxSASH_NONE;
|
||||
m_dragMode = wxSASH_DRAG_NONE;
|
||||
@@ -87,12 +78,6 @@ wxSashWindow::wxSashWindow(wxWindow *parent, wxWindowID id, const wxPoint& pos,
|
||||
InitColours();
|
||||
}
|
||||
|
||||
wxSashWindow::~wxSashWindow()
|
||||
{
|
||||
delete m_sashCursorWE;
|
||||
delete m_sashCursorNS;
|
||||
}
|
||||
|
||||
void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
|
@@ -53,42 +53,39 @@ BEGIN_EVENT_TABLE(wxSplitterWindow, wxWindow)
|
||||
EVT_SPLITTER_UNSPLIT(-1, wxSplitterWindow::OnUnsplitEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxSplitterWindow::wxSplitterWindow()
|
||||
{
|
||||
m_splitMode = wxSPLIT_VERTICAL;
|
||||
m_permitUnsplitAlways = FALSE;
|
||||
m_windowOne = (wxWindow *) NULL;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
m_dragMode = wxSPLIT_DRAG_NONE;
|
||||
m_oldX = 0;
|
||||
m_oldY = 0;
|
||||
m_firstX = 0;
|
||||
m_firstY = 0;
|
||||
m_sashSize = 7;
|
||||
m_borderSize = 2;
|
||||
m_sashPosition = 0;
|
||||
m_sashCursorWE = (wxCursor *) NULL;
|
||||
m_sashCursorNS = (wxCursor *) NULL;
|
||||
m_sashTrackerPen = (wxPen *) NULL;
|
||||
m_lightShadowPen = (wxPen *) NULL;
|
||||
m_mediumShadowPen = (wxPen *) NULL;
|
||||
m_darkShadowPen = (wxPen *) NULL;
|
||||
m_faceBrush = (wxBrush *) NULL;
|
||||
m_facePen = (wxPen *) NULL;
|
||||
m_hilightPen = (wxPen *) NULL;
|
||||
m_minimumPaneSize = 0;
|
||||
m_needUpdating = FALSE;
|
||||
}
|
||||
|
||||
wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id,
|
||||
bool wxSplitterWindow::Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
: wxWindow(parent, id, pos, size, style, name)
|
||||
{
|
||||
if (!wxWindow::Create(parent, id, pos, size, style, name))
|
||||
return FALSE;
|
||||
|
||||
m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0;
|
||||
|
||||
if ( style & wxSP_3D )
|
||||
{
|
||||
m_borderSize = 2;
|
||||
m_sashSize = 7;
|
||||
}
|
||||
else if ( style & wxSP_BORDER )
|
||||
{
|
||||
m_borderSize = 1;
|
||||
m_sashSize = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_borderSize = 0;
|
||||
m_sashSize = 3;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxSplitterWindow::Init()
|
||||
{
|
||||
m_splitMode = wxSPLIT_VERTICAL;
|
||||
m_permitUnsplitAlways = (style & wxSP_PERMIT_UNSPLIT) != 0;
|
||||
m_permitUnsplitAlways = TRUE;
|
||||
m_windowOne = (wxWindow *) NULL;
|
||||
m_windowTwo = (wxWindow *) NULL;
|
||||
m_dragMode = wxSPLIT_DRAG_NONE;
|
||||
@@ -110,28 +107,11 @@ wxSplitterWindow::wxSplitterWindow(wxWindow *parent, wxWindowID id,
|
||||
m_facePen = (wxPen *) NULL;
|
||||
m_hilightPen = (wxPen *) NULL;
|
||||
|
||||
if ( style & wxSP_3D )
|
||||
{
|
||||
m_borderSize = 2;
|
||||
m_sashSize = 7;
|
||||
}
|
||||
else if ( style & wxSP_BORDER )
|
||||
{
|
||||
m_borderSize = 1;
|
||||
m_sashSize = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_borderSize = 0;
|
||||
m_sashSize = 3;
|
||||
}
|
||||
|
||||
// Eventually, we'll respond to colour change messages
|
||||
InitColours();
|
||||
|
||||
// For debugging purposes, to see the background.
|
||||
// SetBackground(wxBLUE_BRUSH);
|
||||
|
||||
m_needUpdating = FALSE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user