]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tabctrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTabCtrl class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_TABCTRL_H_
13 #define _WX_TABCTRL_H_
16 #pragma interface "tabctrl.h"
21 // WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
24 * Flags returned by HitTest
27 #define wxTAB_HITTEST_NOWHERE 1
28 #define wxTAB_HITTEST_ONICON 2
29 #define wxTAB_HITTEST_ONLABEL 4
30 #define wxTAB_HITTEST_ONITEM 6
32 class WXDLLEXPORT wxTabCtrl
: public wxControl
34 DECLARE_DYNAMIC_CLASS(wxTabCtrl
)
42 inline wxTabCtrl(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
43 long style
= 0, const wxString
& name
= "tabCtrl")
45 Create(parent
, id
, pos
, size
, style
, name
);
52 int GetSelection() const;
54 // Get the tab with the current keyboard focus
55 int GetCurFocus() const;
57 // Get the associated image list
58 wxImageList
* GetImageList() const;
60 // Get the number of items
61 int GetItemCount() const;
63 // Get the rect corresponding to the tab
64 bool GetItemRect(int item
, wxRect
& rect
) const;
66 // Get the number of rows
67 int GetRowCount() const;
70 wxString
GetItemText(int item
) const ;
73 int GetItemImage(int item
) const;
76 void* GetItemData(int item
) const;
79 int SetSelection(int item
);
82 void SetImageList(wxImageList
* imageList
);
84 // Set the text for an item
85 bool SetItemText(int item
, const wxString
& text
);
87 // Set the image for an item
88 bool SetItemImage(int item
, int image
);
90 // Set the data for an item
91 bool SetItemData(int item
, void* data
);
93 // Set the size for a fixed-width tab control
94 void SetItemSize(const wxSize
& size
);
96 // Set the padding between tabs
97 void SetPadding(const wxSize
& padding
);
101 bool Create(wxWindow
*parent
, wxWindowID id
, const wxPoint
& pos
= wxDefaultPosition
, const wxSize
& size
= wxDefaultSize
,
102 long style
= 0, const wxString
& name
= "tabCtrl");
105 bool DeleteAllItems();
108 bool DeleteItem(int item
);
111 int HitTest(const wxPoint
& pt
, long& flags
);
114 bool InsertItem(int item
, const wxString
& text
, int imageId
= -1, void* data
= NULL
);
118 // Call default behaviour
119 void OnPaint(wxPaintEvent
& event
) { Default() ; }
120 void OnSize(wxSizeEvent
& event
) { Default() ; }
121 void OnMouseEvent(wxMouseEvent
& event
) { Default() ; }
122 void OnKillFocus(wxFocusEvent
& event
) { Default() ; }
124 void Command(wxCommandEvent
& event
);
126 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
127 virtual bool MSWOnNotify(int idCtrl
, WXLPARAM lParam
, WXLPARAM
*result
);
129 // Responds to colour changes
130 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
133 wxImageList
* m_imageList
;
135 DECLARE_EVENT_TABLE()
138 class WXDLLEXPORT wxTabEvent
: public wxCommandEvent
140 DECLARE_DYNAMIC_CLASS(wxTabEvent
)
143 wxTabEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
146 typedef void (wxEvtHandler::*wxTabEventFunction
)(wxTabEvent
&);
148 #define EVT_TAB_SEL_CHANGED(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGED, \
149 id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },
150 #define EVT_TAB_SEL_CHANGING(id, fn) { wxEVT_COMMAND_TAB_SEL_CHANGING, \
151 id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL },