initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit bf6b52fd94
9654 changed files with 4035664 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/aui.h
// Purpose: wxaui: wx advanced user interface - docking window manager
// Author: Benjamin I. Williams
// Created: 2005-05-17
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_H_
#define _WX_AUI_H_
#include "wx/aui/framemanager.h"
#include "wx/aui/dockart.h"
#include "wx/aui/floatpane.h"
#include "wx/aui/auibar.h"
#include "wx/aui/auibook.h"
#include "wx/aui/tabmdi.h"
#endif // _WX_AUI_H_

View File

@@ -0,0 +1,799 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/toolbar.h
// Purpose: wxaui: wx advanced user interface - docking window manager
// Author: Benjamin I. Williams
// Created: 2008-08-04
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUIBAR_H_
#define _WX_AUIBAR_H_
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/bmpbndl.h"
#include "wx/control.h"
#include "wx/custombgwin.h"
#include "wx/sizer.h"
#include "wx/pen.h"
class WXDLLIMPEXP_FWD_CORE wxClientDC;
class WXDLLIMPEXP_FWD_CORE wxReadOnlyDC;
class WXDLLIMPEXP_FWD_AUI wxAuiPaneInfo;
enum wxAuiToolBarStyle
{
wxAUI_TB_TEXT = 1 << 0,
wxAUI_TB_NO_TOOLTIPS = 1 << 1,
wxAUI_TB_NO_AUTORESIZE = 1 << 2,
wxAUI_TB_GRIPPER = 1 << 3,
wxAUI_TB_OVERFLOW = 1 << 4,
// using this style forces the toolbar to be vertical and
// be only dockable to the left or right sides of the window
// whereas by default it can be horizontal or vertical and
// be docked anywhere
wxAUI_TB_VERTICAL = 1 << 5,
wxAUI_TB_HORZ_LAYOUT = 1 << 6,
// analogous to wxAUI_TB_VERTICAL, but forces the toolbar
// to be horizontal
wxAUI_TB_HORIZONTAL = 1 << 7,
wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
wxAUI_TB_DEFAULT_STYLE = 0
};
enum wxAuiToolBarArtSetting
{
wxAUI_TBART_SEPARATOR_SIZE = 0,
wxAUI_TBART_GRIPPER_SIZE = 1,
wxAUI_TBART_OVERFLOW_SIZE = 2,
wxAUI_TBART_DROPDOWN_SIZE = 3
};
enum wxAuiToolBarToolTextOrientation
{
wxAUI_TBTOOL_TEXT_LEFT = 0, // unused/unimplemented
wxAUI_TBTOOL_TEXT_RIGHT = 1,
wxAUI_TBTOOL_TEXT_TOP = 2, // unused/unimplemented
wxAUI_TBTOOL_TEXT_BOTTOM = 3
};
// aui toolbar event class
class WXDLLIMPEXP_AUI wxAuiToolBarEvent : public wxNotifyEvent
{
public:
wxAuiToolBarEvent(wxEventType commandType = wxEVT_NULL,
int winId = 0)
: wxNotifyEvent(commandType, winId)
, m_clickPt(-1, -1)
, m_rect(-1, -1, 0, 0)
{
m_isDropdownClicked = false;
m_toolId = -1;
}
wxNODISCARD wxEvent *Clone() const override { return new wxAuiToolBarEvent(*this); }
bool IsDropDownClicked() const { return m_isDropdownClicked; }
void SetDropDownClicked(bool c) { m_isDropdownClicked = c; }
wxPoint GetClickPoint() const { return m_clickPt; }
void SetClickPoint(const wxPoint& p) { m_clickPt = p; }
wxRect GetItemRect() const { return m_rect; }
void SetItemRect(const wxRect& r) { m_rect = r; }
int GetToolId() const { return m_toolId; }
void SetToolId(int toolId) { m_toolId = toolId; }
private:
bool m_isDropdownClicked;
wxPoint m_clickPt;
wxRect m_rect;
int m_toolId;
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxAuiToolBarEvent);
};
class WXDLLIMPEXP_AUI wxAuiToolBarItem
{
friend class wxAuiToolBar;
public:
wxAuiToolBarItem()
{
m_window = nullptr;
m_sizerItem = nullptr;
m_spacerPixels = 0;
m_toolId = 0;
m_kind = wxITEM_NORMAL;
m_state = 0; // normal, enabled
m_proportion = 0;
m_active = true;
m_dropDown = true;
m_sticky = true;
m_userData = 0;
m_clientData = nullptr;
m_alignment = wxALIGN_CENTER;
}
void Assign(const wxAuiToolBarItem& c)
{
m_window = c.m_window;
m_label = c.m_label;
m_bitmap = c.m_bitmap;
m_disabledBitmap = c.m_disabledBitmap;
m_hoverBitmap = c.m_hoverBitmap;
m_shortHelp = c.m_shortHelp;
m_longHelp = c.m_longHelp;
m_sizerItem = c.m_sizerItem;
m_minSize = c.m_minSize;
m_spacerPixels = c.m_spacerPixels;
m_toolId = c.m_toolId;
m_kind = c.m_kind;
m_state = c.m_state;
m_proportion = c.m_proportion;
m_active = c.m_active;
m_dropDown = c.m_dropDown;
m_sticky = c.m_sticky;
m_userData = c.m_userData;
m_clientData = c.m_clientData;
m_alignment = c.m_alignment;
}
void SetWindow(wxWindow* w) { m_window = w; }
wxWindow* GetWindow() { return m_window; }
void SetId(int newId) { m_toolId = newId; }
int GetId() const { return m_toolId; }
void SetKind(int newKind) { m_kind = newKind; }
int GetKind() const { return m_kind; }
void SetState(int newState) { m_state = newState; }
int GetState() const { return m_state; }
void SetSizerItem(wxSizerItem* s) { m_sizerItem = s; }
wxSizerItem* GetSizerItem() const { return m_sizerItem; }
void SetLabel(const wxString& s) { m_label = s; }
const wxString& GetLabel() const { return m_label; }
void SetBitmap(const wxBitmapBundle& bmp) { m_bitmap = bmp; }
const wxBitmapBundle& GetBitmapBundle() const { return m_bitmap; }
wxBitmap GetBitmapFor(wxWindow* wnd) const { return m_bitmap.GetBitmapFor(wnd); }
wxBitmap GetBitmap() const { return GetBitmapFor(m_window); }
void SetDisabledBitmap(const wxBitmapBundle& bmp) { m_disabledBitmap = bmp; }
const wxBitmapBundle& GetDisabledBitmapBundle() const { return m_disabledBitmap; }
wxBitmap GetDisabledBitmapFor(wxWindow* wnd) const { return m_disabledBitmap.GetBitmapFor(wnd); }
wxBitmap GetDisabledBitmap() const { return GetDisabledBitmapFor(m_window); }
// Return the bitmap for the current state, normal or disabled.
wxBitmap GetCurrentBitmapFor(wxWindow* wnd) const;
void SetHoverBitmap(const wxBitmapBundle& bmp) { m_hoverBitmap = bmp; }
const wxBitmapBundle& GetHoverBitmapBundle() const { return m_hoverBitmap; }
wxBitmap GetHoverBitmap() const { return m_hoverBitmap.GetBitmapFor(m_window); }
void SetShortHelp(const wxString& s) { m_shortHelp = s; }
const wxString& GetShortHelp() const { return m_shortHelp; }
void SetLongHelp(const wxString& s) { m_longHelp = s; }
const wxString& GetLongHelp() const { return m_longHelp; }
void SetMinSize(const wxSize& s) { m_minSize = s; }
const wxSize& GetMinSize() const { return m_minSize; }
void SetSpacerPixels(int s) { m_spacerPixels = s; }
int GetSpacerPixels() const { return m_spacerPixels; }
void SetProportion(int p) { m_proportion = p; }
int GetProportion() const { return m_proportion; }
void SetActive(bool b) { m_active = b; }
bool IsActive() const { return m_active; }
void SetHasDropDown(bool b)
{
wxCHECK_RET( !b || m_kind == wxITEM_NORMAL,
wxS("Only normal tools can have drop downs") );
m_dropDown = b;
}
bool HasDropDown() const { return m_dropDown; }
void SetSticky(bool b) { m_sticky = b; }
bool IsSticky() const { return m_sticky; }
void SetUserData(long l) { m_userData = l; }
long GetUserData() const { return m_userData; }
void SetClientData(wxObject* l) { m_clientData = l; }
wxObject* GetClientData() const { return m_clientData; }
void SetAlignment(int l) { m_alignment = l; }
int GetAlignment() const { return m_alignment; }
bool CanBeToggled() const
{
return m_kind == wxITEM_CHECK || m_kind == wxITEM_RADIO;
}
private:
wxWindow* m_window; // item's associated window
wxString m_label; // label displayed on the item
wxBitmapBundle m_bitmap; // item's bitmap
wxBitmapBundle m_disabledBitmap; // item's disabled bitmap
wxBitmapBundle m_hoverBitmap; // item's hover bitmap
wxString m_shortHelp; // short help (for tooltip)
wxString m_longHelp; // long help (for status bar)
wxSizerItem* m_sizerItem; // sizer item
wxSize m_minSize; // item's minimum size
int m_spacerPixels; // size of a spacer
int m_toolId; // item's id
int m_kind; // item's kind
int m_state; // state
int m_proportion; // proportion
bool m_active; // true if the item is currently active
bool m_dropDown; // true if the item has a dropdown button
bool m_sticky; // overrides button states if true (always active)
long m_userData; // number associated with the item
wxObject* m_clientData; // pointer to a wxObject associated with the item
int m_alignment; // sizer alignment flag, defaults to wxCENTER, may be wxEXPAND or any other
};
using wxAuiToolBarItemArray = wxBaseObjectArray<wxAuiToolBarItem>;
// tab art class
class WXDLLIMPEXP_AUI wxAuiToolBarArt
{
public:
wxAuiToolBarArt() = default;
virtual ~wxAuiToolBarArt() = default;
wxNODISCARD virtual wxAuiToolBarArt* Clone() = 0;
virtual void SetFlags(unsigned int flags) = 0;
virtual unsigned int GetFlags() = 0;
virtual void SetFont(const wxFont& font) = 0;
virtual wxFont GetFont() = 0;
virtual void SetTextOrientation(int orientation) = 0;
virtual int GetTextOrientation() = 0;
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawPlainBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawDropDownButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawControlLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) = 0;
virtual void DrawSeparator(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawGripper(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawOverflowButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect,
int state) = 0;
virtual wxSize GetLabelSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) = 0;
virtual wxSize GetToolSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) = 0;
// This function should be used for querying element sizes in the new code,
// as it scales them by the DPI of the provided window. GetElementSize()
// still exists (and is simpler to override), but is usually _not_ what you
// need.
virtual int GetElementSizeForWindow(int elementId, const wxWindow* window);
// Note that these functions work with the size in DIPs, not physical
// pixels.
virtual int GetElementSize(int elementId) = 0;
virtual void SetElementSize(int elementId, int size) = 0;
virtual int ShowDropDown(
wxWindow* wnd,
const wxAuiToolBarItemArray& items) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
};
class WXDLLIMPEXP_AUI wxAuiGenericToolBarArt : public wxAuiToolBarArt
{
public:
wxAuiGenericToolBarArt();
virtual ~wxAuiGenericToolBarArt();
wxNODISCARD virtual wxAuiToolBarArt* Clone() override;
virtual void SetFlags(unsigned int flags) override;
virtual unsigned int GetFlags() override;
virtual void SetFont(const wxFont& font) override;
virtual wxFont GetFont() override;
virtual void SetTextOrientation(int orientation) override;
virtual int GetTextOrientation() override;
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawPlainBackground(wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawDropDownButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawControlLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawSeparator(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawGripper(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawOverflowButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect,
int state) override;
virtual wxSize GetLabelSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) override;
virtual wxSize GetToolSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) override;
virtual int GetElementSize(int element) override;
virtual void SetElementSize(int elementId, int size) override;
virtual int ShowDropDown(wxWindow* wnd,
const wxAuiToolBarItemArray& items) override;
virtual void UpdateColoursFromSystem() override;
protected:
wxBitmapBundle m_buttonDropDownBmp;
wxBitmapBundle m_disabledButtonDropDownBmp;
wxBitmapBundle m_overflowBmp;
wxBitmapBundle m_disabledOverflowBmp;
wxColour m_baseColour;
wxColour m_highlightColour;
wxFont m_font;
unsigned int m_flags;
int m_textOrientation;
wxPen m_gripperPen1;
wxPen m_gripperPen2;
wxPen m_gripperPen3;
// These values are in DIPs and not physical pixels.
int m_separatorSize;
int m_gripperSize;
int m_overflowSize;
int m_dropdownSize;
};
class WXDLLIMPEXP_AUI wxAuiToolBar : public wxCustomBackgroundWindow<wxControl>
{
public:
wxAuiToolBar() { Init(); }
wxAuiToolBar(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_TB_DEFAULT_STYLE)
{
Init();
Create(parent, id, pos, size, style);
}
virtual ~wxAuiToolBar();
bool Create(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_TB_DEFAULT_STYLE);
virtual void SetWindowStyleFlag(long style) override;
void SetArtProvider(wxAuiToolBarArt* art);
wxAuiToolBarArt* GetArtProvider() const;
bool SetFont(const wxFont& font) override;
wxAuiToolBarItem* AddTool(int toolId,
const wxString& label,
const wxBitmapBundle& bitmap,
const wxString& shortHelpString = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL);
wxAuiToolBarItem* AddTool(int toolId,
const wxString& label,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& disabledBitmap,
wxItemKind kind,
const wxString& shortHelpString,
const wxString& longHelpString,
wxObject* clientData);
wxAuiToolBarItem* AddTool(int toolId,
const wxBitmapBundle& bitmap,
const wxBitmapBundle& disabledBitmap,
bool toggle = false,
wxObject* clientData = nullptr,
const wxString& shortHelpString = wxEmptyString,
const wxString& longHelpString = wxEmptyString)
{
return AddTool(toolId,
wxEmptyString,
bitmap,
disabledBitmap,
toggle ? wxITEM_CHECK : wxITEM_NORMAL,
shortHelpString,
longHelpString,
clientData);
}
wxAuiToolBarItem* AddLabel(int toolId,
const wxString& label = wxEmptyString,
const int width = -1);
wxAuiToolBarItem* AddControl(wxControl* control,
const wxString& label = wxEmptyString);
wxAuiToolBarItem* AddSeparator();
wxAuiToolBarItem* AddSpacer(int pixels);
wxAuiToolBarItem* AddStretchSpacer(int proportion = 1);
bool Realize();
wxControl* FindControl(int windowId);
wxAuiToolBarItem* FindToolByPosition(wxCoord x, wxCoord y) const;
wxAuiToolBarItem* FindToolByIndex(int idx) const;
wxAuiToolBarItem* FindTool(int toolId) const;
void ClearTools() { Clear() ; }
void Clear();
bool DestroyTool(int toolId);
bool DestroyToolByIndex(int idx);
// Note that these methods do _not_ delete the associated control, if any.
// Use DestroyTool() or DestroyToolByIndex() if this is wanted.
bool DeleteTool(int toolId);
bool DeleteByIndex(int toolId);
size_t GetToolCount() const;
int GetToolPos(int toolId) const { return GetToolIndex(toolId); }
int GetToolIndex(int toolId) const;
bool GetToolFits(int toolId) const;
wxRect GetToolRect(int toolId) const;
bool GetToolFitsByIndex(int toolId) const;
bool GetToolBarFits() const;
void SetMargins(const wxSize& size) { SetMargins(size.x, size.x, size.y, size.y); }
void SetMargins(int x, int y) { SetMargins(x, x, y, y); }
void SetMargins(int left, int right, int top, int bottom);
void SetToolClientData (int tool_id, wxObject* client_data);
wxObject* GetToolClientData(int tool_id) const;
void SetToolBitmapSize(const wxSize& size);
wxSize GetToolBitmapSize() const;
bool GetOverflowVisible() const;
void SetOverflowVisible(bool visible);
bool GetGripperVisible() const;
void SetGripperVisible(bool visible);
void ToggleTool(int toolId, bool state);
bool GetToolToggled(int toolId) const;
void EnableTool(int toolId, bool state);
bool GetToolEnabled(int toolId) const;
void SetToolDropDown(int toolId, bool dropdown);
bool GetToolDropDown(int toolId) const;
void SetToolBorderPadding(int padding);
int GetToolBorderPadding() const;
void SetToolTextOrientation(int orientation);
int GetToolTextOrientation() const;
void SetToolPacking(int packing);
int GetToolPacking() const;
void SetToolProportion(int toolId, int proportion);
int GetToolProportion(int toolId) const;
void SetToolSeparation(int separation);
int GetToolSeparation() const;
void SetToolSticky(int toolId, bool sticky);
bool GetToolSticky(int toolId) const;
wxString GetToolLabel(int toolId) const;
void SetToolLabel(int toolId, const wxString& label);
wxBitmap GetToolBitmap(int toolId) const;
void SetToolBitmap(int toolId, const wxBitmapBundle& bitmap);
wxString GetToolShortHelp(int toolId) const;
void SetToolShortHelp(int toolId, const wxString& helpString);
wxString GetToolLongHelp(int toolId) const;
void SetToolLongHelp(int toolId, const wxString& helpString);
void SetCustomOverflowItems(const wxAuiToolBarItemArray& prepend,
const wxAuiToolBarItemArray& append);
// get size of hint rectangle for a particular dock location
wxSize GetHintSize(int dockDirection) const;
bool IsPaneValid(const wxAuiPaneInfo& pane) const;
// Override to call DoIdleUpdate().
virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE) override;
protected:
void Init();
// Override to return the minimum acceptable size because under wxMSW this
// function returns DEFAULT_ITEM_HEIGHT (see wxControl::DoGetBestSize())
// which is not suitable as height/width for a horizontal/vertical toolbar
// if icon sizes are much smaller than DEFAULT_ITEM_HEIGHT.
virtual wxSize DoGetBestSize() const override;
virtual void OnCustomRender(wxDC& WXUNUSED(dc),
const wxAuiToolBarItem& WXUNUSED(item),
const wxRect& WXUNUSED(rect)) { }
protected:
void DoIdleUpdate();
void SetOrientation(int orientation);
void SetHoverItem(wxAuiToolBarItem* item);
void SetPressedItem(wxAuiToolBarItem* item);
void RefreshOverflowState();
int GetOverflowState() const;
wxRect GetOverflowRect() const;
wxSize GetLabelSize(const wxString& label);
wxAuiToolBarItem* FindToolByPositionWithPacking(wxCoord x, wxCoord y) const;
protected: // handlers
void OnSize(wxSizeEvent& evt);
void OnIdle(wxIdleEvent& evt);
void OnDPIChanged(wxDPIChangedEvent& evt);
void OnPaint(wxPaintEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnLeftUp(wxMouseEvent& evt);
void OnRightDown(wxMouseEvent& evt);
void OnRightUp(wxMouseEvent& evt);
void OnMiddleDown(wxMouseEvent& evt);
void OnMiddleUp(wxMouseEvent& evt);
void OnMotion(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnSetCursor(wxSetCursorEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
wxAuiToolBarItemArray m_items; // array of toolbar items
wxAuiToolBarArt* m_art; // art provider
wxBoxSizer* m_sizer; // main sizer for toolbar
wxAuiToolBarItem* m_actionItem; // item that's being acted upon (pressed)
wxAuiToolBarItem* m_tipItem; // item that has its tooltip shown
wxBitmap m_bitmap; // double-buffer bitmap
wxSizerItem* m_gripperSizerItem;
wxSizerItem* m_overflowSizerItem;
wxSize m_absoluteMinSize;
wxPoint m_actionPos; // position of left-mouse down
wxAuiToolBarItemArray m_customOverflowPrepend;
wxAuiToolBarItemArray m_customOverflowAppend;
int m_buttonWidth;
int m_buttonHeight;
int m_sizerElementCount;
int m_leftPadding;
int m_rightPadding;
int m_topPadding;
int m_bottomPadding;
int m_toolPacking;
int m_toolBorderPadding;
int m_toolTextOrientation;
int m_overflowState;
bool m_dragging;
bool m_gripperVisible;
bool m_overflowVisible;
// This function is only kept for compatibility, don't use in the new code.
bool RealizeHelper(wxClientDC& dc, bool horizontal);
static bool IsPaneValid(long style, const wxAuiPaneInfo& pane);
bool IsPaneValid(long style) const;
void SetArtFlags() const;
wxOrientation m_orientation;
wxSize m_horzHintSize;
wxSize m_vertHintSize;
private:
// Common part of OnLeaveWindow() and OnCaptureLost().
void DoResetMouseState();
wxSize RealizeHelper(wxReadOnlyDC& dc, wxOrientation orientation);
void UpdateBackgroundBitmap(const wxSize& size);
wxBitmap m_backgroundBitmap;
wxDECLARE_EVENT_TABLE();
wxDECLARE_CLASS(wxAuiToolBar);
};
// wx event machinery
#ifndef SWIG
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_TOOL_DROPDOWN, wxAuiToolBarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_OVERFLOW_CLICK, wxAuiToolBarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_MIDDLE_CLICK, wxAuiToolBarEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEvent );
typedef void (wxEvtHandler::*wxAuiToolBarEventFunction)(wxAuiToolBarEvent&);
#define wxAuiToolBarEventHandler(func) \
wxEVENT_HANDLER_CAST(wxAuiToolBarEventFunction, func)
#define EVT_AUITOOLBAR_TOOL_DROPDOWN(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_TOOL_DROPDOWN, winid, wxAuiToolBarEventHandler(fn))
#define EVT_AUITOOLBAR_OVERFLOW_CLICK(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_OVERFLOW_CLICK, winid, wxAuiToolBarEventHandler(fn))
#define EVT_AUITOOLBAR_RIGHT_CLICK(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_RIGHT_CLICK, winid, wxAuiToolBarEventHandler(fn))
#define EVT_AUITOOLBAR_MIDDLE_CLICK(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_MIDDLE_CLICK, winid, wxAuiToolBarEventHandler(fn))
#define EVT_AUITOOLBAR_BEGIN_DRAG(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUITOOLBAR_BEGIN_DRAG, winid, wxAuiToolBarEventHandler(fn))
#else
// wxpython/swig event work
%constant wxEventType wxEVT_AUITOOLBAR_TOOL_DROPDOWN;
%constant wxEventType wxEVT_AUITOOLBAR_OVERFLOW_CLICK;
%constant wxEventType wxEVT_AUITOOLBAR_RIGHT_CLICK;
%constant wxEventType wxEVT_AUITOOLBAR_MIDDLE_CLICK;
%constant wxEventType wxEVT_AUITOOLBAR_BEGIN_DRAG;
%pythoncode {
EVT_AUITOOLBAR_TOOL_DROPDOWN = wx.PyEventBinder( wxEVT_AUITOOLBAR_TOOL_DROPDOWN, 1 )
EVT_AUITOOLBAR_OVERFLOW_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_OVERFLOW_CLICK, 1 )
EVT_AUITOOLBAR_RIGHT_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_RIGHT_CLICK, 1 )
EVT_AUITOOLBAR_MIDDLE_CLICK = wx.PyEventBinder( wxEVT_AUITOOLBAR_MIDDLE_CLICK, 1 )
EVT_AUITOOLBAR_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUITOOLBAR_BEGIN_DRAG, 1 )
}
#endif // SWIG
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_AUITOOLBAR_TOOL_DROPDOWN wxEVT_AUITOOLBAR_TOOL_DROPDOWN
#define wxEVT_COMMAND_AUITOOLBAR_OVERFLOW_CLICK wxEVT_AUITOOLBAR_OVERFLOW_CLICK
#define wxEVT_COMMAND_AUITOOLBAR_RIGHT_CLICK wxEVT_AUITOOLBAR_RIGHT_CLICK
#define wxEVT_COMMAND_AUITOOLBAR_MIDDLE_CLICK wxEVT_AUITOOLBAR_MIDDLE_CLICK
#define wxEVT_COMMAND_AUITOOLBAR_BEGIN_DRAG wxEVT_AUITOOLBAR_BEGIN_DRAG
#if defined(__WXMSW__) && wxUSE_UXTHEME
#define wxHAS_NATIVE_TOOLBAR_ART
#include "wx/aui/barartmsw.h"
#define wxAuiDefaultToolBarArt wxAuiMSWToolBarArt
#endif
#ifndef wxHAS_NATIVE_TOOLBAR_ART
#define wxAuiDefaultToolBarArt wxAuiGenericToolBarArt
#endif
#endif // wxUSE_AUI
#endif // _WX_AUIBAR_H_

