]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tabctrl.h
GTK
[wxWidgets.git] / include / wx / msw / tabctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tabctrl.h
3 // Purpose: wxTabCtrl class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __TABCTRLH__
13 #define __TABCTRLH__
14
15 #ifdef __GNUG__
16 #pragma interface "tabctrl.h"
17 #endif
18
19 class wxImageList;
20
21 // WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
22
23 /*
24 * Flags returned by HitTest
25 */
26
27 #define wxTAB_HITTEST_NOWHERE 1
28 #define wxTAB_HITTEST_ONICON 2
29 #define wxTAB_HITTEST_ONLABEL 4
30 #define wxTAB_HITTEST_ONITEM 6
31
32 class WXDLLEXPORT wxTabCtrl: public wxControl
33 {
34 DECLARE_DYNAMIC_CLASS(wxTabCtrl)
35 public:
36 /*
37 * Public interface
38 */
39
40 wxTabCtrl(void);
41
42 inline wxTabCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
43 const long style = 0, const wxString& name = "tabCtrl")
44 {
45 Create(parent, id, pos, size, style, name);
46 }
47 ~wxTabCtrl(void);
48
49 // Accessors
50
51 // Get the selection
52 int GetSelection(void) const;
53
54 // Get the associated image list
55 wxImageList* GetImageList(void) const;
56
57 // Get the number of items
58 int GetItemCount(void) const;
59
60 // Get the rect corresponding to the tab
61 bool GetItemRect(const int item, wxRect& rect) const;
62
63 // Get the number of rows
64 int GetRowCount(void) const;
65
66 // Get the item text
67 wxString GetItemText(const int item) const ;
68
69 // Get the item image
70 int GetItemImage(const int item) const;
71
72 // Get the item data
73 void* GetItemData(const int item) const;
74
75 // Set the selection
76 int SetSelection(const int item);
77
78 // Set the image list
79 void SetImageList(wxImageList* imageList);
80
81 // Set the text for an item
82 bool SetItemText(const int item, const wxString& text);
83
84 // Set the image for an item
85 bool SetItemImage(const int item, const int image);
86
87 // Set the data for an item
88 bool SetItemData(const int item, void* data);
89
90 // Set the size for a fixed-width tab control
91 void SetItemSize(const wxSize& size);
92
93 // Set the padding between tabs
94 void SetPadding(const wxSize& padding);
95
96 // Operations
97
98 bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
99 const long style = 0, const wxString& name = "tabCtrl");
100
101 // Delete all items
102 bool DeleteAllItems(void);
103
104 // Delete an item
105 bool DeleteItem(const int item);
106
107 // Hit test
108 int HitTest(const wxPoint& pt, long& flags);
109
110 // Insert an item
111 int InsertItem(const int item, const wxString& text, const int imageId = -1, void* data = NULL);
112
113 // Implementation
114
115 // Call default behaviour
116 void OnPaint(wxPaintEvent& event) { Default() ; }
117 void OnSize(wxSizeEvent& event) { Default() ; }
118 void OnMouseEvent(wxMouseEvent& event) { Default() ; }
119 void OnKillFocus(wxFocusEvent& event) { Default() ; }
120
121 void Command(wxCommandEvent& event);
122 bool MSWCommand(const WXUINT param, const WXWORD id);
123 bool MSWNotify(const WXWPARAM wParam, const WXLPARAM lParam);
124
125 // Responds to colour changes
126 void OnSysColourChanged(wxSysColourChangedEvent& event);
127
128 protected:
129 wxImageList* m_imageList;
130
131 DECLARE_EVENT_TABLE()
132 };
133
134 class WXDLLEXPORT wxTabEvent: public wxCommandEvent
135 {
136 DECLARE_DYNAMIC_CLASS(wxTabEvent)
137
138 public:
139 wxTabEvent(WXTYPE commandType = 0, int id = 0);
140 };
141
142 typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
143
144 #define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, \
145 id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },
146 #define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, \
147 id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },
148
149 #endif
150 // __TABCTRLH__