m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
Bottom().Position(1).
- PinButton(true).CloseButton(true).MaximizeButton(true));
+ CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
Bottom().
- PinButton(true).CloseButton(true).MaximizeButton(true));
+ CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test4")).Caption(wxT("Pane Caption")).
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
Right().Row(1).
- PinButton(true).CloseButton(true).MaximizeButton(true));
+ CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
Left().Layer(1).
- PinButton(true).CloseButton(true).MaximizeButton(true));
+ CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateTreeCtrl(), wxAuiPaneInfo().
Name(wxT("test8")).Caption(wxT("Tree Pane")).
m_mgr.AddPane(CreateSizeReportCtrl(), wxAuiPaneInfo().
Name(wxT("Test")).Caption(wxT("Client Size Reporter")).
Float().FloatingPosition(GetStartPosition()).
- PinButton(true).CloseButton(true).MaximizeButton(true));
+ CloseButton(true).MaximizeButton(true));
m_mgr.Update();
}
}
+static wxString ChopText(wxDC& dc, const wxString& text, int max_size)
+{
+ wxCoord x,y;
+
+ // first check if the text fits with no problems
+ dc.GetTextExtent(text, &x, &y);
+ if (x <= max_size)
+ return text;
+
+ size_t i, len = text.Length();
+ size_t last_good_length = 0;
+ for (i = 0; i < len; ++i)
+ {
+ wxString s = text.Left(i);
+ s += wxT("...");
+
+ dc.GetTextExtent(s, &x, &y);
+ if (x > max_size)
+ break;
+
+ last_good_length = i;
+ }
+
+ wxString ret = text.Left(last_good_length);
+ ret += wxT("...");
+ return ret;
+}
+
wxAuiDefaultDockArt::wxAuiDefaultDockArt()
{
#ifdef __WXMAC__
wxCoord w,h;
dc.GetTextExtent(wxT("ABCDEFHXfgkj"), &w, &h);
- dc.SetClippingRegion(rect);
- dc.DrawText(text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);
+ wxRect clip_rect = rect;
+ clip_rect.width -= 3; // text offset
+ clip_rect.width -= 2; // button padding
+ if (pane.HasCloseButton())
+ clip_rect.width -= m_button_size;
+ if (pane.HasPinButton())
+ clip_rect.width -= m_button_size;
+ if (pane.HasMaximizeButton())
+ clip_rect.width -= m_button_size;
+
+ wxString draw_text = ChopText(dc, text, clip_rect.width);
+
+ dc.SetClippingRegion(clip_rect);
+ dc.DrawText(draw_text, rect.x+3, rect.y+(rect.height/2)-(h/2)-1);
dc.DestroyClippingRegion();
}
button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE;
pinfo.buttons.Add(button);
}
-
+
+ if (pinfo.HasPinButton())
+ {
+ wxAuiPaneButton button;
+ button.button_id = wxAUI_BUTTON_PIN;
+ pinfo.buttons.Add(button);
+ }
+
if (pinfo.HasCloseButton())
{
wxAuiPaneButton button;