View File

@@ -0,0 +1,810 @@
//////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/auibook.h
// Purpose: wxaui: wx advanced user interface - notebook
// Author: Benjamin I. Williams
// Modified by: Jens Lody
// Created: 2006-06-28
// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUINOTEBOOK_H_
#define _WX_AUINOTEBOOK_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/aui/tabart.h"
#include "wx/aui/framemanager.h"
#include "wx/compositebookctrl.h"
#include <vector>
class wxAuiBookSerializer;
class wxAuiBookDeserializer;
class wxAuiNotebook;
class wxAuiTabFrame;
enum wxAuiNotebookOption
{
wxAUI_NB_TOP = 1 << 0,
wxAUI_NB_LEFT = 1 << 1, // not implemented yet
wxAUI_NB_RIGHT = 1 << 2, // not implemented yet
wxAUI_NB_BOTTOM = 1 << 3,
wxAUI_NB_TAB_SPLIT = 1 << 4,
wxAUI_NB_TAB_MOVE = 1 << 5,
wxAUI_NB_TAB_EXTERNAL_MOVE = 1 << 6,
wxAUI_NB_TAB_FIXED_WIDTH = 1 << 7,
wxAUI_NB_SCROLL_BUTTONS = 1 << 8,
wxAUI_NB_WINDOWLIST_BUTTON = 1 << 9,
wxAUI_NB_CLOSE_BUTTON = 1 << 10,
wxAUI_NB_CLOSE_ON_ACTIVE_TAB = 1 << 11,
wxAUI_NB_CLOSE_ON_ALL_TABS = 1 << 12,
wxAUI_NB_MIDDLE_CLICK_CLOSE = 1 << 13,
wxAUI_NB_MULTILINE = 1 << 14,
wxAUI_NB_PIN_ON_ACTIVE_TAB = 1 << 15,
wxAUI_NB_UNPIN_ON_ALL_PINNED = 1 << 16,
wxAUI_NB_DEFAULT_STYLE = wxAUI_NB_TOP |
wxAUI_NB_TAB_SPLIT |
wxAUI_NB_TAB_MOVE |
wxAUI_NB_SCROLL_BUTTONS |
wxAUI_NB_CLOSE_ON_ACTIVE_TAB |
wxAUI_NB_MIDDLE_CLICK_CLOSE
};
wxALLOW_COMBINING_ENUMS(wxAuiNotebookOption, wxBorder)
// aui notebook event class
class WXDLLIMPEXP_AUI wxAuiNotebookEvent : public wxBookCtrlEvent
{
public:
wxAuiNotebookEvent(wxEventType commandType = wxEVT_NULL,
int winId = 0)
: wxBookCtrlEvent(commandType, winId)
{
m_dragSource = nullptr;
}
wxNODISCARD wxEvent *Clone() const override { return new wxAuiNotebookEvent(*this); }
void SetDragSource(wxAuiNotebook* s) { m_dragSource = s; }
wxAuiNotebook* GetDragSource() const { return m_dragSource; }
private:
wxAuiNotebook* m_dragSource;
#ifndef SWIG
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxAuiNotebookEvent);
#endif
};
class WXDLLIMPEXP_AUI wxAuiTabContainerButton
{
public:
wxAuiTabContainerButton() = default;
wxAuiTabContainerButton(
int id_,
int location_,
wxAuiPaneButtonState curState_ = wxAUI_BUTTON_STATE_NORMAL
) : id(id_), curState(curState_), location(location_)
{
}
int id = 0; // button's id
int curState = 0; // current state (normal, hover, pressed, etc.)
int location = 0; // buttons location (wxLEFT, wxRIGHT, or wxCENTER)
wxBitmapBundle bitmap; // button's hover bitmap
wxBitmapBundle disBitmap; // button's disabled bitmap
wxRect rect; // button's hit rectangle
};
// Possible tab states.
enum class wxAuiTabKind
{
Normal, // Can be closed and dragged by user.
Pinned, // Can be closed but can't be dragged. Can be unpinned by user.
Locked // Can't be closed, dragged nor unlocked by user.
};
class WXDLLIMPEXP_AUI wxAuiNotebookPage
{
public:
wxWindow* window = nullptr; // page's associated window
wxString caption; // caption displayed on the tab
wxString tooltip; // tooltip displayed when hovering over tab title
wxBitmapBundle bitmap;// tab's bitmap
wxAuiTabKind kind = wxAuiTabKind::Normal; // tab's kind
wxRect rect; // tab's hit rectangle (only used internally)
bool active = false; // true if the page is currently active
// These fields are internal, don't use them.
bool hover = false; // true if mouse hovering over tab
bool rowEnd = false; // true if the tab is the last in the row
// This vector contains per-page buttons, i.e. "close" and, optionally,
// "pin" buttons. It can be empty if none are used.
std::vector<wxAuiTabContainerButton> buttons;
};
// These legacy classes can't be just typedefs as they can be (and are)
// forward-declared in the existing code.
class wxAuiNotebookPageArray : public wxBaseArray<wxAuiNotebookPage>
{
public:
using wxBaseArray<wxAuiNotebookPage>::wxBaseArray;
};
class wxAuiTabContainerButtonArray : public wxBaseArray<wxAuiTabContainerButton>
{
public:
using wxBaseArray<wxAuiTabContainerButton>::wxBaseArray;
};
class WXDLLIMPEXP_AUI wxAuiTabContainer
{
public:
wxAuiTabContainer();
virtual ~wxAuiTabContainer();
void SetArtProvider(wxAuiTabArt* art);
wxAuiTabArt* GetArtProvider() const;
void SetFlags(unsigned int flags);
unsigned int GetFlags() const { return m_flags; }
bool IsFlagSet(unsigned int flag) const { return (m_flags & flag) != 0; }
bool AddPage(const wxAuiNotebookPage& info);
bool InsertPage(const wxAuiNotebookPage& info, size_t idx);
bool MovePage(wxWindow* page, size_t newIdx);
bool MovePage(size_t oldIdx, size_t newIdx);
bool RemovePage(wxWindow* page);
void RemovePageAt(size_t idx);
bool SetActivePage(const wxWindow* page);
bool SetActivePage(size_t page);
void SetNoneActive();
int GetActivePage() const;
// Struct containing the result of a tab hit test.
struct HitTestResult
{
HitTestResult() = default;
HitTestResult(wxWindow* window_, int pos_)
: window(window_), pos(pos_)
{
}
// Check if the result is valid.
explicit operator bool() const { return window != nullptr; }
// The window at the given position or null if none.
wxWindow* window = nullptr;
// The position of the tab in the tab control.
int pos = wxNOT_FOUND;
};
// Flags allowing to customize the behaviour of TabHitTest().
enum HitTestFlags
{
HitTest_Default = 0,
HitTest_AllowAfterTab = 1
};
HitTestResult TabHitTest(const wxPoint& pt, int flags = HitTest_Default) const;
wxAuiTabContainerButton* ButtonHitTest(const wxPoint& pt) const;
wxWindow* GetWindowFromIdx(size_t idx) const;
int GetIdxFromWindow(const wxWindow* page) const;
size_t GetPageCount() const;
wxAuiNotebookPage& GetPage(size_t idx);
const wxAuiNotebookPage& GetPage(size_t idx) const;
const wxAuiNotebookPageArray& GetPages() const;
void SetNormalFont(const wxFont& normalFont);
void SetSelectedFont(const wxFont& selectedFont);
void SetMeasuringFont(const wxFont& measuringFont);
void SetColour(const wxColour& colour);
void SetActiveColour(const wxColour& colour);
void DoShowHide();
void SetRect(const wxRect& rect, wxWindow* wnd = nullptr);
void SetRowHeight(int rowHeight);
void RemoveButton(int id);
void AddButton(int id,
int location,
const wxBitmapBundle& normalBitmap = wxBitmapBundle(),
const wxBitmapBundle& disabledBitmap = wxBitmapBundle());
size_t GetTabOffset() const;
void SetTabOffset(size_t offset);
// Is the tab visible?
bool IsTabVisible(int tabPage, int tabOffset, wxReadOnlyDC* dc, wxWindow* wnd);
// Make the tab visible if it wasn't already
void MakeTabVisible(int tabPage, wxWindow* win);
// Internal, don't use.
void RemoveAll();
// Backwards compatible variants of internal functions, which shouldn't be
// used anyhow.
bool AddPage(wxWindow* page, wxAuiNotebookPage info)
{
info.window = page;
return AddPage(info);
}
bool InsertPage(wxWindow* page, wxAuiNotebookPage info, size_t idx)
{
info.window = page;
return InsertPage(info, idx);
}
bool ButtonHitTest(int x, int y, wxAuiTabContainerButton** hit) const
{
auto* const button = ButtonHitTest(wxPoint(x, y));
if ( hit )
*hit = button;
return button != nullptr;
}
bool TabHitTest(int x, int y, wxWindow** hit) const
{
auto const res = TabHitTest(wxPoint(x, y));
if ( hit )
*hit = res.window;
return res.window != nullptr;
}
// Internal functions only, don't use.
// Layout tabs in wxAUI_NB_MULTILINE case using either the width of the
// given rectangle or the current width and return the extra height needed
// for the additional rows.
//
// This function has an important side effect of updating rowEnd for all
// pages -- which defines the layout.
int LayoutMultiLineTabs(const wxRect& rect, wxWindow* wnd);
int LayoutMultiLineTabs(wxWindow* wnd)
{
return LayoutMultiLineTabs(m_rect, wnd);
}
// Get the index of the first tab of the given kind or of a different kind,
// returning GetPageCount() if there is no such tabs.
int GetFirstTabOfKind(wxAuiTabKind kind) const;
int GetFirstTabNotOfKind(wxAuiTabKind kind) const;
protected:
virtual void Render(wxDC* dc, wxWindow* wnd);
protected:
wxAuiTabArt* m_art;
// Contains pages in the display order.
wxAuiNotebookPageArray m_pages;
// This vector contains container-level buttons, e.g. left/right scroll
// buttons, close button if it's not per-tab, window list button etc.
std::vector<wxAuiTabContainerButton> m_buttons;
wxRect m_rect;
size_t m_tabOffset;
unsigned int m_flags;
private:
// Return the width that can be used for the tabs, i.e. without the space
// reserved for the buttons.
int GetAvailableForTabs(const wxRect& rect, wxReadOnlyDC& dc, wxWindow* wnd);
// Render the buttons: part of Render(), returns the extent of the buttons
// on the left and right side.
void RenderButtons(wxDC& dc, wxWindow* wnd,
int& left_buttons_width, int& right_buttons_width);
// Update the state of the page buttons depending on its state and flags.
//
// If forceActive is true, the page is always considered as active, see the
// comment in LayoutMultiLineTabs() for the reason why this is needed.
void UpdateButtonsState(wxAuiNotebookPage& page, bool forceActive = false);
int m_tabRowHeight;
};
class WXDLLIMPEXP_AUI wxAuiTabCtrl : public wxControl,
public wxAuiTabContainer
{
public:
wxAuiTabCtrl(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
~wxAuiTabCtrl();
bool IsDragging() const { return m_isDragging; }
void SetRect(const wxRect& rect) { wxAuiTabContainer::SetRect(rect, this); }
// Internal helpers.
void DoShowTab(int idx);
void DoUpdateActive();
// Internal function taking the total tab frame area and setting the size
// of the window to its sub-rectangle corresponding to tabs orientation.
//
// Also updates rowEnd for all pages in m_pages when using multiple rows.
void DoApplyRect(const wxRect& rect, int tabCtrlHeight);
// Another internal helper: return the hint rectangle corresponding to this
// tab control in screen coordinates.
wxRect GetHintScreenRect() const;
protected:
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
void OnPaint(wxPaintEvent& evt);
void OnEraseBackground(wxEraseEvent& evt);
void OnSize(wxSizeEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnLeftDClick(wxMouseEvent& evt);
void OnLeftUp(wxMouseEvent& evt);
void OnMiddleDown(wxMouseEvent& evt);
void OnMiddleUp(wxMouseEvent& evt);
void OnRightDown(wxMouseEvent& evt);
void OnRightUp(wxMouseEvent& evt);
void OnMotion(wxMouseEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnButton(wxAuiNotebookEvent& evt);
void OnSetFocus(wxFocusEvent& event);
void OnKillFocus(wxFocusEvent& event);
void OnChar(wxKeyEvent& event);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnDpiChanged(wxDPIChangedEvent& event);
protected:
wxPoint m_clickPt = wxDefaultPosition;
wxWindow* m_clickTab = nullptr;
bool m_isDragging = false;
wxAuiTabContainerButton* m_hoverButton = nullptr;
wxAuiTabContainerButton* m_pressedButton = nullptr;
void SetHoverTab(wxWindow* wnd);
private:
// Reset dragging-related fields above to their initial values.
void DoEndDragging();
#ifndef SWIG
wxDECLARE_CLASS(wxAuiTabCtrl);
wxDECLARE_EVENT_TABLE();
#endif
// Rectangle corresponding to the full tab control area, including both
// tabs (which is this window) and the page area.
wxRect m_fullRect;
};
// Simple struct combining wxAuiTabCtrl with the position inside it.
struct wxAuiNotebookPosition
{
wxAuiNotebookPosition() = default;
wxAuiNotebookPosition(wxAuiTabCtrl* tabCtrl_, int tabIdx_)
: tabCtrl(tabCtrl_), tabIdx(tabIdx_)
{
}
// Check if the position is valid.
explicit operator bool() const { return tabCtrl != nullptr; }
wxAuiTabCtrl* tabCtrl = nullptr;
int tabIdx = wxNOT_FOUND;
};
class WXDLLIMPEXP_AUI wxAuiNotebook : public wxCompositeBookCtrlBase
{
public:
wxAuiNotebook() { Init(); }
wxAuiNotebook(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_NB_DEFAULT_STYLE)
{
Init();
Create(parent, id, pos, size, style);
}
virtual ~wxAuiNotebook();
bool Create(wxWindow* parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
void SetWindowStyleFlag(long style) override;
void SetArtProvider(wxAuiTabArt* art);
wxAuiTabArt* GetArtProvider() const;
virtual void SetUniformBitmapSize(const wxSize& size);
virtual void SetTabCtrlHeight(int height);
bool AddPage(wxWindow* page,
const wxString& caption,
bool select = false,
const wxBitmapBundle& bitmap = wxBitmapBundle());
bool InsertPage(size_t pageIdx,
wxWindow* page,
const wxString& caption,
bool select = false,
const wxBitmapBundle& bitmap = wxBitmapBundle());
virtual size_t GetPageCount() const override;
virtual wxWindow* GetPage(size_t pageIdx) const override;
virtual int FindPage(const wxWindow* page) const override;
// This is wxAUI-specific equivalent of FindPage(), prefer to use the other
// function.
int GetPageIndex(wxWindow* pageWnd) const { return FindPage(pageWnd); }
bool SetPageText(size_t page, const wxString& text) override;
wxString GetPageText(size_t pageIdx) const override;
bool SetPageToolTip(size_t page, const wxString& text);
wxString GetPageToolTip(size_t pageIdx) const;
bool SetPageBitmap(size_t page, const wxBitmapBundle& bitmap);
wxBitmap GetPageBitmap(size_t pageIdx) const;
wxAuiTabKind GetPageKind(size_t pageIdx) const;
bool SetPageKind(size_t pageIdx, wxAuiTabKind kind);
int SetSelection(size_t newPage) override;
int GetSelection() const override;
// Return the tab control containing the page with the given index and its
// visual position in it (i.e. 0 for the leading one).
wxAuiNotebookPosition GetPagePosition(size_t page) const;
// Return all pages in the given tab control in display order.
std::vector<size_t> GetPagesInDisplayOrder(wxAuiTabCtrl* tabCtrl) const;
void Split(size_t page, int direction);
void UnsplitAll();
const wxAuiManager& GetAuiManager() const { return m_mgr; }
void SetManagerFlags(unsigned int flags) { m_mgr.SetFlags(flags); }
// Sets the normal font
void SetNormalFont(const wxFont& font);
// Sets the selected tab font
void SetSelectedFont(const wxFont& font);
// Sets the measuring font
void SetMeasuringFont(const wxFont& font);
// Sets the tab font
virtual bool SetFont(const wxFont& font) override;
// Gets the tab control height
int GetTabCtrlHeight() const;
// Gets the height of the notebook for a given page height
int GetHeightForPageHeight(int pageHeight);
// Shows the window menu
bool ShowWindowMenu();
//wxBookCtrlBase functions
virtual void SetPageSize (const wxSize &size) override;
virtual int HitTest (const wxPoint &pt, long *flags=nullptr) const override;
virtual int GetPageImage(size_t n) const override;
virtual bool SetPageImage(size_t n, int imageId) override;
virtual int ChangeSelection(size_t n) override;
virtual bool AddPage(wxWindow *page, const wxString &text, bool select,
int imageId) override;
virtual bool DeleteAllPages() override;
virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text,
bool select, int imageId) override;
virtual wxSize DoGetBestSize() const override;
wxAuiTabCtrl* GetTabCtrlFromPoint(const wxPoint& pt);
wxAuiTabCtrl* GetActiveTabCtrl();
// Get main tab control, creating it on demand if necessary.
wxAuiTabCtrl* GetMainTabCtrl();
// Get all tab controls.
std::vector<wxAuiTabCtrl*> GetAllTabCtrls();
// Internal, don't use: use GetPagePosition() instead.
bool FindTab(wxWindow* page, wxAuiTabCtrl** ctrl, int* idx) const;
// Serialization support: this is used by wxAuiManager but can also be
// called directly to save/load layout of just this notebook.
void SaveLayout(const wxString& name, wxAuiBookSerializer& serializer) const;
void LoadLayout(const wxString& name, wxAuiBookDeserializer& deserializer);
protected:
// Common part of all ctors.
void Init();
// choose the default border for this window
virtual wxBorder GetDefaultBorder() const override { return wxBORDER_NONE; }
// Redo sizing after thawing
virtual void DoThaw() override;
// these can be overridden
// update the height, return true if it was done or false if the new height
// calculated by CalculateTabCtrlHeight() is the same as the old one
virtual bool UpdateTabCtrlHeight();
virtual int CalculateTabCtrlHeight();
virtual wxSize CalculateNewSplitSize();
// get next page in physical (display) order
virtual int GetNextPage(bool forward) const override;
// remove the page and return a pointer to it
virtual wxWindow *DoRemovePage(size_t page) override;
//A general selection function
virtual int DoModifySelection(size_t n, bool events);
protected:
void DoSizing();
void InitNotebook(long style);
wxWindow* GetTabFrameFromTabCtrl(wxWindow* tabCtrl);
void RemoveEmptyTabFrames();
void UpdateHintWindowSize();
protected:
void OnChildFocusNotebook(wxChildFocusEvent& evt);
void OnRender(wxAuiManagerEvent& evt);
void OnSize(wxSizeEvent& evt);
void OnTabClicked(wxAuiNotebookEvent& evt);
void OnTabBeginDrag(wxAuiNotebookEvent& evt);
void OnTabDragMotion(wxAuiNotebookEvent& evt);
void OnTabEndDrag(wxAuiNotebookEvent& evt);
void OnTabCancelDrag(wxAuiNotebookEvent& evt);
void OnTabButton(wxAuiNotebookEvent& evt);
void OnTabMiddleDown(wxAuiNotebookEvent& evt);
void OnTabMiddleUp(wxAuiNotebookEvent& evt);
void OnTabRightDown(wxAuiNotebookEvent& evt);
void OnTabRightUp(wxAuiNotebookEvent& evt);
void OnTabBgDClick(wxAuiNotebookEvent& evt);
void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnDpiChanged(wxDPIChangedEvent& event);
// set selection to the given window (which must be non-null and be one of
// our pages, otherwise an assert is raised)
void SetSelectionToWindow(wxWindow *win);
void SetSelectionToPage(const wxAuiNotebookPage& page)
{
SetSelectionToWindow(page.window);
}
protected:
wxAuiManager m_mgr;
// Contains all pages in the insertion order.
wxAuiTabContainer m_tabs;
// Current page index in m_tabs or wxNOT_FOUND if none.
int m_curPage;
int m_tabIdCounter;
wxWindow* m_dummyWnd;
wxSize m_requestedBmpSize;
int m_requestedTabCtrlHeight;
wxFont m_selectedFont;
wxFont m_normalFont;
int m_tabCtrlHeight;
int m_lastDropMovePos = -1;
unsigned int m_flags;
private:
// Create a new tab frame, containing a new wxAuiTabCtrl.
wxAuiTabFrame* CreateTabFrame(wxSize size = wxSize());
// Inserts the page at the given position into the given tab control.
void InsertPageAt(wxAuiNotebookPage& info,
size_t page_idx,
wxAuiTabCtrl* tabctrl,
int tab_page_idx, // Can be -1 to append.
bool select);
struct TabInfo;
TabInfo FindTab(wxWindow* page) const;
// Return the index at which the given page should be inserted in this tab
// control if it's dropped at the given (in screen coordinates) point or
// wxNOT_FOUND if dropping it is not allowed.
int GetDropIndex(const wxAuiNotebookPage& srcPage,
wxAuiTabCtrl* tabCtrl,
const wxPoint& ptScreen) const;
#ifndef SWIG
wxDECLARE_CLASS(wxAuiNotebook);
wxDECLARE_EVENT_TABLE();
#endif
};
// wx event machinery
#ifndef SWIG
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CHANGING, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_PAGE_CLOSED, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BUTTON, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BEGIN_DRAG, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_END_DRAG, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_MOTION, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_ALLOW_DND, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_DRAG_DONE, wxAuiNotebookEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_AUI, wxEVT_AUINOTEBOOK_BG_DCLICK, wxAuiNotebookEvent);
typedef void (wxEvtHandler::*wxAuiNotebookEventFunction)(wxAuiNotebookEvent&);
#define wxAuiNotebookEventHandler(func) \
wxEVENT_HANDLER_CAST(wxAuiNotebookEventFunction, func)
#define EVT_AUINOTEBOOK_PAGE_CLOSE(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSE, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CLOSED, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_PAGE_CHANGED(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGED, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_PAGE_CHANGING(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_PAGE_CHANGING, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_BUTTON(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BUTTON, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_BEGIN_DRAG(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BEGIN_DRAG, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_END_DRAG(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_END_DRAG, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_DRAG_MOTION(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_MOTION, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_ALLOW_DND(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_ALLOW_DND, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_DRAG_DONE(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_DRAG_DONE, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, winid, wxAuiNotebookEventHandler(fn))
#define EVT_AUINOTEBOOK_BG_DCLICK(winid, fn) \
wx__DECLARE_EVT1(wxEVT_AUINOTEBOOK_BG_DCLICK, winid, wxAuiNotebookEventHandler(fn))
#else
// wxpython/swig event work
%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSE;
%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CLOSED;
%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGED;
%constant wxEventType wxEVT_AUINOTEBOOK_PAGE_CHANGING;
%constant wxEventType wxEVT_AUINOTEBOOK_BUTTON;
%constant wxEventType wxEVT_AUINOTEBOOK_BEGIN_DRAG;
%constant wxEventType wxEVT_AUINOTEBOOK_END_DRAG;
%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_MOTION;
%constant wxEventType wxEVT_AUINOTEBOOK_ALLOW_DND;
%constant wxEventType wxEVT_AUINOTEBOOK_DRAG_DONE;
%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN;
%constant wxEventType wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP;
%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN;
%constant wxEventType wxEVT_AUINOTEBOOK_TAB_RIGHT_UP;
%constant wxEventType wxEVT_AUINOTEBOOK_BG_DCLICK;
%pythoncode {
EVT_AUINOTEBOOK_PAGE_CLOSE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSE, 1 )
EVT_AUINOTEBOOK_PAGE_CLOSED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CLOSED, 1 )
EVT_AUINOTEBOOK_PAGE_CHANGED = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGED, 1 )
EVT_AUINOTEBOOK_PAGE_CHANGING = wx.PyEventBinder( wxEVT_AUINOTEBOOK_PAGE_CHANGING, 1 )
EVT_AUINOTEBOOK_BUTTON = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BUTTON, 1 )
EVT_AUINOTEBOOK_BEGIN_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BEGIN_DRAG, 1 )
EVT_AUINOTEBOOK_END_DRAG = wx.PyEventBinder( wxEVT_AUINOTEBOOK_END_DRAG, 1 )
EVT_AUINOTEBOOK_DRAG_MOTION = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_MOTION, 1 )
EVT_AUINOTEBOOK_ALLOW_DND = wx.PyEventBinder( wxEVT_AUINOTEBOOK_ALLOW_DND, 1 )
EVT_AUINOTEBOOK_DRAG_DONE = wx.PyEventBinder( wxEVT_AUINOTEBOOK_DRAG_DONE, 1 )
EVT__AUINOTEBOOK_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, 1 )
EVT__AUINOTEBOOK_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP, 1 )
EVT__AUINOTEBOOK_TAB_RIGHT_DOWN = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, 1 )
EVT__AUINOTEBOOK_TAB_RIGHT_UP = wx.PyEventBinder( wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, 1 )
EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder( wxEVT_AUINOTEBOOK_BG_DCLICK, 1 )
}
#endif
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE wxEVT_AUINOTEBOOK_PAGE_CLOSE
#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED wxEVT_AUINOTEBOOK_PAGE_CLOSED
#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED wxEVT_AUINOTEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING wxEVT_AUINOTEBOOK_PAGE_CHANGING
#define wxEVT_COMMAND_AUINOTEBOOK_BUTTON wxEVT_AUINOTEBOOK_BUTTON
#define wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG wxEVT_AUINOTEBOOK_BEGIN_DRAG
#define wxEVT_COMMAND_AUINOTEBOOK_END_DRAG wxEVT_AUINOTEBOOK_END_DRAG
#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION wxEVT_AUINOTEBOOK_DRAG_MOTION
#define wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND wxEVT_AUINOTEBOOK_ALLOW_DND
#define wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE wxEVT_AUINOTEBOOK_DRAG_DONE
#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN
#define wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP wxEVT_AUINOTEBOOK_TAB_MIDDLE_UP
#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN
#define wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP wxEVT_AUINOTEBOOK_TAB_RIGHT_UP
#define wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK wxEVT_AUINOTEBOOK_BG_DCLICK
#define wxEVT_COMMAND_AUINOTEBOOK_CANCEL_DRAG wxEVT_AUINOTEBOOK_CANCEL_DRAG
#endif // wxUSE_AUI
#endif // _WX_AUINOTEBOOK_H_

