From a6b7a521a4e04967ccef083eb76fbad9318cc95f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Jul 2006 18:30:43 +0000 Subject: [PATCH] fixed typos in last check in git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/aui/framemanager.h | 25 ++++++++++-------- src/aui/auibook.cpp | 3 ++- src/aui/dockart.cpp | 6 ++--- src/aui/framemanager.cpp | 49 +++++++++++++++++++++++++---------- 4 files changed, 55 insertions(+), 28 deletions(-) diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 5b81ced399..c0f136a56e 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -466,20 +466,20 @@ public: bool DetachPane(wxWindow* window); - void ClosePane(wxAuiPaneInfo& pane_info); - void MaximizePane(wxAuiPaneInfo& pane_info); - void RestorePane(wxAuiPaneInfo& pane_info); - void RestoreMaximizedPane(); + void Update(); wxString SavePaneInfo(wxAuiPaneInfo& pane); void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo &pane); - wxString SavePerspective(); + bool LoadPerspective(const wxString& perspective, bool update = true); - bool LoadPerspective(const wxString& perspective, - bool update = true); - - void Update(); + void SetDockSizeConstraint(double width_pct, double height_pct); + void GetDockSizeConstraint(double* width_pct, double* height_pct) const; + + void ClosePane(wxAuiPaneInfo& pane_info); + void MaximizePane(wxAuiPaneInfo& pane_info); + void RestorePane(wxAuiPaneInfo& pane_info); + void RestoreMaximizedPane(); public: @@ -609,12 +609,15 @@ protected: wxAuiDockUIPart* m_action_part; // ptr to the part the action happened to wxWindow* m_action_window; // action frame or window (NULL if none) wxRect m_action_hintrect; // hint rectangle for the action - bool m_skipping; - bool m_has_maximized; wxRect m_last_rect; wxAuiDockUIPart* m_hover_button;// button uipart being hovered over wxRect m_last_hint; // last hint rectangle wxPoint m_last_mouse_move; // last mouse move position (see OnMotion) + bool m_skipping; + bool m_has_maximized; + + double m_dock_constraint_x; // 0.0 .. 1.0; max pct of window width a dock can consume + double m_dock_constraint_y; // 0.0 .. 1.0; max pct of window height a dock can consume wxFrame* m_hint_wnd; // transparent hint window, if supported by platform wxTimer m_hint_fadetimer; // transparent fade timer diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index c7d18b61d2..91ce0d969e 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -2398,7 +2398,8 @@ void wxAuiNotebook::InitNotebook(long style) m_dummy_wnd->Show(false); m_mgr.SetManagedWindow(this); - m_mgr.SetFlags(wxAUI_MGR_DEFAULT | (1 << 28) /*wxAUI_MGR_NO_DOCK_SIZE_LIMIT*/); + m_mgr.SetFlags(wxAUI_MGR_DEFAULT); + m_mgr.SetDockSizeConstraint(1.0, 1.0); // no dock size constraint m_mgr.AddPane(m_dummy_wnd, wxAuiPaneInfo().Name(wxT("dummy")).Bottom().CaptionVisible(false).Show(false)); diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp index a7013068c7..116fb79804 100644 --- a/src/aui/dockart.cpp +++ b/src/aui/dockart.cpp @@ -153,9 +153,9 @@ static void DrawGradientRectangle(wxDC& dc, int r,g,b; - r = start_color.Red() + (high == 0 ? 0 : (((i*rd*100)/high)/100)); - g = start_color.Green() + (high == 0 ? 0 : (((i*gd*100)/high)/100)); - b = start_color.Blue() + (high == 0 ? 0 : (((i*bd*100)/high)/100)); + r = start_color.Red() + (high <= 0 ? 0 : (((i*rd*100)/high)/100)); + g = start_color.Green() + (high <= 0 ? 0 : (((i*gd*100)/high)/100)); + b = start_color.Blue() + (high <= 0 ? 0 : (((i*bd*100)/high)/100)); wxPen p(wxColor((unsigned char)r, (unsigned char)g, diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 810625c128..93242053ce 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -69,11 +69,6 @@ DEFINE_EVENT_TYPE(wxEVT_AUI_FIND_MANAGER) IMPLEMENT_DYNAMIC_CLASS(wxAuiManagerEvent, wxEvent) IMPLEMENT_CLASS(wxAuiManager, wxEvtHandler) -// private manager flags (not yet on the public API) -enum wxAuiPrivateManagerOption -{ - wxAUI_MGR_NO_DOCK_SIZE_LIMIT = 1 << 28 -}; const int auiToolBarLayer = 10; @@ -504,6 +499,8 @@ wxAuiManager::wxAuiManager(wxWindow* managed_wnd, unsigned int flags) m_skipping = false; m_has_maximized = false; m_frame = NULL; + m_dock_constraint_x = 0.3; + m_dock_constraint_y = 0.3; if (managed_wnd) { @@ -1972,17 +1969,22 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, } } - if (!(m_flags & wxAUI_MGR_NO_DOCK_SIZE_LIMIT)) - { - // new dock's size may not be more than 1/3 of the frame size - if (dock.IsHorizontal()) - size = wxMin(size, cli_size.y/3); - else - size = wxMin(size, cli_size.x/3); - } + + // new dock's size may not be more than the dock constraint + // parameter specifies. See SetDockSizeConstraint() + + int max_dock_x_size = (int)(m_dock_constraint_x * ((double)cli_size.x)); + int max_dock_y_size = (int)(m_dock_constraint_y * ((double)cli_size.y)); + if (dock.IsHorizontal()) + size = wxMin(size, max_dock_y_size); + else + size = wxMin(size, max_dock_x_size); + + // absolute minimum size for a dock is 10 pixels if (size < 10) size = 10; + dock.size = size; } @@ -2215,6 +2217,27 @@ wxSizer* wxAuiManager::LayoutAll(wxAuiPaneInfoArray& panes, } +// SetDockSizeConstraint() allows the dock constraints to be set. For example, +// specifying values of 0.5, 0.5 will mean that upon dock creation, a dock may +// not be larger than half of the window's size + +void wxAuiManager::SetDockSizeConstraint(double width_pct, double height_pct) +{ + m_dock_constraint_x = wxMax(0.0, wxMin(1.0, width_pct)); + m_dock_constraint_y = wxMax(0.0, wxMin(1.0, height_pct)); +} + +void wxAuiManager::GetDockSizeConstraint(double* width_pct, double* height_pct) const +{ + if (width_pct) + *width_pct = m_dock_constraint_x; + + if (height_pct) + *height_pct = m_dock_constraint_y; +} + + + // Update() updates the layout. Whenever changes are made to // one or more panes, this function should be called. It is the // external entry point for running the layout engine. -- 2.45.2