X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c67daf87774c71ae9f73af9969008af220e52a11..ef094fa075bc56bcbc33b12159c395ea28afda3b:/include/wx/generic/tabg.h diff --git a/include/wx/generic/tabg.h b/include/wx/generic/tabg.h index 0924fa0c2d..047cd38779 100644 --- a/include/wx/generic/tabg.h +++ b/include/wx/generic/tabg.h @@ -6,13 +6,13 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __TABGH_G__ #define __TABGH_G__ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "tabg.h" #endif @@ -20,54 +20,56 @@ #include "wx/hash.h" #include "wx/string.h" +#include "wx/dialog.h" +#include "wx/panel.h" -class wxTabView; +class WXDLLEXPORT wxTabView; /* * A wxTabControl is the internal and visual representation * of the tab. */ - -class wxTabControl: public wxObject + +class WXDLLEXPORT wxTabControl: public wxObject { DECLARE_DYNAMIC_CLASS(wxTabControl) public: wxTabControl(wxTabView *v = (wxTabView *) NULL); ~wxTabControl(void); - + virtual void OnDraw(wxDC& dc, bool lastInRow); - inline void SetLabel(const wxString& str) { m_controlLabel = str; } - inline wxString GetLabel(void) const { return m_controlLabel; } - - inline void SetFont(wxFont *f) { m_labelFont = f; } - inline wxFont *GetFont(void) const { return m_labelFont; } - - inline void SetSelected(bool sel) { m_isSelected = sel; } - inline bool IsSelected(void) const { return m_isSelected; } - - inline void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } - inline void SetSize(int x, int y) { m_width = x; m_height = y; } - - inline void SetRowPosition(int r) { m_rowPosition = r; } - inline int GetRowPosition() const { return m_rowPosition; } - inline void SetColPosition(int c) { m_colPosition = c; } - inline int GetColPosition() const { return m_colPosition; } - - inline int GetX(void) const { return m_offsetX; } - inline int GetY(void) const { return m_offsetY; } - inline int GetWidth(void) const { return m_width; } - inline int GetHeight(void) const { return m_height; } - - inline int GetId(void) const { return m_id; } - inline void SetId(int i) { m_id = i; } - + void SetLabel(const wxString& str) { m_controlLabel = str; } + wxString GetLabel(void) const { return m_controlLabel; } + + void SetFont(const wxFont& f) { m_labelFont = f; } + wxFont *GetFont(void) const { return (wxFont*) & m_labelFont; } + + void SetSelected(bool sel) { m_isSelected = sel; } + bool IsSelected(void) const { return m_isSelected; } + + void SetPosition(int x, int y) { m_offsetX = x; m_offsetY = y; } + void SetSize(int x, int y) { m_width = x; m_height = y; } + + void SetRowPosition(int r) { m_rowPosition = r; } + int GetRowPosition() const { return m_rowPosition; } + void SetColPosition(int c) { m_colPosition = c; } + int GetColPosition() const { return m_colPosition; } + + int GetX(void) const { return m_offsetX; } + int GetY(void) const { return m_offsetY; } + int GetWidth(void) const { return m_width; } + int GetHeight(void) const { return m_height; } + + int GetId(void) const { return m_id; } + void SetId(int i) { m_id = i; } + virtual bool HitTest(int x, int y) const ; protected: wxTabView* m_view; wxString m_controlLabel; bool m_isSelected; - wxFont* m_labelFont; + wxFont m_labelFont; int m_offsetX; // Offsets from top-left of tab view area (the area below the tabs) int m_offsetY; int m_width; @@ -76,19 +78,15 @@ protected: int m_rowPosition; // Position in row from 0 int m_colPosition; // Position in col from 0 }; - + /* * Each wxTabLayer is a list of tabs. E.g. there * are 3 layers in the MS Word Options dialog. */ - -class wxTabLayer: public wxList + +class WXDLLEXPORT wxTabLayer: public wxList { DECLARE_DYNAMIC_CLASS(wxTabLayer) - public: - wxTabLayer(void) - { - } }; /* @@ -98,14 +96,14 @@ class wxTabLayer: public wxList #define wxTAB_STYLE_DRAW_BOX 1 // Draws 3D boxes round tab layers #define wxTAB_STYLE_COLOUR_INTERIOR 2 // Colours interior of tabs, otherwise draws outline -class wxTabView: public wxObject +class WXDLLEXPORT wxTabView: public wxObject { DECLARE_DYNAMIC_CLASS(wxTabView) public: wxTabView(long style = wxTAB_STYLE_DRAW_BOX | wxTAB_STYLE_COLOUR_INTERIOR); ~wxTabView(); - inline int GetNumberOfLayers() const { return m_layers.Number(); } + inline int GetNumberOfLayers() const { return m_layers.GetCount(); } inline wxList& GetLayers() { return m_layers; } inline void SetWindow(wxWindow* wnd) { m_window = wnd; } @@ -113,11 +111,17 @@ public: // Automatically positions tabs wxTabControl *AddTab(int id, const wxString& label, wxTabControl *existingTab = (wxTabControl *) NULL); + + // Remove the tab without deleting the window + bool RemoveTab(int id); void ClearTabs(bool deleteTabs = TRUE); + bool SetTabText(int id, const wxString& label); + wxString GetTabText(int id) const; + // Layout tabs (optional, e.g. if resizing window) - void Layout(void); + void LayoutTabs(); // Draw all tabs virtual void Draw(wxDC& dc); @@ -147,7 +151,7 @@ public: inline wxPen *GetBackgroundPen(void) const { return m_backgroundPen; } inline wxBrush *GetBackgroundBrush(void) const { return m_backgroundBrush; } - inline void SetViewRect(const wxRectangle& rect) { m_tabViewRect = rect; } + inline void SetViewRect(const wxRect& rect) { m_tabViewRect = rect; } inline wxRect GetViewRect(void) const { return m_tabViewRect; } // Calculate tab width to fit to view, and optionally adjust the view @@ -162,6 +166,10 @@ public: inline int GetTabHeight(void) const { return m_tabHeight; } inline void SetTabSelectionHeight(int h) { m_tabSelectionHeight = h; } inline int GetTabSelectionHeight(void) const { return m_tabSelectionHeight; } + + // Returns the total height of the tabs component -- this may be several + // times the height of a tab, if there are several tab layers (rows). + int GetTotalTabHeight(); inline int GetTopMargin(void) const { return m_topMargin; } inline void SetTopMargin(int margin) { m_topMargin = margin; } @@ -183,11 +191,11 @@ public: inline void SetVerticalTabTextSpacing(int s) { m_tabVerticalTextSpacing = s; } inline int GetVerticalTabTextSpacing() const { return m_tabVerticalTextSpacing; } - inline wxFont *GetTabFont() const { return m_tabFont; } - inline void SetTabFont(wxFont *f) { m_tabFont = f; } + inline wxFont *GetTabFont() const { return (wxFont*) & m_tabFont; } + inline void SetTabFont(const wxFont& f) { m_tabFont = f; } - inline wxFont *GetSelectedTabFont() const { return m_tabSelectedFont; } - inline void SetSelectedTabFont(wxFont *f) { m_tabSelectedFont = f; } + inline wxFont *GetSelectedTabFont() const { return (wxFont*) & m_tabSelectedFont; } + inline void SetSelectedTabFont(const wxFont& f) { m_tabSelectedFont = f; } // Find the node and the column at which this control is positioned. wxNode *FindTabNodeAndColumn(wxTabControl *control, int *col) const ; @@ -248,8 +256,8 @@ protected: wxPen* m_backgroundPen; wxBrush* m_backgroundBrush; - wxFont* m_tabFont; - wxFont* m_tabSelectedFont; + wxFont m_tabFont; + wxFont m_tabSelectedFont; int m_noTabs; @@ -260,7 +268,7 @@ protected: * A dialog box class that is tab-friendly */ -class wxTabbedDialog: public wxDialog +class WXDLLEXPORT wxTabbedDialog: public wxDialog { DECLARE_DYNAMIC_CLASS(wxTabbedDialog) @@ -289,7 +297,7 @@ DECLARE_EVENT_TABLE() * A panel class that is tab-friendly */ -class wxTabbedPanel: public wxPanel +class WXDLLEXPORT wxTabbedPanel: public wxPanel { DECLARE_DYNAMIC_CLASS(wxTabbedPanel) @@ -313,7 +321,7 @@ protected: DECLARE_EVENT_TABLE() }; -class wxPanelTabView: public wxTabView +class WXDLLEXPORT wxPanelTabView: public wxTabView { DECLARE_DYNAMIC_CLASS(wxPanelTabView) public: @@ -330,6 +338,7 @@ public: inline wxWindow *GetCurrentWindow() const { return m_currentWindow; } void ShowWindowForTab(int id); + inline wxList& GetWindows() const { return (wxList&) m_tabWindows; } protected: // List of panels, one for each tab. Indexed