virtual ~wxAuiTabContainer();
void SetArtProvider(wxAuiTabArt* art);
- wxAuiTabArt* GetArtProvider();
+ wxAuiTabArt* GetArtProvider() const;
void SetFlags(unsigned int flags);
unsigned int GetFlags() const;
void SetWindowStyleFlag(long style);
bool SetPageText(size_t page, const wxString& text);
+ bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
size_t SetSelection(size_t new_page);
int GetSelection() const;
size_t GetPageCount() const;
wxWindow* GetPage(size_t page_idx) const;
+ int GetPageIndex(wxWindow* page_wnd) const;
+
void SetArtProvider(wxAuiTabArt* art);
- wxAuiTabArt* GetArtProvider();
+ wxAuiTabArt* GetArtProvider() const;
protected:
virtual void SetTitle(const wxString& title);
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 bool Destroy();
virtual wxToolBar *GetToolBar() const { return (wxToolBar*)NULL; }
#endif
- // no icon
- void SetIcon(const wxIcon& WXUNUSED(icon)) { }
- void SetIcons(const wxIconBundle& WXUNUSED(icons)) { }
// no maximize etc
virtual void Maximize(bool WXUNUSED(maximize) = true) { /* Has no effect */ }
void SetMDIParentFrame(wxAuiMDIParentFrame* parent);
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:
void Init();
-
virtual bool Show(bool show = true);
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);
void ApplyMDIChildFrameRect();
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:
DECLARE_DYNAMIC_CLASS(wxAuiMDIChildFrame)
DECLARE_EVENT_TABLE()
}
}
-wxAuiTabArt* wxAuiTabContainer::GetArtProvider()
+wxAuiTabArt* wxAuiTabContainer::GetArtProvider() const
{
return m_art;
}
}
-wxAuiTabArt* wxAuiNotebook::GetArtProvider()
+wxAuiTabArt* wxAuiNotebook::GetArtProvider() const
{
return m_tabs.GetArtProvider();
}
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
bool wxAuiNotebook::SetPageText(size_t page_idx, const wxString& text)
{
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
int wxAuiNotebook::GetSelection() const
{
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()
{
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();