]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed typos in last check in
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Jul 2006 18:30:43 +0000 (18:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Jul 2006 18:30:43 +0000 (18:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/aui/framemanager.h
src/aui/auibook.cpp
src/aui/dockart.cpp
src/aui/framemanager.cpp

index 5b81ced399b173805d39a5ee24ec2d88d14fba80..c0f136a56e1b7541826a12953e8c37a4059d3c01 100644 (file)
@@ -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
index c7d18b61d2e2fc2ecda7ded3f6df524ceaa87928..91ce0d969e03f9fbaf29610b7d9e1240060ef096 100644 (file)
@@ -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));
index a7013068c796aeae688b5fb3e3d127edcde695ed..116fb7980477320c3cb7a65d501f846cdce4632c 100644 (file)
@@ -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,
index 810625c12886a6d3a64362aecabf435e9bddde3d..93242053ceeaa9e0b709a5dcf183066b7f06438a 100644 (file)
@@ -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.