View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/barartmsw.h
// Purpose: Interface of wxAuiMSWToolBarArt
// Author: Tobias Taschner
// Created: 2015-09-22
// Copyright: (c) 2015 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_BARART_MSW_H_
#define _WX_AUI_BARART_MSW_H_
#include "wx/aui/auibar.h"
#if wxUSE_AUI
class WXDLLIMPEXP_AUI wxAuiMSWToolBarArt : public wxAuiGenericToolBarArt
{
public:
wxAuiMSWToolBarArt();
wxNODISCARD virtual wxAuiToolBarArt* Clone() override;
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawDropDownButton(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawControlLabel(
wxDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item,
const wxRect& rect) override;
virtual void DrawSeparator(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawGripper(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
virtual void DrawOverflowButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect,
int state) override;
virtual wxSize GetLabelSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) override;
virtual wxSize GetToolSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiToolBarItem& item) override;
virtual int ShowDropDown(wxWindow* wnd,
const wxAuiToolBarItemArray& items) override;
private:
bool m_themed;
wxSize m_buttonSize;
};
#endif // wxUSE_AUI
#endif // _WX_AUI_BARART_MSW_H_

View File

@@ -0,0 +1,200 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/dockart.h
// Purpose: wxaui: wx advanced user interface - docking window manager
// Author: Benjamin I. Williams
// Created: 2005-05-17
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DOCKART_H_
#define _WX_DOCKART_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/bmpbndl.h"
#include "wx/colour.h"
#include "wx/font.h"
class WXDLLIMPEXP_FWD_AUI wxAuiPaneInfo;
// dock art provider code - a dock provider provides all drawing
// functionality to the wxAui dock manager. This allows the dock
// manager to have pluggable look-and-feels
class WXDLLIMPEXP_AUI wxAuiDockArt
{
public:
wxAuiDockArt() = default;
virtual ~wxAuiDockArt() = default;
wxNODISCARD virtual wxAuiDockArt* Clone() = 0;
// This function should be used for querying metrics in the new code, as it
// will scale them by the DPI of the provided window if necessary. The
// older GetMetric() function is kept for compatibility and shouldn't be
// used outside of this class itself.
virtual int GetMetricForWindow(int id, wxWindow* window);
virtual int GetMetric(int id) = 0;
virtual void SetMetric(int id, int newVal) = 0;
virtual void SetFont(int id, const wxFont& font) = 0;
virtual wxFont GetFont(int id) = 0;
virtual wxColour GetColour(int id) = 0;
virtual void SetColour(int id, const wxColor& colour) = 0;
wxColour GetColor(int id) { return GetColour(id); }
void SetColor(int id, const wxColour& color) { SetColour(id, color); }
virtual void DrawSash(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect) = 0;
virtual void DrawBackground(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect) = 0;
virtual void DrawCaption(wxDC& dc,
wxWindow* window,
const wxString& text,
const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
virtual void DrawGripper(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
virtual void DrawBorder(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
virtual void DrawPaneButton(wxDC& dc,
wxWindow* window,
int button,
int buttonState,
const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
};
// this is the default art provider for wxAuiManager. Dock art
// can be customized by creating a class derived from this one,
// or replacing this class entirely
class WXDLLIMPEXP_AUI wxAuiDefaultDockArt : public wxAuiDockArt
{
public:
wxAuiDefaultDockArt();
wxNODISCARD wxAuiDockArt* Clone() override;
int GetMetric(int metricId) override;
void SetMetric(int metricId, int newVal) override;
wxColour GetColour(int id) override;
void SetColour(int id, const wxColor& colour) override;
void SetFont(int id, const wxFont& font) override;
wxFont GetFont(int id) override;
void DrawSash(wxDC& dc,
wxWindow *window,
int orientation,
const wxRect& rect) override;
void DrawBackground(wxDC& dc,
wxWindow *window,
int orientation,
const wxRect& rect) override;
void DrawCaption(wxDC& dc,
wxWindow *window,
const wxString& text,
const wxRect& rect,
wxAuiPaneInfo& pane) override;
void DrawGripper(wxDC& dc,
wxWindow *window,
const wxRect& rect,
wxAuiPaneInfo& pane) override;
void DrawBorder(wxDC& dc,
wxWindow *window,
const wxRect& rect,
wxAuiPaneInfo& pane) override;
void DrawPaneButton(wxDC& dc,
wxWindow *window,
int button,
int buttonState,
const wxRect& rect,
wxAuiPaneInfo& pane) override;
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED_MSG("This is not intended for the public API")
void DrawIcon(wxDC& dc,
const wxRect& rect,
wxAuiPaneInfo& pane);
#endif
virtual void UpdateColoursFromSystem() override;
protected:
void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active);
void DrawIcon(wxDC& dc, wxWindow *window, const wxRect& rect, wxAuiPaneInfo& pane);
void InitBitmaps();
protected:
wxPen m_borderPen;
wxBrush m_sashBrush;
wxBrush m_backgroundBrush;
wxBrush m_gripperBrush;
wxFont m_captionFont;
wxBitmapBundle m_inactiveCloseBitmap;
wxBitmapBundle m_inactivePinBitmap;
wxBitmapBundle m_inactiveMaximizeBitmap;
wxBitmapBundle m_inactiveRestoreBitmap;
wxBitmapBundle m_activeCloseBitmap;
wxBitmapBundle m_activePinBitmap;
wxBitmapBundle m_activeMaximizeBitmap;
wxBitmapBundle m_activeRestoreBitmap;
wxPen m_gripperPen1;
wxPen m_gripperPen2;
wxPen m_gripperPen3;
wxColour m_baseColour;
wxColour m_activeCaptionColour;
wxColour m_activeCaptionGradientColour;
wxColour m_activeCaptionTextColour;
wxColour m_inactiveCaptionColour;
wxColour m_inactiveCaptionGradientColour;
wxColour m_inactiveCaptionTextColour;
int m_borderSize;
int m_captionSize;
int m_sashSize;
int m_buttonSize;
int m_gripperSize;
int m_gradientType;
};
#endif // wxUSE_AUI
#endif //_WX_DOCKART_H_

View File

@@ -0,0 +1,87 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/floatpane.h
// Purpose: wxaui: wx advanced user interface - docking window manager
// Author: Benjamin I. Williams
// Created: 2005-05-17
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FLOATPANE_H_
#define _WX_FLOATPANE_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/weakref.h"
#if wxUSE_MINIFRAME
#include "wx/minifram.h"
#define wxAuiFloatingFrameBaseClass wxMiniFrame
#else
#include "wx/frame.h"
#define wxAuiFloatingFrameBaseClass wxFrame
#endif
#include "wx/aui/framemanager.h"
class WXDLLIMPEXP_AUI wxAuiFloatingFrame : public wxAuiFloatingFrameBaseClass
{
public:
wxAuiFloatingFrame(wxWindow* parent,
wxAuiManager* ownerMgr,
const wxAuiPaneInfo& pane,
wxWindowID id = wxID_ANY,
long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION |
wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT |
wxCLIP_CHILDREN
);
virtual ~wxAuiFloatingFrame();
void SetPaneWindow(const wxAuiPaneInfo& pane);
wxAuiManager* GetOwnerManager() const;
// Allow processing accelerators to the parent frame
virtual bool IsTopNavigationDomain(NavigationKind kind) const override;
wxAuiManager& GetAuiManager() { return m_mgr; }
protected:
virtual void OnMoveStart();
virtual void OnMoving(const wxRect& windowRect, wxDirection dir);
virtual void OnMoveFinished();
private:
void OnSize(wxSizeEvent& event);
void OnClose(wxCloseEvent& event);
void OnMoveEvent(wxMoveEvent& event);
void OnIdle(wxIdleEvent& event);
void OnActivate(wxActivateEvent& event);
static bool isMouseDown();
private:
wxWindow* m_paneWindow; // pane window being managed
bool m_solidDrag; // true if system uses solid window drag
bool m_moving;
wxRect m_lastRect;
wxRect m_last2Rect;
wxRect m_last3Rect;
wxSize m_lastSize;
wxDirection m_lastDirection;
wxWeakRef<wxAuiManager> m_ownerMgr;
wxAuiManager m_mgr;
#ifndef SWIG
wxDECLARE_EVENT_TABLE();
wxDECLARE_CLASS(wxAuiFloatingFrame);
#endif // SWIG
};
#endif // wxUSE_AUI
#endif //_WX_FLOATPANE_H_

View File

@@ -0,0 +1,837 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/framemanager.h
// Purpose: wxaui: wx advanced user interface - docking window manager
// Author: Benjamin I. Williams
// Created: 2005-05-17
// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FRAMEMANAGER_H_
#define _WX_FRAMEMANAGER_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/dynarray.h"
#include "wx/gdicmn.h"
#include "wx/window.h"
#include "wx/timer.h"
#include "wx/sizer.h"
#include "wx/bmpbndl.h"
#include "wx/overlay.h"
enum wxAuiManagerDock
{
wxAUI_DOCK_NONE = 0,
wxAUI_DOCK_TOP = 1,
wxAUI_DOCK_RIGHT = 2,
wxAUI_DOCK_BOTTOM = 3,
wxAUI_DOCK_LEFT = 4,
wxAUI_DOCK_CENTER = 5,
wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
};
enum wxAuiManagerOption
{
wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4,
wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
wxAUI_MGR_HINT_FADE = 1 << 6,
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 0, // For compatibility only.
wxAUI_MGR_LIVE_RESIZE = 1 << 8,
wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_LIVE_RESIZE
};
enum wxAuiPaneDockArtSetting
{
wxAUI_DOCKART_SASH_SIZE = 0,
wxAUI_DOCKART_CAPTION_SIZE = 1,
wxAUI_DOCKART_GRIPPER_SIZE = 2,
wxAUI_DOCKART_PANE_BORDER_SIZE = 3,
wxAUI_DOCKART_PANE_BUTTON_SIZE = 4,
wxAUI_DOCKART_BACKGROUND_COLOUR = 5,
wxAUI_DOCKART_SASH_COLOUR = 6,
wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR = 7,
wxAUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8,
wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR = 9,
wxAUI_DOCKART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10,
wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR = 11,
wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR = 12,
wxAUI_DOCKART_BORDER_COLOUR = 13,
wxAUI_DOCKART_GRIPPER_COLOUR = 14,
wxAUI_DOCKART_CAPTION_FONT = 15,
wxAUI_DOCKART_GRADIENT_TYPE = 16
};
enum wxAuiPaneDockArtGradients
{
wxAUI_GRADIENT_NONE = 0,
wxAUI_GRADIENT_VERTICAL = 1,
wxAUI_GRADIENT_HORIZONTAL = 2
};
enum wxAuiPaneButtonState
{
wxAUI_BUTTON_STATE_NORMAL = 0,
wxAUI_BUTTON_STATE_HOVER = 1 << 1,
wxAUI_BUTTON_STATE_PRESSED = 1 << 2,
wxAUI_BUTTON_STATE_DISABLED = 1 << 3,
wxAUI_BUTTON_STATE_HIDDEN = 1 << 4,
wxAUI_BUTTON_STATE_CHECKED = 1 << 5
};
enum wxAuiButtonId
{
wxAUI_BUTTON_CLOSE = 101,
wxAUI_BUTTON_MAXIMIZE_RESTORE = 102,
wxAUI_BUTTON_MINIMIZE = 103,
wxAUI_BUTTON_PIN = 104,
wxAUI_BUTTON_OPTIONS = 105,
wxAUI_BUTTON_WINDOWLIST = 106,
wxAUI_BUTTON_LEFT = 107,
wxAUI_BUTTON_RIGHT = 108,
wxAUI_BUTTON_UP = 109,
wxAUI_BUTTON_DOWN = 110,
wxAUI_BUTTON_CUSTOM1 = 201,
wxAUI_BUTTON_CUSTOM2 = 202,
wxAUI_BUTTON_CUSTOM3 = 203
};
enum wxAuiPaneInsertLevel
{
wxAUI_INSERT_PANE = 0,
wxAUI_INSERT_ROW = 1,
wxAUI_INSERT_DOCK = 2
};
// forwards and array declarations
class wxAuiDockUIPart;
class wxAuiPaneInfo;
class wxAuiDockInfo;
class wxAuiDockArt;
class wxAuiManagerEvent;
class wxAuiSerializer;
class wxAuiDeserializer;
struct wxAuiDockLayoutInfo;
struct wxAuiPaneLayoutInfo;
using wxAuiDockUIPartArray = wxBaseArray<wxAuiDockUIPart>;
using wxAuiDockInfoArray = wxBaseArray<wxAuiDockInfo>;
using wxAuiDockInfoPtrArray = wxBaseArray<wxAuiDockInfo*>;
using wxAuiPaneInfoPtrArray = wxBaseArray<wxAuiPaneInfo*>;
extern WXDLLIMPEXP_AUI wxAuiDockInfo wxAuiNullDockInfo;
extern WXDLLIMPEXP_AUI wxAuiPaneInfo wxAuiNullPaneInfo;
class WXDLLIMPEXP_AUI wxAuiPaneInfo
{
public:
wxAuiPaneInfo()
: best_size(wxDefaultSize)
, min_size(wxDefaultSize)
, max_size(wxDefaultSize)
, floating_pos(wxDefaultPosition)
, floating_size(wxDefaultSize)
, floating_client_size(wxDefaultSize)
{
window = nullptr;
frame = nullptr;
state = 0;
dock_direction = wxAUI_DOCK_LEFT;
dock_layer = 0;
dock_row = 0;
dock_pos = 0;
dock_size = 0;
dock_proportion = 0;
DefaultPane();
}
~wxAuiPaneInfo() = default;
// Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
// used on loading perspectives etc.
void SafeSet(wxAuiPaneInfo source)
{
// note source is not passed by reference so we can overwrite, to keep the
// unsafe bits of "dest"
source.window = window;
source.frame = frame;
wxCHECK_RET(source.IsValid(),
"window settings and pane settings are incompatible");
// now assign
*this = source;
}
bool IsOk() const { return window != nullptr; }
bool IsFixed() const { return !HasFlag(optionResizable); }
bool IsResizable() const { return HasFlag(optionResizable); }
bool IsShown() const { return !HasFlag(optionHidden); }
bool IsFloating() const { return HasFlag(optionFloating); }
bool IsDocked() const { return !HasFlag(optionFloating); }
bool IsToolbar() const { return HasFlag(optionToolbar); }
bool IsTopDockable() const { return HasFlag(optionTopDockable); }
bool IsBottomDockable() const { return HasFlag(optionBottomDockable); }
bool IsLeftDockable() const { return HasFlag(optionLeftDockable); }
bool IsRightDockable() const { return HasFlag(optionRightDockable); }
bool IsDockable() const
{
return HasFlag(optionTopDockable | optionBottomDockable |
optionLeftDockable | optionRightDockable);
}
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); }
bool HasCloseButton() const { return HasFlag(buttonClose); }
bool HasMaximizeButton() const { return HasFlag(buttonMaximize); }
bool HasMinimizeButton() const { return HasFlag(buttonMinimize); }
bool HasPinButton() const { return HasFlag(buttonPin); }
bool HasGripperTop() const { return HasFlag(optionGripperTop); }
#ifdef SWIG
%typemap(out) wxAuiPaneInfo& { $result = $self; Py_INCREF($result); }
#endif
wxAuiPaneInfo& Window(wxWindow* w)
{
wxAuiPaneInfo test(*this);
test.window = w;
wxCHECK_MSG(test.IsValid(), *this,
"window settings and pane settings are incompatible");
*this = test;
return *this;
}
wxAuiPaneInfo& Name(const wxString& n) { name = n; return *this; }
wxAuiPaneInfo& Caption(const wxString& c) { caption = c; return *this; }
wxAuiPaneInfo& Icon(const wxBitmapBundle& b) { icon = b; return *this; }
wxAuiPaneInfo& Left() { dock_direction = wxAUI_DOCK_LEFT; return *this; }
wxAuiPaneInfo& Right() { dock_direction = wxAUI_DOCK_RIGHT; return *this; }
wxAuiPaneInfo& Top() { dock_direction = wxAUI_DOCK_TOP; return *this; }
wxAuiPaneInfo& Bottom() { dock_direction = wxAUI_DOCK_BOTTOM; return *this; }
wxAuiPaneInfo& Center() { dock_direction = wxAUI_DOCK_CENTER; return *this; }
wxAuiPaneInfo& Centre() { dock_direction = wxAUI_DOCK_CENTRE; return *this; }
wxAuiPaneInfo& Direction(int direction) { dock_direction = direction; return *this; }
wxAuiPaneInfo& Layer(int layer) { dock_layer = layer; return *this; }
wxAuiPaneInfo& Row(int row) { dock_row = row; return *this; }
wxAuiPaneInfo& Position(int pos) { dock_pos = pos; return *this; }
wxAuiPaneInfo& BestSize(const wxSize& size) { best_size = size; return *this; }
wxAuiPaneInfo& MinSize(const wxSize& size) { min_size = size; return *this; }
wxAuiPaneInfo& MaxSize(const wxSize& size) { max_size = size; return *this; }
wxAuiPaneInfo& BestSize(int x, int y) { best_size.Set(x,y); return *this; }
wxAuiPaneInfo& MinSize(int x, int y) { min_size.Set(x,y); return *this; }
wxAuiPaneInfo& MaxSize(int x, int y) { max_size.Set(x,y); return *this; }
wxAuiPaneInfo& FloatingPosition(const wxPoint& pos) { floating_pos = pos; return *this; }
wxAuiPaneInfo& FloatingPosition(int x, int y) { floating_pos.x = x; floating_pos.y = y; return *this; }
wxAuiPaneInfo& FloatingSize(const wxSize& size) { floating_size = size; return *this; }
wxAuiPaneInfo& FloatingSize(int x, int y) { floating_size.Set(x,y); return *this; }
wxAuiPaneInfo& FloatingClientSize(const wxSize& size) { floating_client_size = size; return *this; }
wxAuiPaneInfo& FloatingClientSize(int x, int y) { floating_client_size.Set(x,y); return *this; }
wxAuiPaneInfo& Fixed() { return SetFlag(optionResizable, false); }
wxAuiPaneInfo& Resizable(bool resizable = true) { return SetFlag(optionResizable, resizable); }
wxAuiPaneInfo& Dock() { return SetFlag(optionFloating, false); }
wxAuiPaneInfo& Float() { return SetFlag(optionFloating, true); }
wxAuiPaneInfo& Hide() { return SetFlag(optionHidden, true); }
wxAuiPaneInfo& Show(bool show = true) { return SetFlag(optionHidden, !show); }
wxAuiPaneInfo& CaptionVisible(bool visible = true) { return SetFlag(optionCaption, visible); }
wxAuiPaneInfo& Maximize() { return SetFlag(optionMaximized, true); }
wxAuiPaneInfo& Restore() { return SetFlag(optionMaximized, false); }
wxAuiPaneInfo& PaneBorder(bool visible = true) { return SetFlag(optionPaneBorder, visible); }
wxAuiPaneInfo& Gripper(bool visible = true) { return SetFlag(optionGripper, visible); }
wxAuiPaneInfo& GripperTop(bool attop = true) { return SetFlag(optionGripperTop, attop); }
wxAuiPaneInfo& CloseButton(bool visible = true) { return SetFlag(buttonClose, visible); }
wxAuiPaneInfo& MaximizeButton(bool visible = true) { return SetFlag(buttonMaximize, visible); }
wxAuiPaneInfo& MinimizeButton(bool visible = true) { return SetFlag(buttonMinimize, visible); }
wxAuiPaneInfo& PinButton(bool visible = true) { return SetFlag(buttonPin, visible); }
wxAuiPaneInfo& DestroyOnClose(bool b = true) { return SetFlag(optionDestroyOnClose, b); }
wxAuiPaneInfo& TopDockable(bool b = true) { return SetFlag(optionTopDockable, b); }
wxAuiPaneInfo& BottomDockable(bool b = true) { return SetFlag(optionBottomDockable, b); }
wxAuiPaneInfo& LeftDockable(bool b = true) { return SetFlag(optionLeftDockable, b); }
wxAuiPaneInfo& RightDockable(bool b = true) { return SetFlag(optionRightDockable, b); }
wxAuiPaneInfo& Floatable(bool b = true) { return SetFlag(optionFloatable, b); }
wxAuiPaneInfo& Movable(bool b = true) { return SetFlag(optionMovable, b); }
wxAuiPaneInfo& DockFixed(bool b = true) { return SetFlag(optionDockFixed, b); }
wxAuiPaneInfo& Dockable(bool b = true)
{
return TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b);
}
wxAuiPaneInfo& DefaultPane()
{
wxAuiPaneInfo test(*this);
test.state |= optionTopDockable | optionBottomDockable |
optionLeftDockable | optionRightDockable |
optionFloatable | optionMovable | optionResizable |
optionCaption | optionPaneBorder | buttonClose;
wxCHECK_MSG(test.IsValid(), *this,
"window settings and pane settings are incompatible");
*this = test;
return *this;
}
wxAuiPaneInfo& CentrePane() { return CenterPane(); }
wxAuiPaneInfo& CenterPane()
{
state = 0;
return Center().PaneBorder().Resizable();
}
wxAuiPaneInfo& ToolbarPane()
{
DefaultPane();
state |= (optionToolbar | optionGripper);
state &= ~(optionResizable | optionCaption);
if (dock_layer == 0)
dock_layer = 10;
return *this;
}
wxAuiPaneInfo& SetFlag(int flag, bool option_state)
{
wxAuiPaneInfo test(*this);
if (option_state)
test.state |= flag;
else
test.state &= ~flag;
wxCHECK_MSG(test.IsValid(), *this,
"window settings and pane settings are incompatible");
*this = test;
return *this;
}
bool HasFlag(int flag) const
{
return (state & flag) != 0;
}
#ifdef SWIG
%typemap(out) wxAuiPaneInfo& ;
#endif
public:
// NOTE: You can add and subtract flags from this list,
// but do not change the values of the flags, because
// they are stored in a binary integer format in the
// perspective string. If you really need to change the
// values around, you'll have to ensure backwards-compatibility
// in the perspective loading code.
enum wxAuiPaneState
{
optionFloating = 1 << 0,
optionHidden = 1 << 1,
optionLeftDockable = 1 << 2,
optionRightDockable = 1 << 3,
optionTopDockable = 1 << 4,
optionBottomDockable = 1 << 5,
optionFloatable = 1 << 6,
optionMovable = 1 << 7,
optionResizable = 1 << 8,
optionPaneBorder = 1 << 9,
optionCaption = 1 << 10,
optionGripper = 1 << 11,
optionDestroyOnClose = 1 << 12,
optionToolbar = 1 << 13,
optionActive = 1 << 14,
optionGripperTop = 1 << 15,
optionMaximized = 1 << 16,
optionDockFixed = 1 << 17,
buttonClose = 1 << 21,
buttonMaximize = 1 << 22,
buttonMinimize = 1 << 23,
buttonPin = 1 << 24,
buttonCustom1 = 1 << 26,
buttonCustom2 = 1 << 27,
buttonCustom3 = 1 << 28,
savedHiddenState = 1 << 30, // used internally
actionPane = 1u << 31 // used internally
};
public:
wxString name; // name of the pane
wxString caption; // caption displayed on the window
wxBitmapBundle icon; // icon of the pane, may be invalid
wxWindow* window; // window that is in this pane
wxFrame* frame; // floating frame window that holds the pane
unsigned int state; // a combination of wxPaneState values
int dock_direction; // dock direction (top, bottom, left, right, center)
int dock_layer; // layer number (0 = innermost layer)
int dock_row; // row number on the docking bar (0 = first row)
int dock_pos; // position inside the row (0 = first position)
int dock_size; // size of the containing dock (0 if not set)
wxSize best_size; // size that the layout engine will prefer
wxSize min_size; // minimum size the pane window can tolerate
wxSize max_size; // maximum size the pane window can tolerate
wxPoint floating_pos; // position while floating
wxSize floating_size; // size while floating
// this has precedence over floating_size
wxSize floating_client_size; // client size while floating
int dock_proportion; // proportion while docked
wxRect rect; // current rectangle (populated by wxAUI)
bool IsValid() const;
};
// Note that this one must remain a wxBaseObjectArray, i.e. store pointers to
// heap-allocated objects, as it is returned by wxAuiManager::GetPane() and the
// existing code expects these pointers to remain valid even if the array is
// modified.
using wxAuiPaneInfoArray = wxBaseObjectArray<wxAuiPaneInfo>;
class WXDLLIMPEXP_FWD_AUI wxAuiFloatingFrame;
class WXDLLIMPEXP_AUI wxAuiManager : public wxEvtHandler
{
friend class wxAuiFloatingFrame;
public:
wxAuiManager(wxWindow* managedWnd = nullptr,
unsigned int flags = wxAUI_MGR_DEFAULT);
virtual ~wxAuiManager();
void UnInit();
void SetFlags(unsigned int flags);
unsigned int GetFlags() const;
static bool AlwaysUsesLiveResize(const wxWindow* window = nullptr);
bool HasLiveResize() const;
void SetManagedWindow(wxWindow* managedWnd);
wxWindow* GetManagedWindow() const;
static wxAuiManager* GetManager(wxWindow* window);
void SetArtProvider(wxAuiDockArt* artProvider);
wxAuiDockArt* GetArtProvider() const;
wxAuiPaneInfo& GetPane(wxWindow* window);
wxAuiPaneInfo& GetPane(const wxString& name);
const wxAuiPaneInfoArray& GetAllPanes() const { return m_panes; }
wxAuiPaneInfoArray& GetAllPanes() { return m_panes; }
bool AddPane(wxWindow* window,
const wxAuiPaneInfo& paneInfo);
bool AddPane(wxWindow* window,
const wxAuiPaneInfo& paneInfo,
const wxPoint& dropPos);
bool AddPane(wxWindow* window,
int direction = wxLEFT,
const wxString& caption = wxEmptyString);
bool InsertPane(wxWindow* window,
const wxAuiPaneInfo& insertLocation,
int insertLevel = wxAUI_INSERT_PANE);
bool DetachPane(wxWindow* window);
void Update();
// Serialize or restore the whole layout using the provided serializer.
void SaveLayout(wxAuiSerializer& serializer) const;
void LoadLayout(wxAuiDeserializer& deserializer);
// Older functions using bespoke text format, prefer using the ones using
// wxAuiSerializer and wxAuiDeserializer above instead in the new code.
wxString SavePaneInfo(const wxAuiPaneInfo& pane);
void LoadPaneInfo(wxString panePart, wxAuiPaneInfo &pane);
private:
bool LoadPaneInfoVersioned(wxString layoutVersion, wxString panePart, wxAuiPaneInfo& pane);
public:
wxString SavePerspective();
bool LoadPerspective(const wxString& perspective, bool update = true);
void SetDockSizeConstraint(double widthPct, double heightPct);
void GetDockSizeConstraint(double* widthPct, double* heightPct) const;
void ClosePane(wxAuiPaneInfo& paneInfo);
void MaximizePane(wxAuiPaneInfo& paneInfo);
void RestorePane(wxAuiPaneInfo& paneInfo);
void RestoreMaximizedPane();
public:
virtual wxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
virtual bool CanDockPanel(const wxAuiPaneInfo & p);
void StartPaneDrag(
wxWindow* paneWindow,
const wxPoint& offset);
wxRect CalculateHintRect(
wxWindow* paneWindow,
const wxPoint& pt,
const wxPoint& offset = wxPoint{});
void DrawHintRect(
wxWindow* paneWindow,
const wxPoint& pt,
const wxPoint& offset = wxPoint{});
void UpdateHint(const wxRect& rect);
// These functions are public for compatibility reasons, but should never
// be called directly, use UpdateHint() above instead.
virtual void ShowHint(const wxRect& rect);
virtual void HideHint();
// Internal functions, don't use them outside of wxWidgets itself.
void CopyDockLayoutFrom(wxAuiDockLayoutInfo& layoutInfo,
const wxAuiPaneInfo& pane) const;
void CopyDockLayoutTo(const wxAuiDockLayoutInfo& layoutInfo,
wxAuiPaneInfo& pane) const;
void CopyLayoutFrom(wxAuiPaneLayoutInfo& layoutInfo,
const wxAuiPaneInfo& pane) const;
void CopyLayoutTo(const wxAuiPaneLayoutInfo& layoutInfo,
wxAuiPaneInfo& pane) const;
public:
// deprecated -- please use SetManagedWindow()
// and GetManagedWindow() instead
wxDEPRECATED( void SetFrame(wxFrame* frame) );
wxDEPRECATED( wxFrame* GetFrame() const );
protected:
void DoFrameLayout();
void LayoutAddPane(wxSizer* container,
wxAuiDockInfo& dock,
wxAuiPaneInfo& pane,
wxAuiDockUIPartArray& uiparts,
bool spacerOnly);
void LayoutAddDock(wxSizer* container,
wxAuiDockInfo& dock,
wxAuiDockUIPartArray& uiParts,
bool spacerOnly);
wxSizer* LayoutAll(wxAuiPaneInfoArray& panes,
wxAuiDockInfoArray& docks,
wxAuiDockUIPartArray & uiParts,
bool spacerOnly = false);
virtual bool ProcessDockResult(wxAuiPaneInfo& target,
const wxAuiPaneInfo& newPos);
bool DoDrop(wxAuiDockInfoArray& docks,
wxAuiPaneInfoArray& panes,
wxAuiPaneInfo& drop,
const wxPoint& pt,
const wxPoint& actionOffset = wxPoint(0,0));
wxAuiDockUIPart* HitTest(int x, int y);
wxAuiDockUIPart* GetPanePart(wxWindow* pane);
int GetDockPixelOffset(wxAuiPaneInfo& test);
void OnFloatingPaneMoveStart(wxWindow* window);
void OnFloatingPaneMoving(wxWindow* window, wxDirection dir );
void OnFloatingPaneMoved(wxWindow* window, wxDirection dir);
void OnFloatingPaneActivated(wxWindow* window);
void OnFloatingPaneClosed(wxWindow* window, wxCloseEvent& evt);
void OnFloatingPaneResized(wxWindow* window, const wxRect& rect);
void Render(wxDC* dc);
void Repaint(wxDC* dc = nullptr);
void ProcessMgrEvent(wxAuiManagerEvent& event);
void UpdateButtonOnScreen(wxAuiDockUIPart* buttonUiPart,
const wxMouseEvent& event);
void GetPanePositionsAndSizes(wxAuiDockInfo& dock,
wxArrayInt& positions,
wxArrayInt& sizes);
/// Ends a resize action, or for live update, resizes the sash
bool DoEndResizeAction(wxMouseEvent& event);
void SetActivePane(wxWindow* active_pane);
public:
// public events (which can be invoked externally)
void OnRender(wxAuiManagerEvent& evt);
void OnPaneButton(wxAuiManagerEvent& evt);
protected:
// protected events
void OnDestroy(wxWindowDestroyEvent& evt);
void OnPaint(wxPaintEvent& evt);
void OnEraseBackground(wxEraseEvent& evt);
void OnSize(wxSizeEvent& evt);
void OnSetCursor(wxSetCursorEvent& evt);
void OnLeftDown(wxMouseEvent& evt);
void OnLeftUp(wxMouseEvent& evt);
void OnMotion(wxMouseEvent& evt);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnLeaveWindow(wxMouseEvent& evt);
void OnChildFocus(wxChildFocusEvent& evt);
void OnHintFadeTimer(wxTimerEvent& evt);
void OnFindManager(wxAuiManagerEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
enum
{
actionNone = 0,
actionResize,
actionClickButton,
actionClickCaption,
actionDragToolbarPane,
actionDragFloatingPane
};
protected:
wxWindow* m_frame; // the window being managed
wxAuiDockArt* m_art; // dock art object which does all drawing
unsigned int m_flags; // manager flags wxAUI_MGR_*
wxAuiPaneInfoArray m_panes; // array of panes structures
wxAuiDockInfoArray m_docks; // array of docks structures
wxAuiDockUIPartArray m_uiParts; // array of UI parts (captions, buttons, etc)
int m_action; // current mouse action
wxPoint m_actionStart; // position where the action click started
wxPoint m_actionOffset; // offset from upper left of the item clicked
wxAuiDockUIPart* m_actionPart; // ptr to the part the action happened to
wxWindow* m_actionWindow; // action frame or window (nullptr if none)
wxRect m_actionHintRect; // hint rectangle for the action
wxRect m_lastRect;
wxAuiDockUIPart* m_hoverButton;// button uipart being hovered over
wxRect m_lastHint; // last hint rectangle
wxPoint m_lastMouseMove; // last mouse move position (see OnMotion)
int m_currentDragItem;
bool m_hasMaximized;
double m_dockConstraintX; // 0.0 .. 1.0; max pct of window width a dock can consume
double m_dockConstraintY; // 0.0 .. 1.0; max pct of window height a dock can consume
wxTimer m_hintFadeTimer; // transparent fade timer
wxByte m_hintFadeAmt; // transparent fade amount
wxByte m_hintFadeMax; // maximum value of hint fade
wxOverlay m_overlay;
void* m_reserved;
private:
// Return the index in m_uiParts corresponding to the current value of
// m_actionPart. If m_actionPart is null, returns wxNOT_FOUND.
int GetActionPartIndex() const;
// This flag is set to true if Update() is called while the window is
// minimized, in which case we postpone updating it until it is restored.
bool m_updateOnRestore = false;
#ifndef SWIG
wxDECLARE_CLASS(wxAuiManager);
#endif // SWIG
};
// event declarations/classes
class WXDLLIMPEXP_AUI wxAuiManagerEvent : public wxEvent
{
public:
wxAuiManagerEvent(wxEventType type=wxEVT_NULL) : wxEvent(0, type)
{
manager = nullptr;
pane = nullptr;
button = 0;
veto_flag = false;
canveto_flag = true;
dc = nullptr;
}
wxNODISCARD wxEvent *Clone() const override { return new wxAuiManagerEvent(*this); }
void SetManager(wxAuiManager* mgr) { manager = mgr; }
void SetPane(wxAuiPaneInfo* p) { pane = p; }
void SetButton(int b) { button = b; }
void SetDC(wxDC* pdc) { dc = pdc; }
wxAuiManager* GetManager() const { return manager; }
wxAuiPaneInfo* GetPane() const { return pane; }
int GetButton() const { return button; }
wxDC* GetDC() const { return dc; }
void Veto(bool veto = true) { veto_flag = veto; }
bool GetVeto() const { return veto_flag; }
void SetCanVeto(bool can_veto) { canveto_flag = can_veto; }
bool CanVeto() const { return canveto_flag && veto_flag; }
public:
wxAuiManager* manager;
wxAuiPaneInfo* pane;
int button;
bool veto_flag;
bool canveto_flag;
wxDC* dc;
#ifndef SWIG
private:
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY(wxAuiManagerEvent);
#endif
};
class WXDLLIMPEXP_AUI wxAuiDockInfo
{
public:
wxAuiDockInfo()
{
dock_direction = 0;
dock_layer = 0;
dock_row = 0;
size = 0;
min_size = 0;
resizable = true;
fixed = false;
toolbar = false;
reserved1 = false;
}
bool IsOk() const { return dock_direction != 0; }
bool IsHorizontal() const { return dock_direction == wxAUI_DOCK_TOP ||
dock_direction == wxAUI_DOCK_BOTTOM; }
bool IsVertical() const { return dock_direction == wxAUI_DOCK_LEFT ||
dock_direction == wxAUI_DOCK_RIGHT ||
dock_direction == wxAUI_DOCK_CENTER; }
public:
wxAuiPaneInfoPtrArray panes; // array of panes
wxRect rect; // current rectangle
int dock_direction; // dock direction (top, bottom, left, right, center)
int dock_layer; // layer number (0 = innermost layer)
int dock_row; // row number on the docking bar (0 = first row)
int size; // size of the dock
int min_size; // minimum size of a dock (0 if there is no min)
bool resizable; // flag indicating whether the dock is resizable
bool toolbar; // flag indicating dock contains only toolbars
bool fixed; // flag indicating that the dock operates on
// absolute coordinates as opposed to proportional
bool reserved1;
};
class WXDLLIMPEXP_AUI wxAuiDockUIPart
{
public:
enum
{
typeCaption,
typeGripper,
typeDock,
typeDockSizer,
typePane,
typePaneSizer,
typeBackground,
typePaneBorder,
typePaneButton
};
int type; // ui part type (see enum above)
int orientation; // orientation (either wxHORIZONTAL or wxVERTICAL)
wxAuiDockInfo* dock; // which dock the item is associated with
wxAuiPaneInfo* pane; // which pane the item is associated with
int button; // which pane button the item is associated with
wxSizer* cont_sizer; // the part's containing sizer
wxSizerItem* sizer_item; // the sizer item of the part
wxRect rect; // client coord rectangle of the part itself
};
#ifndef SWIG
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_RENDER, wxAuiManagerEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_AUI, wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent );
typedef void (wxEvtHandler::*wxAuiManagerEventFunction)(wxAuiManagerEvent&);
#define wxAuiManagerEventHandler(func) \
wxEVENT_HANDLER_CAST(wxAuiManagerEventFunction, func)
#define EVT_AUI_PANE_BUTTON(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANE_BUTTON, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_CLOSE(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_MAXIMIZE(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_RESTORE(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANE_RESTORE, wxAuiManagerEventHandler(func))
#define EVT_AUI_PANE_ACTIVATED(func) \
wx__DECLARE_EVT0(wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEventHandler(func))
#define EVT_AUI_RENDER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_RENDER, wxAuiManagerEventHandler(func))
#define EVT_AUI_FIND_MANAGER(func) \
wx__DECLARE_EVT0(wxEVT_AUI_FIND_MANAGER, wxAuiManagerEventHandler(func))
#else
%constant wxEventType wxEVT_AUI_PANE_BUTTON;
%constant wxEventType wxEVT_AUI_PANE_CLOSE;
%constant wxEventType wxEVT_AUI_PANE_MAXIMIZE;
%constant wxEventType wxEVT_AUI_PANE_RESTORE;
%constant wxEventType wxEVT_AUI_PANE_ACTIVATED;
%constant wxEventType wxEVT_AUI_RENDER;
%constant wxEventType wxEVT_AUI_FIND_MANAGER;
%pythoncode {
EVT_AUI_PANE_BUTTON = wx.PyEventBinder( wxEVT_AUI_PANE_BUTTON )
EVT_AUI_PANE_CLOSE = wx.PyEventBinder( wxEVT_AUI_PANE_CLOSE )
EVT_AUI_PANE_MAXIMIZE = wx.PyEventBinder( wxEVT_AUI_PANE_MAXIMIZE )
EVT_AUI_PANE_RESTORE = wx.PyEventBinder( wxEVT_AUI_PANE_RESTORE )
EVT_AUI_PANE_ACTIVATED = wx.PyEventBinder( wxEVT_AUI_PANE_ACTIVATED )
EVT_AUI_RENDER = wx.PyEventBinder( wxEVT_AUI_RENDER )
EVT_AUI_FIND_MANAGER = wx.PyEventBinder( wxEVT_AUI_FIND_MANAGER )
}
#endif // SWIG
#endif // wxUSE_AUI
#endif //_WX_FRAMEMANAGER_H_

