wxFont m_caption_font;
wxBitmap m_inactive_close_bitmap;
wxBitmap m_inactive_pin_bitmap;
+ wxBitmap m_inactive_maximize_bitmap;
+ wxBitmap m_inactive_restore_bitmap;
wxBitmap m_active_close_bitmap;
wxBitmap m_active_pin_bitmap;
+ wxBitmap m_active_maximize_bitmap;
+ wxBitmap m_active_restore_bitmap;
wxPen m_gripper_pen1;
wxPen m_gripper_pen2;
wxPen m_gripper_pen3;
enum wxAuiButtonId
{
wxAUI_BUTTON_CLOSE = 101,
- wxAUI_BUTTON_MAXIMIZE = 102,
+ wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
wxAUI_BUTTON_MINIMIZE = 103,
wxAUI_BUTTON_PIN = 104,
wxAUI_BUTTON_OPTIONS = 105,
bool IsFloatable() const { return HasFlag(optionFloatable); }
bool IsMovable() const { return HasFlag(optionMovable); }
bool IsDestroyOnClose() const { return HasFlag(optionDestroyOnClose); }
+ bool IsMaximized() const { return HasFlag(optionMaximized); }
bool HasCaption() const { return HasFlag(optionCaption); }
bool HasGripper() const { return HasFlag(optionGripper); }
bool HasBorder() const { return HasFlag(optionPaneBorder); }
wxPaneInfo& Hide() { return SetFlag(optionHidden, true); }
wxPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
wxPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
+ wxPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
+ wxPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
wxPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
wxPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
wxPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
wxPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
wxPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
wxPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
+
+ wxPaneInfo& SaveHidden() { return SetFlag(optionSavedHidden, HasFlag(optionHidden)); }
+ wxPaneInfo& RestoreHidden() { return SetFlag(optionHidden, HasFlag(optionSavedHidden)); }
+
wxPaneInfo& Dockable(bool b = true)
{
return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
optionToolbar = 1 << 13,
optionActive = 1 << 14,
optionGripperTop = 1 << 15,
+ optionMaximized = 1 << 16,
+ optionSavedHidden = 1 << 17,
buttonClose = 1 << 24,
buttonMaximize = 1 << 25,
bool DetachPane(wxWindow* window);
void ClosePane(wxPaneInfo& pane_info);
+ void MaximizePane(wxPaneInfo& pane_info);
+ void RestorePane(wxPaneInfo& pane_info);
+ void RestoreMaximizedPane();
wxString SavePaneInfo(wxPaneInfo& pane);
void LoadPaneInfo(wxString pane_part, wxPaneInfo &pane);
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;
wxDockUIPart* m_hover_button;// button uipart being hovered over
wxRect m_last_hint; // last hint rectangle
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEBUTTON, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANECLOSE, 0)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANEMAXIMIZE, 0)
+ DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_PANERESTORE, 0)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, 0)
END_DECLARE_EVENT_TYPES()
wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func))
#define EVT_AUI_PANECLOSE(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANECLOSE, wxFrameManagerEventHandler(func))
+#define EVT_AUI_PANEMAXIMIZE(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANEMAXIMIZE, wxFrameManagerEventHandler(func))
+#define EVT_AUI_PANERESTORE(func) \
+ wx__DECLARE_EVT0(wxEVT_AUI_PANERESTORE, wxFrameManagerEventHandler(func))
#define EVT_AUI_RENDER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxFrameManagerEventHandler(func))
%constant wxEventType wxEVT_AUI_PANEBUTTON;
%constant wxEventType wxEVT_AUI_PANECLOSE;
+%constant wxEventType wxEVT_AUI_PANEMAXIMIZE;
+%constant wxEventType wxEVT_AUI_PANERESTORE;
%constant wxEventType wxEVT_AUI_RENDER;
%pythoncode {
EVT_AUI_PANEBUTTON = wx.PyEventBinder( wxEVT_AUI_PANEBUTTON )
EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANECLOSE )
+ EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANEMAXIMIZE )
+ EVT_AUI_PANECLOSE = wx.PyEventBinder( wxEVT_AUI_PANERESTORE )
EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
}
#endif // SWIG
tb5->AddTool(103, wxT("Test"), wxArtProvider::GetBitmap(wxART_MISSING_IMAGE));
tb5->Realize();
-
// add a bunch of panes
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test1")).Caption(wxT("Pane Caption")).
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test2")).Caption(wxT("Client Size Reporter")).
- Bottom().Position(1));
+ Bottom().Position(1).
+ PinButton(true).CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test3")).Caption(wxT("Client Size Reporter")).
- Bottom());
+ Bottom().
+ PinButton(true).CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test4")).Caption(wxT("Pane Caption")).
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test6")).Caption(wxT("Client Size Reporter")).
- Right().Row(1));
+ Right().Row(1).
+ PinButton(true).CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test7")).Caption(wxT("Client Size Reporter")).
- Left().Layer(1));
+ Left().Layer(1).
+ PinButton(true).CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateTreeCtrl(), wxPaneInfo().
Name(wxT("test8")).Caption(wxT("Tree Pane")).
- Left().Layer(1).Position(1));
+ Left().Layer(1).Position(1).
+ CloseButton(true).MaximizeButton(true));
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("test9")).Caption(wxT("Min Size 200x100")).
BestSize(wxSize(200,100)).MinSize(wxSize(200,100)).
- Bottom().Layer(1));
+ Bottom().Layer(1).
+ CloseButton(true).MaximizeButton(true));
wxWindow* wnd10 = CreateTextCtrl(wxT("This pane will prompt the user before hiding."));
m_mgr.AddPane(wnd10, wxPaneInfo().
CenterPane().PaneBorder(false));
// add the toolbars to the manager
-
m_mgr.AddPane(tb1, wxPaneInfo().
Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
ToolbarPane().Top().
ToolbarPane().Top().Row(2).Position(1).
LeftDockable(false).RightDockable(false));
-
// make some default perspectives
wxString perspective_all = m_mgr.SavePerspective();
{
m_mgr.AddPane(CreateSizeReportCtrl(), wxPaneInfo().
Name(wxT("Test")).Caption(wxT("Client Size Reporter")).
- Float().FloatingPosition(GetStartPosition()));
+ Float().FloatingPosition(GetStartPosition()).
+ PinButton(true).CloseButton(true).MaximizeButton(true));
m_mgr.Update();
}
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
#endif
+ static unsigned char maximize_bits[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf0, 0xf7, 0xf7, 0x07, 0xf0,
+ 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0xf7, 0x07, 0xf0,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+ static unsigned char restore_bits[]={
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0xf0, 0x1f, 0xf0, 0xdf, 0xf7,
+ 0x07, 0xf4, 0x07, 0xf4, 0xf7, 0xf5, 0xf7, 0xf1, 0xf7, 0xfd, 0xf7, 0xfd,
+ 0x07, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
static unsigned char pin_bits[]={
0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0xfc,0xdf,0xfc,0xdf,0xfc,
0xdf,0xfc,0xdf,0xfc,0xdf,0xfc,0x0f,0xf8,0x7f,0xff,0x7f,0xff,
#ifdef __WXMAC__
m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE);
+ m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE );
#else
m_inactive_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_inactive_caption_text_colour);
+ m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour);
#endif
- m_inactive_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour);
+
#ifdef __WXMAC__
- m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, *wxWHITE );
+ m_inactive_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, *wxWHITE);
+ m_active_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, *wxWHITE );
#else
- m_active_close_bitmap = BitmapFromBits(close_bits, 16, 16, m_active_caption_text_colour);
+ m_inactive_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, m_inactive_caption_text_colour);
+ m_active_maximize_bitmap = BitmapFromBits(maximize_bits, 16, 16, m_active_caption_text_colour);
#endif
+
+#ifdef __WXMAC__
+ m_inactive_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, *wxWHITE);
+ m_active_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, *wxWHITE );
+#else
+ m_inactive_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, m_inactive_caption_text_colour);
+ m_active_restore_bitmap = BitmapFromBits(restore_bits, 16, 16, m_active_caption_text_colour);
+#endif
+
+ m_inactive_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_inactive_caption_text_colour);
m_active_pin_bitmap = BitmapFromBits(pin_bits, 16, 16, m_active_caption_text_colour);
// default metric values
switch (button)
{
default:
+ case wxAUI_BUTTON_MAXIMIZE_RESTORE:
+ if (pane.IsMaximized()) {
+ if (pane.state & wxPaneInfo::optionActive)
+ bmp = m_active_restore_bitmap;
+ else
+ bmp = m_inactive_restore_bitmap;
+ } else {
+ if (pane.state & wxPaneInfo::optionActive)
+ bmp = m_active_maximize_bitmap;
+ else
+ bmp = m_inactive_maximize_bitmap;
+ }
+ break;
case wxAUI_BUTTON_CLOSE:
if (pane.state & wxPaneInfo::optionActive)
bmp = m_active_close_bitmap;
pane.floating_pos, pane.floating_size,
style |
(pane.HasCloseButton()?wxCLOSE_BOX:0) |
+ (pane.HasMaximizeButton()?wxMAXIMIZE:0) |
(pane.IsFixed()?0:wxRESIZE_BORDER)
)
{
wxDockInfo wxNullDockInfo;
DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON)
DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSE)
+DEFINE_EVENT_TYPE(wxEVT_AUI_PANEMAXIMIZE)
+DEFINE_EVENT_TYPE(wxEVT_AUI_PANERESTORE)
DEFINE_EVENT_TYPE(wxEVT_AUI_RENDER)
#ifdef __WXMAC__
m_hint_wnd = NULL;
m_flags = flags;
m_skipping = false;
+ m_has_maximized = false;
m_frame = NULL;
if (managed_wnd)
if (pinfo.dock_proportion == 0)
pinfo.dock_proportion = 100000;
- if (pinfo.HasCloseButton() &&
- pinfo.buttons.size() == 0)
+ if (pinfo.HasMaximizeButton())
+ {
+ wxPaneButton button;
+ button.button_id = wxAUI_BUTTON_MAXIMIZE_RESTORE;
+ pinfo.buttons.Add(button);
+ }
+
+ if (pinfo.HasCloseButton())
{
wxPaneButton button;
button.button_id = wxAUI_BUTTON_CLOSE;
// flags
void wxFrameManager::ClosePane(wxPaneInfo& pane_info)
{
+ // if we were maximized, restore
+ if(pane_info.IsMaximized()) {
+ RestorePane(pane_info);
+ }
+
// first, hide the window
if (pane_info.window && pane_info.window->IsShown()) {
pane_info.window->Show(false);
}
}
+void wxFrameManager::MaximizePane(wxPaneInfo& pane_info)
+{
+ int i, pane_count;
+
+ // un-maximize and hide all other panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxPaneInfo& p = m_panes.Item(i);
+ if(!p.IsToolbar()) {
+ p.Restore();
+ p.SaveHidden();
+ p.Hide();
+ }
+ }
+
+ // mark ourselves maximized
+ pane_info.Maximize();
+ pane_info.Show();
+ m_has_maximized = true;
+
+ // last, show the window
+ if (pane_info.window && !pane_info.window->IsShown()) {
+ pane_info.window->Show(true);
+ }
+}
+
+void wxFrameManager::RestorePane(wxPaneInfo& pane_info)
+{
+ int i, pane_count;
+
+ // restore all the panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxPaneInfo& p = m_panes.Item(i);
+ if(!p.IsToolbar()) {
+ p.RestoreHidden();
+ }
+ }
+
+ // mark ourselves non-maximized
+ pane_info.Restore();
+ m_has_maximized = false;
+
+ // last, show the window
+ if (pane_info.window && !pane_info.window->IsShown()) {
+ pane_info.window->Show(true);
+ }
+}
+
+void wxFrameManager::RestoreMaximizedPane()
+{
+ int i, pane_count;
+
+ // restore all the panes
+ for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i)
+ {
+ wxPaneInfo& p = m_panes.Item(i);
+ if(p.IsMaximized()) {
+ RestorePane(p);
+ break;
+ }
+ }
+}
+
// EscapeDelimiters() changes ";" into "\;" and "|" into "\|"
// in the input string. This is an internal functions which is
// used for saving perspectives
int orientation = dock.IsHorizontal() ? wxHORIZONTAL : wxVERTICAL;
// resizable bottom and right docks have a sash before them
- if (!dock.fixed && (dock.dock_direction == wxAUI_DOCK_BOTTOM ||
+ if (!m_has_maximized && !dock.fixed && (dock.dock_direction == wxAUI_DOCK_BOTTOM ||
dock.dock_direction == wxAUI_DOCK_RIGHT))
{
sizer_item = cont->Add(sash_size, sash_size, 0, wxEXPAND);
wxSizer* dock_sizer = new wxBoxSizer(orientation);
// add each pane to the dock
+ bool has_maximized_pane = false;
int pane_i, pane_count = dock.panes.GetCount();
if (dock.fixed)
{
wxPaneInfo& pane = *(dock.panes.Item(pane_i));
int pane_pos = pane_positions.Item(pane_i);
+ if(pane.IsMaximized()) {
+ has_maximized_pane = true;
+ }
int amount = pane_pos - offset;
if (amount > 0)
for (pane_i = 0; pane_i < pane_count; ++pane_i)
{
wxPaneInfo& pane = *(dock.panes.Item(pane_i));
+ if(pane.IsMaximized()) {
+ has_maximized_pane = true;
+ }
// if this is not the first pane being added,
// we need to add a pane sizer
- if (pane_i > 0)
+ if (!m_has_maximized && pane_i > 0)
{
sizer_item = dock_sizer->Add(sash_size, sash_size, 0, wxEXPAND);
}
}
- if (dock.dock_direction == wxAUI_DOCK_CENTER)
+ if (dock.dock_direction == wxAUI_DOCK_CENTER || has_maximized_pane)
sizer_item = cont->Add(dock_sizer, 1, wxEXPAND);
else
sizer_item = cont->Add(dock_sizer, 0, wxEXPAND);
cont->SetItemMinSize(dock_sizer, dock.size, 0);
// top and left docks have a sash after them
- if (!dock.fixed && (dock.dock_direction == wxAUI_DOCK_TOP ||
+ if (!m_has_maximized && !dock.fixed && (dock.dock_direction == wxAUI_DOCK_TOP ||
dock.dock_direction == wxAUI_DOCK_LEFT))
{
sizer_item = cont->Add(sash_size, sash_size, 0, wxEXPAND);
for (i = 0, dock_count = docks.GetCount(); i < dock_count; ++i)
docks.Item(i).panes.Empty();
+
// iterate through all known panes, filing each
// of them into the appropriate dock. If the
// pane does not exist in the dock, add it
for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
}
- else
+ else if (!m_has_maximized)
{
// there are no center docks, add a background area
wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
if (m_flags & wxAUI_MGR_TRANSPARENT_DRAG)
pane.frame->SetTransparent(255);
#endif
+ } else if(m_has_maximized) {
+ RestoreMaximizedPane();
}
Update();
else
state = wxAUI_BUTTON_STATE_HOVER;
}
- else
+ else
{
if (event.LeftDown())
state = wxAUI_BUTTON_STATE_HOVER;
if (pt.x != 0 || pt.y != 0)
cdc.SetDeviceOrigin(pt.x, pt.y);
- m_art->DrawPaneButton(cdc, m_frame,
- button_ui_part->button->button_id,
- state,
- button_ui_part->rect,
- *hit_test->pane);
+ if (hit_test->pane)
+ {
+ m_art->DrawPaneButton(cdc, m_frame,
+ button_ui_part->button->button_id,
+ state,
+ button_ui_part->rect,
+ *hit_test->pane);
+ }
}
void wxFrameManager::OnLeftDown(wxMouseEvent& event)
pt.y - m_action_offset.y);
// float the window
+ if(pane_info->IsMaximized()) {
+ RestorePane(*pane_info);
+ }
pane_info->Float();
Update();
{
// make the old button normal
if (m_hover_button)
+ {
UpdateButtonOnScreen(m_hover_button, event);
-
+ Repaint();
+ }
+
// mouse is over a button, so repaint the
// button in hover mode
UpdateButtonOnScreen(part, event);
m_hover_button = part;
+
}
}
else
ClosePane(pane);
Update();
}
+ }
+ else if (evt.button == wxAUI_BUTTON_MAXIMIZE_RESTORE && !pane.IsMaximized())
+ {
+ // fire pane close event
+ wxFrameManagerEvent e(wxEVT_AUI_PANEMAXIMIZE);
+ e.SetPane(evt.pane);
+ ProcessMgrEvent(e);
+
+ if (!e.GetVeto())
+ {
+ MaximizePane(pane);
+ Update();
+ }
+ }
+ else if (evt.button == wxAUI_BUTTON_MAXIMIZE_RESTORE && pane.IsMaximized())
+ {
+ // fire pane close event
+ wxFrameManagerEvent e(wxEVT_AUI_PANERESTORE);
+ e.SetPane(evt.pane);
+ ProcessMgrEvent(e);
+
+ if (!e.GetVeto())
+ {
+ RestorePane(pane);
+ Update();
+ }
}
else if (evt.button == wxAUI_BUTTON_PIN)
{