#endif
#include "wx/window.h" // base class declaration
+#include "wx/containr.h" // wxControlContainer
class WXDLLEXPORT wxSplitterEvent;
// splitter constants
// ---------------------------------------------------------------------------
-enum
+enum wxSplitMode
{
wxSPLIT_HORIZONTAL = 1,
wxSPLIT_VERTICAL
wxSplitterWindow(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_3D|wxCLIP_CHILDREN,
+ long style = wxSP_3D,
const wxString& name = "splitter")
{
Init();
Create(parent, id, pos, size, style, name);
}
- ~wxSplitterWindow();
+ virtual ~wxSplitterWindow();
bool Create(wxWindow *parent, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
- long style = wxSP_3D|wxCLIP_CHILDREN,
+ long style = wxSP_3D,
const wxString& name = "splitter");
// Gets the only or left/top pane
wxWindow *GetWindow2() const { return m_windowTwo; }
// Sets the split mode
- void SetSplitMode(int mode) { m_splitMode = mode; }
+ void SetSplitMode(int mode)
+ {
+ wxASSERT_MSG( mode == wxSPLIT_VERTICAL || mode == wxSPLIT_HORIZONTAL,
+ _T("invalid split mode") );
+
+ m_splitMode = (wxSplitMode)mode;
+ }
// Gets the split mode
- int GetSplitMode() const { return m_splitMode; };
+ wxSplitMode GetSplitMode() const { return m_splitMode; };
// Initialize with one window
void Initialize(wxWindow *window);
// absolute value rather than the size of left/upper pane.
virtual bool SplitVertically(wxWindow *window1,
wxWindow *window2,
- int sashPosition = 0);
+ int sashPosition = 0)
+ { return DoSplit(wxSPLIT_VERTICAL, window1, window2, sashPosition); }
virtual bool SplitHorizontally(wxWindow *window1,
wxWindow *window2,
- int sashPosition = 0);
+ int sashPosition = 0)
+ { return DoSplit(wxSPLIT_HORIZONTAL, window1, window2, sashPosition); }
// Removes the specified (or second) window from the view
// Doesn't actually delete the window.
void SendUnsplitEvent(wxWindow *winRemoved);
protected:
+ // common part of all ctors
void Init();
+ // common part of SplitVertically() and SplitHorizontally()
+ bool DoSplit(wxSplitMode mode,
+ wxWindow *window1, wxWindow *window2,
+ int sashPosition);
- int m_splitMode;
+ // adjusts sash position with respect to min. pane and window sizes
+ int AdjustSashPosition(int sashPos) const;
+
+ // get either width or height depending on the split mode
+ int GetWindowSize() const;
+
+ wxSplitMode m_splitMode;
bool m_permitUnsplitAlways;
bool m_needUpdating; // when in live mode, set this to TRUE to resize children in idle
wxWindow* m_windowOne;
wxPen* m_facePen;
private:
+ WX_DECLARE_CONTROL_CONTAINER();
+
DECLARE_DYNAMIC_CLASS(wxSplitterWindow)
DECLARE_EVENT_TABLE()
};