View File

@@ -0,0 +1,241 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/serializer.h
// Purpose: Declaration of wxAuiSerializer and wxAuiDeserializer classes.
// Author: Vadim Zeitlin
// Created: 2024-01-20
// Copyright: (c) 2024 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_SERIALIZER_H_
#define _WX_AUI_SERIALIZER_H_
#include "wx/aui/framemanager.h" // Just for wxAUI_DOCK_LEFT
#if wxUSE_AUI
#include <utility>
#include <vector>
class WXDLLIMPEXP_FWD_AUI wxAuiNotebook;
class WXDLLIMPEXP_FWD_AUI wxAuiTabCtrl;
// ----------------------------------------------------------------------------
// Classes used to save/load wxAuiManager layout.
// ----------------------------------------------------------------------------
// Fields common to wxAuiPaneLayoutInfo and wxAuiTabLayoutInfo containing
// information about a docked pane or tab layout.
struct wxAuiDockLayoutInfo
{
// Identifies the dock containing the pane.
int dock_direction = wxAUI_DOCK_LEFT;
int dock_layer = 0;
int dock_row = 0;
int dock_pos = 0;
int dock_proportion = 0;
// Size of the containing dock.
//
// Note that storing the dock size is redundant as it can be calculated
// from pane sizes, but storing all pane sizes would be redundant too, so
// we prefer to keep things simple and store just this size.
int dock_size = 0;
};
// This struct contains information about the layout of a tab control in a
// wxAuiNotebook, including where it is docked and the order of pages in it.
struct wxAuiTabLayoutInfo : wxAuiDockLayoutInfo
{
// If this vector is empty, it means that the tab control contains all
// notebook pages in natural order.
std::vector<int> pages;
// Vectors contain indices of pinned pages, if any, i.e. it can be empty.
std::vector<int> pinned;
// Currently active page in this tab control.
int active = 0;
};
// This struct contains the pane name and information about its layout that can
// be manipulated by the user interactively.
struct wxAuiPaneLayoutInfo : wxAuiDockLayoutInfo
{
// Ctor sets the name, which is always required.
explicit wxAuiPaneLayoutInfo(wxString name_) : name{std::move(name_)} { }
// Unique name of the pane.
wxString name;
// Floating pane geometry, may be invalid.
wxPoint floating_pos = wxDefaultPosition;
wxSize floating_size = wxDefaultSize;
wxSize floating_client_size = wxDefaultSize;
// The remaining fields correspond to individual bits of the pane state
// flags instead of corresponding to wxAuiPaneInfo fields directly because
// we prefer not storing the entire state -- this would be less readable
// and extensible.
// True if the pane is currently maximized.
bool is_maximized = false;
// True if the pane is currently hidden.
bool is_hidden = false;
};
// wxAuiBookSerializer is used for serializing wxAuiNotebook layout.
//
// This includes the tab controls layout and the order of pages in them.
//
// It can be used standalone with wxAuiNotebook::SaveLayout() or as base class
// of wxAuiSerializer for saving and restoring the entire layout.
class wxAuiBookSerializer
{
public:
// Trivial default ctor.
wxAuiBookSerializer() = default;
// Trivial but virtual dtor for a base class.
virtual ~wxAuiBookSerializer() = default;
// Called before starting to save information about the tabs in the
// notebook in the AUI pane with the given name.
virtual void BeforeSaveNotebook(const wxString& name) = 0;
// Called to save information about a single tab control in the given
// notebook.
virtual void SaveNotebookTabControl(const wxAuiTabLayoutInfo& tab) = 0;
// Called after saving information about all the pages of the notebook in
// the AUI pane with the given name, does nothing by default.
virtual void AfterSaveNotebook() { }
};
// wxAuiSerializer is used with wxAuiManager::SaveLayout().
//
// This is an abstract base class, you need to inherit from it and override its
// pure virtual functions, including those inherited from wxAuiBookSerializer,
// in your derived class.
//
// If any of the functions of the derived class throw an exception, it is
// propagated out of wxAuiManager::SaveLayout() and it's callers responsibility
// to handle it.
class wxAuiSerializer : public wxAuiBookSerializer
{
public:
// Trivial default ctor.
wxAuiSerializer() = default;
// Called before doing anything else, does nothing by default.
virtual void BeforeSave() { }
// Called before starting to save information about the panes, does nothing
// by default.
virtual void BeforeSavePanes() { }
// Save information about the given pane.
virtual void SavePane(const wxAuiPaneLayoutInfo& pane) = 0;
// Called after the last call to SavePane(), does nothing by default.
virtual void AfterSavePanes() { }
// Called before starting to save information about the notebooks, does
// nothing by default.
virtual void BeforeSaveNotebooks() { }
// Called after the last call to SaveNotebook(), does nothing by default.
virtual void AfterSaveNotebooks() { }
// Called after saving everything, does nothing by default.
virtual void AfterSave() { }
};
// wxAuiBookDeserializer is used for deserializing wxAuiNotebook layout.
//
// Similarly to wxAuiBookSerializer, it can be used standalone with
// wxAuiNotebook::LoadLayout() or as base class of wxAuiDeserializer.
class wxAuiBookDeserializer
{
public:
// Trivial default ctor.
wxAuiBookDeserializer() = default;
// Trivial but virtual dtor for a base class.
virtual ~wxAuiBookDeserializer() = default;
// Load information about all the tab controls in the pane containing
// wxAuiNotebook with the given name.
virtual std::vector<wxAuiTabLayoutInfo>
LoadNotebookTabs(const wxString& name) = 0;
// If any pages haven't been assigned to any tab control after restoring
// the pages order, they are passed to this function to determine what to
// do with them.
//
// By default, it returns true without modifying the output arguments,
// which results in the page being appended to the main tab control. It may
// also modify tabCtrl and tabIndex arguments to modify where the page
// should appear or return false to remove the page from the notebook
// completely.
virtual bool
HandleOrphanedPage(wxAuiNotebook& WXUNUSED(book),
int WXUNUSED(page),
wxAuiTabCtrl** WXUNUSED(tabCtrl),
int* WXUNUSED(tabIndex))
{ return true; }
};
// wxAuiDeserializer is used with wxAuiManager::LoadLayout().
//
// As wxAuiSerializer, this is an abstract base class, you need to inherit from
// it and override its pure virtual functions in your derived class.
//
// Derived class function also may throw and, if any of them other than
// AfterLoad() does, the existing layout is not changed, i.e.
// wxAuiManager::LoadLayout() is exception-safe.
class wxAuiDeserializer : public wxAuiBookDeserializer
{
public:
// Ctor takes the manager for which we're restoring the layout, it must
// remain valid for the lifetime of this object.
explicit wxAuiDeserializer(wxAuiManager& manager) : m_manager(manager) { }
// Called before doing anything else, does nothing by default.
virtual void BeforeLoad() { }
// Load information about all the panes previously saved with SavePane().
virtual std::vector<wxAuiPaneLayoutInfo> LoadPanes() = 0;
// Create the window to be managed by the given pane: this is called if any
// of the panes returned by LoadPanes() doesn't exist in the existing
// layout and allows to create windows on the fly.
//
// If this function returns nullptr, the pane is not added to the manager.
//
// Note that the pane info may (and usually will, if a window is created)
// be modified, to set fields such as caption or icon and any flags other
// "maximized".
virtual wxWindow* CreatePaneWindow(wxAuiPaneInfo& WXUNUSED(pane))
{
return nullptr;
}
// Called after restoring everything, calls Update() on the manager by
// default.
virtual void AfterLoad() { m_manager.Update(); }
protected:
// The manager for which we're restoring the layout.
wxAuiManager& m_manager;
};
#endif // wxUSE_AUI
#endif // _WX_AUI_SERIALIZER_H_

