Made wxLayoutAlgorithm more general (copes with nested sash windows)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1527 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -7,6 +7,7 @@ config.guess
|
|||||||
config.sub
|
config.sub
|
||||||
wx-config.in
|
wx-config.in
|
||||||
mkinstalldirs
|
mkinstalldirs
|
||||||
|
wxGTK.spec
|
||||||
|
|
||||||
docs/gtk/*.html
|
docs/gtk/*.html
|
||||||
docs/gtk/*.txt
|
docs/gtk/*.txt
|
||||||
|
@@ -102,7 +102,7 @@ should keep the clipboard open for only a very short time.
|
|||||||
|
|
||||||
Returns TRUE on success. This should be tested (as in the sample shown above).
|
Returns TRUE on success. This should be tested (as in the sample shown above).
|
||||||
|
|
||||||
\membersection{wxClipboard::SetData}\label{wxclipboardadddata}
|
\membersection{wxClipboard::SetData}\label{wxclipboardsetdata}
|
||||||
|
|
||||||
\func{bool}{SetData}{\param{wxDataObject*}{ data}}
|
\func{bool}{SetData}{\param{wxDataObject*}{ data}}
|
||||||
|
|
||||||
|
@@ -114,6 +114,14 @@ Default constructor.
|
|||||||
|
|
||||||
Destructor.
|
Destructor.
|
||||||
|
|
||||||
|
\membersection{wxLayoutAlgorithm::LayoutFrame}\label{wxlayoutalgorithmlayoutframe}
|
||||||
|
|
||||||
|
\constfunc{bool}{LayoutFrame}{\param{wxFrame* }{frame}, \param{wxWindow*}{ mainWindow = NULL}}
|
||||||
|
|
||||||
|
Lays out the children of a normal frame. {\it mainWindow} is set to occupy the remaining space.
|
||||||
|
|
||||||
|
This function simply calls \helpref{wxLayoutAlgorithm::LayoutWindow}{wxlayoutalgorithmlayoutwindow}.
|
||||||
|
|
||||||
\membersection{wxLayoutAlgorithm::LayoutMDIFrame}\label{wxlayoutalgorithmlayoutmdiframe}
|
\membersection{wxLayoutAlgorithm::LayoutMDIFrame}\label{wxlayoutalgorithmlayoutmdiframe}
|
||||||
|
|
||||||
\constfunc{bool}{LayoutMDIFrame}{\param{wxMDIParentFrame* }{frame}, \param{wxRect*}{ rect = NULL}}
|
\constfunc{bool}{LayoutMDIFrame}{\param{wxMDIParentFrame* }{frame}, \param{wxRect*}{ rect = NULL}}
|
||||||
@@ -123,11 +131,11 @@ given rectangle will be used as a starting point instead of the frame's client a
|
|||||||
|
|
||||||
The MDI client window is set to occupy the remaining space.
|
The MDI client window is set to occupy the remaining space.
|
||||||
|
|
||||||
\membersection{wxLayoutAlgorithm::LayoutFrame}\label{wxlayoutalgorithmlayoutframe}
|
\membersection{wxLayoutAlgorithm::LayoutWindow}\label{wxlayoutalgorithmlayoutwindow}
|
||||||
|
|
||||||
\constfunc{bool}{LayoutFrame}{\param{wxFrame* }{frame}, \param{wxWindow*}{ mainWindow = NULL}}
|
\constfunc{bool}{LayoutWindow}{\param{wxWindow* }{parent}, \param{wxWindow*}{ mainWindow = NULL}}
|
||||||
|
|
||||||
Lays out the children of a normal frame.
|
Lays out the children of a normal frame or other window.
|
||||||
|
|
||||||
{\it mainWindow} is set to occupy the remaining space.
|
{\it mainWindow} is set to occupy the remaining space.
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ Classes: \helpref{wxDataObject}{wxdataobject},
|
|||||||
\helpref{wxFileDropTarget}{wxfiledroptarget}
|
\helpref{wxFileDropTarget}{wxfiledroptarget}
|
||||||
|
|
||||||
It has to be noted that the API for drag and drop in wxWindows is not
|
It has to be noted that the API for drag and drop in wxWindows is not
|
||||||
yet finnished which is mostly due to the fact that DnD support under
|
yet finished which is mostly due to the fact that DnD support under
|
||||||
GTK 1.0 is very rudimentary and entirely different from the XDnD
|
GTK 1.0 is very rudimentary and entirely different from the XDnD
|
||||||
protocoll used by GTK 1.2. This also entails that not all of the documentation
|
protocoll used by GTK 1.2. This also entails that not all of the documentation
|
||||||
concerning DnD might be correct and some of the code might get broken
|
concerning DnD might be correct and some of the code might get broken
|
||||||
|
@@ -173,8 +173,15 @@ public:
|
|||||||
// The MDI client window is sized to whatever's left over.
|
// The MDI client window is sized to whatever's left over.
|
||||||
bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL);
|
bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = (wxRect*) NULL);
|
||||||
|
|
||||||
// mainWindow is sized to whatever's left over.
|
// mainWindow is sized to whatever's left over. This function for backward
|
||||||
bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL);
|
// compatibility; use LayoutWindow.
|
||||||
|
bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = (wxWindow*) NULL)
|
||||||
|
{
|
||||||
|
return LayoutWindow(frame, mainWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
// mainWindow is sized to whatever's left over. This function for backward
|
||||||
|
bool LayoutWindow(wxWindow* frame, wxWindow* mainWindow = (wxWindow*) NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -199,18 +199,41 @@ bool wxLayoutAlgorithm::LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* r)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout algorithm for normal frame. mainWindow gets what's left over.
|
// Layout algorithm for any window. mainWindow gets what's left over.
|
||||||
bool wxLayoutAlgorithm::LayoutFrame(wxFrame* frame, wxWindow* mainWindow)
|
bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow)
|
||||||
{
|
{
|
||||||
int cw, ch;
|
// Test if the parent is a sash window, and if so,
|
||||||
frame->GetClientSize(& cw, & ch);
|
// reduce the available space to allow space for any active edges.
|
||||||
|
|
||||||
wxRect rect(0, 0, cw, ch);
|
int leftMargin = 0, rightMargin = 0, topMargin = 0, bottomMargin = 0;
|
||||||
|
if (parent->IsKindOf(CLASSINFO(wxSashWindow)))
|
||||||
|
{
|
||||||
|
wxSashWindow* sashWindow = (wxSashWindow*) parent;
|
||||||
|
|
||||||
|
leftMargin = sashWindow->GetExtraBorderSize();
|
||||||
|
rightMargin = sashWindow->GetExtraBorderSize();
|
||||||
|
topMargin = sashWindow->GetExtraBorderSize();
|
||||||
|
bottomMargin = sashWindow->GetExtraBorderSize();
|
||||||
|
|
||||||
|
if (sashWindow->GetSashVisible(wxSASH_LEFT))
|
||||||
|
leftMargin += sashWindow->GetDefaultBorderSize();
|
||||||
|
if (sashWindow->GetSashVisible(wxSASH_RIGHT))
|
||||||
|
rightMargin += sashWindow->GetDefaultBorderSize();
|
||||||
|
if (sashWindow->GetSashVisible(wxSASH_TOP))
|
||||||
|
topMargin += sashWindow->GetDefaultBorderSize();
|
||||||
|
if (sashWindow->GetSashVisible(wxSASH_BOTTOM))
|
||||||
|
bottomMargin += sashWindow->GetDefaultBorderSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
int cw, ch;
|
||||||
|
parent->GetClientSize(& cw, & ch);
|
||||||
|
|
||||||
|
wxRect rect(leftMargin, topMargin, cw - leftMargin - rightMargin, ch - topMargin - bottomMargin);
|
||||||
|
|
||||||
wxCalculateLayoutEvent event;
|
wxCalculateLayoutEvent event;
|
||||||
event.SetRect(rect);
|
event.SetRect(rect);
|
||||||
|
|
||||||
wxNode* node = frame->GetChildren().First();
|
wxNode* node = parent->GetChildren().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxWindow* win = (wxWindow*) node->Data();
|
wxWindow* win = (wxWindow*) node->Data();
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/dcscreen.h"
|
#include "wx/dcscreen.h"
|
||||||
#include "wx/sashwin.h"
|
#include "wx/sashwin.h"
|
||||||
|
#include "wx/laywin.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSashWindow, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxSashWindow, wxWindow)
|
||||||
@@ -533,7 +534,7 @@ void wxSashWindow::SizeWindows()
|
|||||||
int cw, ch;
|
int cw, ch;
|
||||||
GetClientSize(&cw, &ch);
|
GetClientSize(&cw, &ch);
|
||||||
|
|
||||||
if (GetChildren().Number() > 0)
|
if (GetChildren().Number() == 1)
|
||||||
{
|
{
|
||||||
wxWindow* child = (wxWindow*) (GetChildren().First()->Data());
|
wxWindow* child = (wxWindow*) (GetChildren().First()->Data());
|
||||||
|
|
||||||
@@ -574,6 +575,16 @@ void wxSashWindow::SizeWindows()
|
|||||||
|
|
||||||
child->SetSize(x, y, width, height);
|
child->SetSize(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
else if (GetChildren().Number() > 1)
|
||||||
|
{
|
||||||
|
// Perhaps multiple children are themselves sash windows.
|
||||||
|
// TODO: this doesn't really work because the subwindows sizes/positions
|
||||||
|
// must be set to leave a gap for the parent's sash (hit-test and decorations).
|
||||||
|
// Perhaps we can allow for this within LayoutWindow, testing whether the parent
|
||||||
|
// is a sash window, and if so, allowing some space for the edges.
|
||||||
|
wxLayoutAlgorithm layout;
|
||||||
|
layout.LayoutWindow(this);
|
||||||
|
}
|
||||||
|
|
||||||
wxClientDC dc(this);
|
wxClientDC dc(this);
|
||||||
DrawBorders(dc);
|
DrawBorders(dc);
|
||||||
|
Reference in New Issue
Block a user