]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/tabctrl.h
Added some inline helpers so the dependence on wxUSE_UNICODE and
[wxWidgets.git] / include / wx / motif / tabctrl.h
CommitLineData
9b6dbb09
JS
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
19class wxImageList;
20
21/*
83df96d6
JS
22* Flags returned by HitTest
23*/
9b6dbb09
JS
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
30class WXDLLEXPORT wxTabCtrl: public wxControl
31{
83df96d6
JS
32 DECLARE_DYNAMIC_CLASS(wxTabCtrl)
33public:
34/*
35* Public interface
9b6dbb09 36 */
83df96d6 37
9b6dbb09 38 wxTabCtrl();
83df96d6 39
9b6dbb09 40 inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
83df96d6 41 long style = 0, const wxString& name = "tabCtrl")
9b6dbb09
JS
42 {
43 Create(parent, id, pos, size, style, name);
44 }
45 ~wxTabCtrl();
83df96d6
JS
46
47 // Accessors
48
9b6dbb09
JS
49 // Get the selection
50 int GetSelection() const;
83df96d6 51
9b6dbb09
JS
52 // Get the tab with the current keyboard focus
53 int GetCurFocus() const;
83df96d6 54
9b6dbb09
JS
55 // Get the associated image list
56 wxImageList* GetImageList() const;
83df96d6 57
9b6dbb09
JS
58 // Get the number of items
59 int GetItemCount() const;
83df96d6 60
9b6dbb09
JS
61 // Get the rect corresponding to the tab
62 bool GetItemRect(int item, wxRect& rect) const;
83df96d6 63
9b6dbb09
JS
64 // Get the number of rows
65 int GetRowCount() const;
83df96d6 66
9b6dbb09
JS
67 // Get the item text
68 wxString GetItemText(int item) const ;
83df96d6 69
9b6dbb09
JS
70 // Get the item image
71 int GetItemImage(int item) const;
83df96d6 72
9b6dbb09
JS
73 // Get the item data
74 void* GetItemData(int item) const;
83df96d6 75
9b6dbb09
JS
76 // Set the selection
77 int SetSelection(int item);
83df96d6 78
9b6dbb09
JS
79 // Set the image list
80 void SetImageList(wxImageList* imageList);
83df96d6 81
9b6dbb09
JS
82 // Set the text for an item
83 bool SetItemText(int item, const wxString& text);
83df96d6 84
9b6dbb09
JS
85 // Set the image for an item
86 bool SetItemImage(int item, int image);
83df96d6 87
9b6dbb09
JS
88 // Set the data for an item
89 bool SetItemData(int item, void* data);
83df96d6 90
9b6dbb09
JS
91 // Set the size for a fixed-width tab control
92 void SetItemSize(const wxSize& size);
83df96d6 93
9b6dbb09
JS
94 // Set the padding between tabs
95 void SetPadding(const wxSize& padding);
83df96d6
JS
96
97 // Operations
98
9b6dbb09 99 bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
83df96d6
JS
100 long style = 0, const wxString& name = "tabCtrl");
101
9b6dbb09
JS
102 // Delete all items
103 bool DeleteAllItems();
83df96d6 104
9b6dbb09
JS
105 // Delete an item
106 bool DeleteItem(int item);
83df96d6 107
9b6dbb09
JS
108 // Hit test
109 int HitTest(const wxPoint& pt, long& flags);
83df96d6 110
9b6dbb09
JS
111 // Insert an item
112 bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
83df96d6 113
9b6dbb09 114 void Command(wxCommandEvent& event);
83df96d6 115
9b6dbb09
JS
116protected:
117 wxImageList* m_imageList;
83df96d6
JS
118
119 DECLARE_EVENT_TABLE()
9b6dbb09
JS
120};
121
122class WXDLLEXPORT wxTabEvent: public wxCommandEvent
123{
83df96d6
JS
124 DECLARE_DYNAMIC_CLASS(wxTabEvent)
125
126public:
127 wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
9b6dbb09
JS
128};
129
130typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
131
2e4df4bf 132#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
83df96d6 133id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL ),
2e4df4bf 134#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
83df96d6 135id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL ),
9b6dbb09
JS
136
137#endif
83df96d6 138// _WX_TABCTRL_H_