View File

@@ -0,0 +1,481 @@
//////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/tabart.h
// Purpose: wxaui: wx advanced user interface - notebook
// Author: Benjamin I. Williams
// Modified by: Jens Lody (extracted from wx/aui/auibook.h)
// Created: 2012-03-21
// Copyright: (C) Copyright 2006, Kirix Corporation, All Rights Reserved.
// Licence: wxWindows Library Licence, Version 3.1
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_TABART_H_
#define _WX_AUI_TABART_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/colour.h"
#include "wx/gdicmn.h"
#include "wx/font.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/bmpbndl.h"
#include "wx/aui/framemanager.h" // wxAuiPaneButtonState and wxAuiButtonId
#include <vector>
class wxAuiNotebookPage;
class wxAuiNotebookPageArray;
class wxAuiTabContainerButton;
class wxWindow;
class wxDC;
class wxReadOnlyDC;
// tab art class
class WXDLLIMPEXP_AUI wxAuiTabArt
{
public:
wxAuiTabArt() = default;
virtual ~wxAuiTabArt() = default;
wxNODISCARD virtual wxAuiTabArt* Clone() = 0;
virtual void SetFlags(unsigned int flags) = 0;
virtual void SetSizingInfo(const wxSize& tabCtrlSize,
size_t tabCount,
wxWindow* wnd = nullptr) = 0;
virtual void SetNormalFont(const wxFont& font) = 0;
virtual void SetSelectedFont(const wxFont& font) = 0;
virtual void SetMeasuringFont(const wxFont& font) = 0;
virtual void SetColour(const wxColour& colour) = 0;
virtual void SetActiveColour(const wxColour& colour) = 0;
// These functions should be overridden in the derived class to return the
// actually used fonts, but they're not pure virtual for compatibility
// reasons.
virtual wxFont GetNormalFont() const { return wxFont{}; }
virtual wxFont GetSelectedFont() const { return wxFont{}; }
virtual void DrawBorder(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
// This function is not pure virtual for compatibility: if the derived
// class implements DrawTab(), then its default implementation is
// sufficient as long as pinned tabs are not used, but it must be
// overridden if the program does use them and it should be overridden
// instead of DrawTab() in the new code.
virtual int DrawPageTab(
wxDC& dc,
wxWindow* wnd,
wxAuiNotebookPage& page,
const wxRect& rect);
// Override DrawPageTab() in the new code rather than this one.
virtual void DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& inRect,
int closeButtonState,
wxRect* outTabRect,
wxRect* outButtonRect,
int* xExtent);
virtual void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect) = 0;
// This function relationship with GetTabSize() is similar as for DrawTab()
// and DrawPageTab(): this one should be overridden when pinned tabs are
// used, but doesn't have to be if they are not and GetTabSize() itself is
// overridden for compatibility with the existing code.
//
// It also allows to omit "xExtent" parameter if it is not needed.
virtual wxSize GetPageTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
int* xExtent = nullptr);
virtual wxSize GetTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmapBundle& bitmap,
bool active,
int closeButtonState,
int* xExtent);
// This function is not pure virtual because it is only for multi-line
// tabs, but it must be implemented if wxAUI_NB_MULTILINE is used.
//
// If specified, the returned rectangle must be filled with the same value
// as DrawButton() puts into its "outRect" but here it can also be null in
// which case just its width is returned.
virtual int GetButtonRect(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect = nullptr) /* = 0 */;
virtual int ShowDropDown(
wxWindow* wnd,
const wxAuiNotebookPageArray& items,
int activeIdx) = 0;
virtual int GetIndentSize() = 0;
virtual int GetBorderWidth(
wxWindow* wnd) = 0;
virtual int GetAdditionalBorderSpace(
wxWindow* wnd) = 0;
virtual int GetBestTabCtrlSize(
wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
virtual void UpdateDpi() {}
};
// Base, still abstract, class for the concrete tab art classes below.
class WXDLLIMPEXP_AUI wxAuiTabArtBase : public wxAuiTabArt
{
public:
void SetFlags(unsigned int flags) override;
void SetSizingInfo(const wxSize& tabCtrlSize,
size_t tabCount,
wxWindow* wnd = nullptr) override;
void SetNormalFont(const wxFont& font) override;
void SetSelectedFont(const wxFont& font) override;
void SetMeasuringFont(const wxFont& font) override;
wxFont GetNormalFont() const override;
wxFont GetSelectedFont() const override;
int GetButtonRect(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect) override;
void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect) override;
int ShowDropDown(
wxWindow* wnd,
const wxAuiNotebookPageArray& items,
int activeIdx) override;
int GetBorderWidth(
wxWindow* wnd) override;
int GetAdditionalBorderSpace(
wxWindow* wnd) override;
void DrawBorder(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
protected:
// Ctor is protected, this class is only used as a base class.
//
// Remember to call InitBitmaps() after setting up the colours in the
// derived class ctor.
wxAuiTabArtBase();
// Initialize the bitmaps using the colours returned by GetButtonColour().
void InitBitmaps();
// Return pointer to our bitmap bundle corresponding to the button ID and
// state or null if we don't support this button or if it is hidden.
const wxBitmapBundle*
GetButtonBitmapBundle(const wxAuiTabContainerButton& button) const;
// Helper function for DrawButton() and GetButtonRect().
bool DoGetButtonRectAndBitmap(
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect,
wxBitmap* outBitmap = nullptr);
// Note: all these fields are protected for compatibility reasons, but
// shouldn't be accessed directly.
wxFont m_normalFont;
wxFont m_selectedFont;
wxFont m_measuringFont;
wxBitmapBundle m_activeCloseBmp;
wxBitmapBundle m_disabledCloseBmp;
wxBitmapBundle m_activeLeftBmp;
wxBitmapBundle m_disabledLeftBmp;
wxBitmapBundle m_activeRightBmp;
wxBitmapBundle m_disabledRightBmp;
wxBitmapBundle m_activeWindowListBmp;
wxBitmapBundle m_disabledWindowListBmp;
wxBitmapBundle m_activePinBmp;
wxBitmapBundle m_disabledPinBmp;
wxBitmapBundle m_activeUnpinBmp;
wxBitmapBundle m_disabledUnpinBmp;
int m_fixedTabWidth;
int m_tabCtrlHeight; // Unused, kept only for compatibility.
unsigned int m_flags = 0;
private:
// This is called by InitBitmaps().
//
// The state parameter is currently always either wxAUI_BUTTON_STATE_NORMAL
// or wxAUI_BUTTON_STATE_DISABLED, but the function could be called with
// other values in the future.
virtual wxColour
GetButtonColour(wxAuiButtonId button, wxAuiPaneButtonState state) const = 0;
// This is called by DrawButton().
//
// By default just draws the bitmap using wxDC::DrawBitmap().
virtual void
DrawButtonBitmap(wxDC& dc,
const wxRect& rect,
const wxBitmap& bmp,
int buttonState);
};
// This tab art provider draws flat tabs with a thin border.
class WXDLLIMPEXP_AUI wxAuiFlatTabArt : public wxAuiTabArtBase
{
public:
wxAuiFlatTabArt();
virtual ~wxAuiFlatTabArt();
// Objects of this class are supposed to be used polymorphically, so
// copying them is not allowed, use Clone() instead.
wxAuiFlatTabArt(const wxAuiFlatTabArt&) = delete;
wxAuiFlatTabArt& operator=(const wxAuiFlatTabArt&) = delete;
wxNODISCARD wxAuiTabArt* Clone() override;
void SetColour(const wxColour& colour) override;
void SetActiveColour(const wxColour& colour) override;
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
int DrawPageTab(
wxDC& dc,
wxWindow* wnd,
wxAuiNotebookPage& page,
const wxRect& rect) override;
int GetIndentSize() override;
wxSize GetPageTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
int* xExtent = nullptr) override;
int GetBestTabCtrlSize(wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) override;
void UpdateColoursFromSystem() override;
private:
// Private pseudo-copy ctor used by Clone().
explicit wxAuiFlatTabArt(wxAuiFlatTabArt* other);
virtual wxColour
GetButtonColour(wxAuiButtonId button,
wxAuiPaneButtonState state) const override;
struct Data;
Data* const m_data;
};
class WXDLLIMPEXP_AUI wxAuiGenericTabArt : public wxAuiTabArtBase
{
public:
wxAuiGenericTabArt();
wxNODISCARD wxAuiTabArt* Clone() override;
void SetColour(const wxColour& colour) override;
void SetActiveColour(const wxColour& colour) override;
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
int DrawPageTab(
wxDC& dc,
wxWindow* wnd,
wxAuiNotebookPage& page,
const wxRect& rect) override;
int GetIndentSize() override;
wxSize GetPageTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
int* xExtent = nullptr) override;
int GetBestTabCtrlSize(wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) override;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() override;
protected:
wxColour m_baseColour;
wxPen m_baseColourPen;
wxPen m_borderPen;
wxBrush m_baseColourBrush;
wxColour m_activeColour;
private:
// Called from ctor and UpdateColoursFromSystem().
void InitColours();
virtual wxColour
GetButtonColour(wxAuiButtonId button,
wxAuiPaneButtonState state) const override;
};
class WXDLLIMPEXP_AUI wxAuiSimpleTabArt : public wxAuiTabArtBase
{
public:
wxAuiSimpleTabArt();
wxNODISCARD wxAuiTabArt* Clone() override;
void SetColour(const wxColour& colour) override;
void SetActiveColour(const wxColour& colour) override;
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
void DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& inRect,
int closeButtonState,
wxRect* outTabRect,
wxRect* outButtonRect,
int* xExtent) override;
int GetIndentSize() override;
wxSize GetTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmapBundle& bitmap,
bool active,
int closeButtonState,
int* xExtent) override;
int GetBestTabCtrlSize(wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) override;
protected:
wxPen m_normalBkPen;
wxPen m_selectedBkPen;
wxBrush m_normalBkBrush;
wxBrush m_selectedBkBrush;
wxBrush m_bkBrush;
private:
virtual wxColour
GetButtonColour(wxAuiButtonId button,
wxAuiPaneButtonState state) const override;
virtual void
DrawButtonBitmap(wxDC& dc,
const wxRect& rect,
const wxBitmap& bmp,
int buttonState) override;
};
#ifndef __WXUNIVERSAL__
#if defined(__WXGTK__) && !defined(__WXGTK3__)
#define wxHAS_NATIVE_TABART
#include "wx/aui/tabartgtk.h"
using wxAuiNativeTabArt = wxAuiGtkTabArt;
#elif defined(__WXMSW__) && wxUSE_UXTHEME
#define wxHAS_NATIVE_TABART
#include "wx/aui/tabartmsw.h"
using wxAuiNativeTabArt = wxAuiMSWTabArt;
#endif
#endif // !__WXUNIVERSAL__
#ifndef wxHAS_NATIVE_TABART
using wxAuiNativeTabArt = wxAuiGenericTabArt;
#endif
#define wxAuiDefaultTabArt wxAuiFlatTabArt
#endif // wxUSE_AUI
#endif // _WX_AUI_TABART_H_

