1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tabctrl.h
|
|
|
|
// Purpose: wxTabCtrl class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-09-07 02:01:01 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_TABCTRL_H_
|
|
|
|
#define _WX_TABCTRL_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2004-07-15 16:51:44 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxImageList;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2005-01-21 13:15:42 -05:00
|
|
|
// extern WXDLLEXPORT_DATA(const wxChar*) wxToolBarNameStr;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags returned by HitTest
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define wxTAB_HITTEST_NOWHERE 1
|
|
|
|
#define wxTAB_HITTEST_ONICON 2
|
|
|
|
#define wxTAB_HITTEST_ONLABEL 4
|
|
|
|
#define wxTAB_HITTEST_ONITEM 6
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxTabCtrl: public wxControl
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxTabCtrl)
|
|
|
|
public:
|
|
|
|
/*
|
|
|
|
* Public interface
|
|
|
|
*/
|
|
|
|
|
1998-06-14 08:15:13 -04:00
|
|
|
wxTabCtrl();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-06-14 08:15:13 -04:00
|
|
|
inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2002-12-04 09:11:26 -05:00
|
|
|
long style = 0, const wxString& name = wxT("tabCtrl"))
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-06-14 08:15:13 -04:00
|
|
|
~wxTabCtrl();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Accessors
|
|
|
|
|
|
|
|
// Get the selection
|
1998-06-14 08:15:13 -04:00
|
|
|
int GetSelection() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1998-06-28 07:32:14 -04:00
|
|
|
// Get the tab with the current keyboard focus
|
|
|
|
int GetCurFocus() const;
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
// Get the associated image list
|
1998-06-14 08:15:13 -04:00
|
|
|
wxImageList* GetImageList() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the number of items
|
1998-06-14 08:15:13 -04:00
|
|
|
int GetItemCount() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the rect corresponding to the tab
|
1998-06-14 08:15:13 -04:00
|
|
|
bool GetItemRect(int item, wxRect& rect) const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the number of rows
|
1998-06-14 08:15:13 -04:00
|
|
|
int GetRowCount() const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the item text
|
1998-06-14 08:15:13 -04:00
|
|
|
wxString GetItemText(int item) const ;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the item image
|
1998-06-14 08:15:13 -04:00
|
|
|
int GetItemImage(int item) const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Get the item data
|
1998-06-14 08:15:13 -04:00
|
|
|
void* GetItemData(int item) const;
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Set the selection
|
1998-06-14 08:15:13 -04:00
|
|
|
int SetSelection(int item);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Set the image list
|
|
|
|
void SetImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
// Set the text for an item
|
1998-06-14 08:15:13 -04:00
|
|
|
bool SetItemText(int item, const wxString& text);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Set the image for an item
|
1998-06-14 08:15:13 -04:00
|
|
|
bool SetItemImage(int item, int image);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Set the data for an item
|
1998-06-14 08:15:13 -04:00
|
|
|
bool SetItemData(int item, void* data);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Set the size for a fixed-width tab control
|
|
|
|
void SetItemSize(const wxSize& size);
|
|
|
|
|
|
|
|
// Set the padding between tabs
|
|
|
|
void SetPadding(const wxSize& padding);
|
|
|
|
|
|
|
|
// Operations
|
|
|
|
|
1998-07-02 11:17:35 -04:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2002-12-04 09:11:26 -05:00
|
|
|
long style = 0, const wxString& name = wxT("tabCtrl"));
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Delete all items
|
1998-06-14 08:15:13 -04:00
|
|
|
bool DeleteAllItems();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Delete an item
|
1998-06-14 08:15:13 -04:00
|
|
|
bool DeleteItem(int item);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Hit test
|
|
|
|
int HitTest(const wxPoint& pt, long& flags);
|
|
|
|
|
|
|
|
// Insert an item
|
1998-06-14 08:15:13 -04:00
|
|
|
bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-18 20:53:27 -04:00
|
|
|
// Implementation
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxImageList* m_imageList;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxTabCtrl)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
2002-12-04 09:11:26 -05:00
|
|
|
class WXDLLEXPORT wxTabEvent : public wxNotifyEvent
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
2002-12-04 09:11:26 -05:00
|
|
|
public:
|
|
|
|
wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
|
|
|
|
int nSel = -1, int nOldSel = -1)
|
|
|
|
: wxNotifyEvent(commandType, id)
|
|
|
|
{
|
|
|
|
m_nSel = nSel;
|
|
|
|
m_nOldSel = nOldSel;
|
|
|
|
}
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
// the currently selected page (-1 if none)
|
|
|
|
int GetSelection() const { return m_nSel; }
|
|
|
|
void SetSelection(int nSel) { m_nSel = nSel; }
|
|
|
|
// the page that was selected before the change (-1 if none)
|
|
|
|
int GetOldSelection() const { return m_nOldSel; }
|
|
|
|
void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
int m_nSel, // currently selected page
|
|
|
|
m_nOldSel; // previously selected page
|
|
|
|
|
2003-07-21 21:42:41 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxTabEvent)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
|
|
|
|
|
2001-01-31 12:16:40 -05:00
|
|
|
#define EVT_TAB_SEL_CHANGED(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGED, \
|
2004-09-07 02:01:01 -04:00
|
|
|
id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
|
2001-01-31 12:16:40 -05:00
|
|
|
#define EVT_TAB_SEL_CHANGING(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_TAB_SEL_CHANGING, \
|
2004-09-07 02:01:01 -04:00
|
|
|
id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxTabEventFunction, & fn ), NULL),
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_TABCTRL_H_
|