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