View File

@@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/aui/tabartgtk.h
// Purpose: declaration of the wxAuiGTKTabArt
// Author: Jens Lody and Teodor Petrov
// Created: 2012-03-23
// Copyright: (c) 2012 Jens Lody <jens@codeblocks.org>
// and Teodor Petrov
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_TABARTGTK_H_
#define _WX_AUI_TABARTGTK_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/defs.h"
#if wxUSE_AUI
#include "wx/aui/tabart.h"
#include "wx/gdicmn.h"
class wxWindow;
class wxDC;
class WXDLLIMPEXP_AUI wxAuiGtkTabArt : public wxAuiGenericTabArt
{
public:
wxAuiGtkTabArt();
wxNODISCARD virtual wxAuiTabArt* Clone() override;
virtual void DrawBorder(wxDC& dc, wxWindow* wnd, const wxRect& rect) override;
virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) override;
virtual void DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent) override;
void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect, int bitmap_id,
int button_state, int orientation, wxRect* out_rect) override;
int GetBestTabCtrlSize(wxWindow* wnd, const wxAuiNotebookPageArray& pages,
const wxSize& required_bmp_size) override;
int GetBorderWidth(wxWindow* wnd) override;
int GetAdditionalBorderSpace(wxWindow* wnd) override;
virtual wxSize GetTabSize(wxReadOnlyDC& dc, wxWindow* wnd, const wxString& caption,
const wxBitmapBundle& bitmap, bool active,
int close_button_state, int* x_extent) override;
};
#endif // wxUSE_AUI
#endif // _WX_AUI_TABARTGTK_H_

