wxAuiMDI* patches through images to wxAuiNotebook
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -385,7 +385,7 @@ public:
|
|||||||
virtual ~wxAuiTabContainer();
|
virtual ~wxAuiTabContainer();
|
||||||
|
|
||||||
void SetArtProvider(wxAuiTabArt* art);
|
void SetArtProvider(wxAuiTabArt* art);
|
||||||
wxAuiTabArt* GetArtProvider();
|
wxAuiTabArt* GetArtProvider() const;
|
||||||
|
|
||||||
void SetFlags(unsigned int flags);
|
void SetFlags(unsigned int flags);
|
||||||
unsigned int GetFlags() const;
|
unsigned int GetFlags() const;
|
||||||
@@ -517,13 +517,16 @@ public:
|
|||||||
void SetWindowStyleFlag(long style);
|
void SetWindowStyleFlag(long style);
|
||||||
|
|
||||||
bool SetPageText(size_t page, const wxString& text);
|
bool SetPageText(size_t page, const wxString& text);
|
||||||
|
bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
|
||||||
size_t SetSelection(size_t new_page);
|
size_t SetSelection(size_t new_page);
|
||||||
int GetSelection() const;
|
int GetSelection() const;
|
||||||
size_t GetPageCount() const;
|
size_t GetPageCount() const;
|
||||||
wxWindow* GetPage(size_t page_idx) const;
|
wxWindow* GetPage(size_t page_idx) const;
|
||||||
|
|
||||||
|
int GetPageIndex(wxWindow* page_wnd) const;
|
||||||
|
|
||||||
void SetArtProvider(wxAuiTabArt* art);
|
void SetArtProvider(wxAuiTabArt* art);
|
||||||
wxAuiTabArt* GetArtProvider();
|
wxAuiTabArt* GetArtProvider() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -144,6 +144,12 @@ public:
|
|||||||
virtual void SetTitle(const wxString& title);
|
virtual void SetTitle(const wxString& title);
|
||||||
virtual wxString GetTitle() const;
|
virtual wxString GetTitle() const;
|
||||||
|
|
||||||
|
virtual void SetIcons(const wxIconBundle& icons);
|
||||||
|
virtual const wxIconBundle& GetIcons() const;
|
||||||
|
|
||||||
|
virtual void SetIcon(const wxIcon& icon);
|
||||||
|
virtual const wxIcon& GetIcon() const;
|
||||||
|
|
||||||
virtual void Activate();
|
virtual void Activate();
|
||||||
virtual bool Destroy();
|
virtual bool Destroy();
|
||||||
|
|
||||||
@@ -176,9 +182,6 @@ public:
|
|||||||
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
|
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// no icon
|
|
||||||
void SetIcon(const wxIcon& WXUNUSED(icon)) { }
|
|
||||||
void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
|
|
||||||
|
|
||||||
// no maximize etc
|
// no maximize etc
|
||||||
virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
|
virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
|
||||||
@@ -198,19 +201,8 @@ public:
|
|||||||
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
|
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
|
||||||
wxAuiMDIParentFrame* GetMDIParentFrame() const;
|
wxAuiMDIParentFrame* GetMDIParentFrame() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
wxAuiMDIParentFrame *m_pMDIParentFrame;
|
|
||||||
wxRect m_mdi_newrect;
|
|
||||||
wxRect m_mdi_currect;
|
|
||||||
wxString m_title;
|
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
|
||||||
wxMenuBar *m_pMenuBar;
|
|
||||||
#endif // wxUSE_MENUS
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
virtual bool Show(bool show = true);
|
virtual bool Show(bool show = true);
|
||||||
virtual void DoSetSize(int x, int y, int width, int height, int size_flags);
|
virtual void DoSetSize(int x, int y, int width, int height, int size_flags);
|
||||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||||
@@ -222,6 +214,20 @@ public:
|
|||||||
void ApplyMDIChildFrameRect();
|
void ApplyMDIChildFrameRect();
|
||||||
void DoShow(bool show);
|
void DoShow(bool show);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxAuiMDIParentFrame* m_pMDIParentFrame;
|
||||||
|
wxRect m_mdi_newrect;
|
||||||
|
wxRect m_mdi_currect;
|
||||||
|
wxString m_title;
|
||||||
|
wxIcon m_icon;
|
||||||
|
wxIconBundle m_icon_bundle;
|
||||||
|
|
||||||
|
#if wxUSE_MENUS
|
||||||
|
wxMenuBar* m_pMenuBar;
|
||||||
|
#endif // wxUSE_MENUS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
|
DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -1181,7 +1181,7 @@ void wxAuiTabContainer::SetArtProvider(wxAuiTabArt* art)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxAuiTabArt* wxAuiTabContainer::GetArtProvider()
|
wxAuiTabArt* wxAuiTabContainer::GetArtProvider() const
|
||||||
{
|
{
|
||||||
return m_art;
|
return m_art;
|
||||||
}
|
}
|
||||||
@@ -2381,7 +2381,7 @@ int wxAuiNotebook::CalculateTabCtrlHeight()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxAuiTabArt* wxAuiNotebook::GetArtProvider()
|
wxAuiTabArt* wxAuiNotebook::GetArtProvider() const
|
||||||
{
|
{
|
||||||
return m_tabs.GetArtProvider();
|
return m_tabs.GetArtProvider();
|
||||||
}
|
}
|
||||||
@@ -2548,6 +2548,15 @@ bool wxAuiNotebook::RemovePage(size_t page_idx)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPageIndex() returns the index of the page, or -1 if the
|
||||||
|
// page could not be located in the notebook
|
||||||
|
int wxAuiNotebook::GetPageIndex(wxWindow* page_wnd) const
|
||||||
|
{
|
||||||
|
return m_tabs.GetIdxFromWindow(page_wnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// SetPageText() changes the tab caption of the specified page
|
// SetPageText() changes the tab caption of the specified page
|
||||||
bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text)
|
bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text)
|
||||||
{
|
{
|
||||||
@@ -2572,6 +2581,34 @@ bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxAuiNotebook::SetPageBitmap(size_t page_idx, const wxBitmap& bitmap)
|
||||||
|
{
|
||||||
|
if (page_idx >= m_tabs.GetPageCount())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// update our own tab catalog
|
||||||
|
wxAuiNotebookPage& page_info = m_tabs.GetPage(page_idx);
|
||||||
|
page_info.bitmap = bitmap;
|
||||||
|
|
||||||
|
// tab height might have changed
|
||||||
|
SetTabCtrlHeight(CalculateTabCtrlHeight());
|
||||||
|
|
||||||
|
// update what's on screen
|
||||||
|
wxAuiTabCtrl* ctrl;
|
||||||
|
int ctrl_idx;
|
||||||
|
if (FindTab(page_info.window, &ctrl, &ctrl_idx))
|
||||||
|
{
|
||||||
|
wxAuiNotebookPage& info = ctrl->GetPage(ctrl_idx);
|
||||||
|
info.bitmap = bitmap;
|
||||||
|
ctrl->Refresh();
|
||||||
|
ctrl->Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetSelection() returns the index of the currently active page
|
// GetSelection() returns the index of the currently active page
|
||||||
int wxAuiNotebook::GetSelection() const
|
int wxAuiNotebook::GetSelection() const
|
||||||
{
|
{
|
||||||
|
@@ -495,6 +495,46 @@ wxString wxAuiMDIChildFrame::GetTitle() const
|
|||||||
return m_title;
|
return m_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons)
|
||||||
|
{
|
||||||
|
// get icon with the system icon size
|
||||||
|
SetIcon(icons.GetIcon(-1));
|
||||||
|
m_icon_bundle = icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxIconBundle& wxAuiMDIChildFrame::GetIcons() const
|
||||||
|
{
|
||||||
|
return m_icon_bundle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxAuiMDIChildFrame::SetIcon(const wxIcon& icon)
|
||||||
|
{
|
||||||
|
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
|
||||||
|
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
|
||||||
|
|
||||||
|
m_icon = icon;
|
||||||
|
|
||||||
|
wxBitmap bmp;
|
||||||
|
bmp.CopyFromIcon(m_icon);
|
||||||
|
|
||||||
|
wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
|
||||||
|
if (pClientWindow != NULL)
|
||||||
|
{
|
||||||
|
int idx = pClientWindow->GetPageIndex(this);
|
||||||
|
|
||||||
|
if (idx != -1)
|
||||||
|
{
|
||||||
|
pClientWindow->SetPageBitmap((size_t)idx, bmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxIcon& wxAuiMDIChildFrame::GetIcon() const
|
||||||
|
{
|
||||||
|
return m_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxAuiMDIChildFrame::Activate()
|
void wxAuiMDIChildFrame::Activate()
|
||||||
{
|
{
|
||||||
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
|
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
|
||||||
|
Reference in New Issue
Block a user