View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/tabartmsw.h
// Purpose: wxAuiMSWTabArt declaration
// Author: Tobias Taschner
// Created: 2015-09-26
// Copyright: (c) 2015 wxWidgets development team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUI_TABARTMSW_H_
#define _WX_AUI_TABARTMSW_H_
#include "wx/aui/tabart.h"
#if wxUSE_AUI
class WXDLLIMPEXP_AUI wxAuiMSWTabArt : public wxAuiGenericTabArt
{
public:
wxAuiMSWTabArt();
virtual ~wxAuiMSWTabArt();
wxNODISCARD wxAuiTabArt* Clone() override;
void DrawBorder(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) override;
int DrawPageTab(wxDC& dc,
wxWindow* wnd,
wxAuiNotebookPage& page,
const wxRect& rect) override;
void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& inRect,
int bitmapId,
int buttonState,
int orientation,
wxRect* outRect) override;
int GetIndentSize() override;
int GetBorderWidth(
wxWindow* wnd) override;
int GetAdditionalBorderSpace(
wxWindow* wnd) override;
wxSize GetPageTabSize(
wxReadOnlyDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& page,
int* xExtent) override;
int ShowDropDown(
wxWindow* wnd,
const wxAuiNotebookPageArray& items,
int activeIdx) override;
int GetBestTabCtrlSize(wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) override;
void UpdateDpi() override;
private:
bool m_themed;
wxSize m_closeBtnSize;
wxSize m_tabSize;
int m_maxTabHeight;
void InitSizes(wxWindow* wnd, wxReadOnlyDC& dc);
bool IsThemed() const;
};
#endif // wxUSE_AUI
#endif // _WX_AUI_TABARTMSW_H_

View File

@@ -0,0 +1,223 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/aui/tabmdi.h
// Purpose: Generic MDI (Multiple Document Interface) classes
// Author: Hans Van Leemputten
// Modified by: Benjamin I. Williams / Kirix Corporation
// Created: 29/07/2002
// Copyright: (c) Hans Van Leemputten
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_AUITABMDI_H_
#define _WX_AUITABMDI_H_
#include "wx/defs.h"
#if wxUSE_AUI && wxUSE_MDI
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/frame.h"
#include "wx/panel.h"
#include "wx/notebook.h"
#include "wx/icon.h"
#include "wx/mdi.h"
#include "wx/aui/auibook.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_AUI wxAuiMDIParentFrame;
class WXDLLIMPEXP_FWD_AUI wxAuiMDIClientWindow;
class WXDLLIMPEXP_FWD_AUI wxAuiMDIChildFrame;
//-----------------------------------------------------------------------------
// wxAuiMDIParentFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_AUI wxAuiMDIParentFrame : public wxFrame
{
public:
wxAuiMDIParentFrame();
wxAuiMDIParentFrame(wxWindow *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr));
~wxAuiMDIParentFrame();
bool Create(wxWindow *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr) );
void SetArtProvider(wxAuiTabArt* provider);
wxAuiTabArt* GetArtProvider();
wxAuiNotebook* GetNotebook() const;
#if wxUSE_MENUS
wxMenu* GetWindowMenu() const { return m_pWindowMenu; }
void SetWindowMenu(wxMenu* pMenu);
virtual void SetMenuBar(wxMenuBar *pMenuBar) override;
#endif // wxUSE_MENUS
void SetChildMenuBar(wxAuiMDIChildFrame *pChild);
wxAuiMDIChildFrame *GetActiveChild() const;
void SetActiveChild(wxAuiMDIChildFrame* pChildFrame);
wxAuiMDIClientWindow *GetClientWindow() const;
virtual wxAuiMDIClientWindow *OnCreateClient();
virtual void Cascade() { /* Has no effect */ }
virtual void Tile(wxOrientation orient = wxHORIZONTAL);
virtual void ArrangeIcons() { /* Has no effect */ }
virtual void ActivateNext();
virtual void ActivatePrevious();
protected:
wxAuiMDIClientWindow* m_pClientWindow;
wxEvent* m_pLastEvt;
#if wxUSE_MENUS
wxMenu *m_pWindowMenu;
wxMenuBar *m_pMyMenuBar;
#endif // wxUSE_MENUS
protected:
void Init();
#if wxUSE_MENUS
void RemoveWindowMenu(wxMenuBar *pMenuBar);
void AddWindowMenu(wxMenuBar *pMenuBar);
void DoHandleMenu(wxCommandEvent &event);
void DoHandleUpdateUI(wxUpdateUIEvent &event);
#endif // wxUSE_MENUS
virtual bool ProcessEvent(wxEvent& event) override;
virtual void DoGetClientSize(int *width, int *height) const override;
private:
void OnClose(wxCloseEvent& event);
// close all children, return false if any of them vetoed it
bool CloseAll();
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxAuiMDIParentFrame);
};
//-----------------------------------------------------------------------------
// wxAuiMDIChildFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_AUI wxAuiMDIChildFrame : public wxTDIChildFrame
{
public:
wxAuiMDIChildFrame();
wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxAuiMDIChildFrame();
bool Create(wxAuiMDIParentFrame *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
#if wxUSE_MENUS
virtual void SetMenuBar(wxMenuBar *menuBar) override;
virtual wxMenuBar *GetMenuBar() const override;
#endif // wxUSE_MENUS
virtual void SetTitle(const wxString& title) override;
virtual void SetIcons(const wxIconBundle& icons) override;
virtual void Activate() override;
virtual bool Destroy() override;
virtual bool Show(bool show = true) override;
void OnMenuHighlight(wxMenuEvent& evt);
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
wxAuiMDIParentFrame* GetMDIParentFrame() const;
protected:
void Init();
public:
// This function needs to be called when a size change is confirmed,
// we needed this function to prevent anybody from the outside
// changing the panel... it messes the UI layout when we would allow it.
void ApplyMDIChildFrameRect();
protected:
wxAuiMDIParentFrame* m_pMDIParentFrame;
bool m_activateOnCreate;
#if wxUSE_MENUS
wxMenuBar* m_pMenuBar;
#endif // wxUSE_MENUS
private:
wxDECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame);
wxDECLARE_EVENT_TABLE();
friend class wxAuiMDIClientWindow;
};
//-----------------------------------------------------------------------------
// wxAuiMDIClientWindow
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_AUI wxAuiMDIClientWindow : public wxAuiNotebook
{
public:
wxAuiMDIClientWindow();
wxAuiMDIClientWindow(wxAuiMDIParentFrame *parent, long style = 0);
virtual bool CreateClient(wxAuiMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL);
virtual wxAuiMDIChildFrame* GetActiveChild();
virtual void SetActiveChild(wxAuiMDIChildFrame* pChildFrame)
{
SetSelection(GetPageIndex(pChildFrame));
}
protected:
void PageChanged(int oldSelection, int newSelection);
void OnPageClose(wxAuiNotebookEvent& evt);
void OnPageChanged(wxAuiNotebookEvent& evt);
private:
wxDECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow);
wxDECLARE_EVENT_TABLE();
};
#endif // wxUSE_AUI && wxUSE_MDI
#endif // _WX_AUITABMDI_H_