1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tabctrl.h
|
|
|
|
// Purpose: wxTabCtrl class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_TABCTRL_H_
|
|
|
|
#define _WX_TABCTRL_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface "tabctrl.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class wxImageList;
|
|
|
|
|
1999-06-10 18:12:13 +00:00
|
|
|
// WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
|
1998-05-20 14:12:05 +00: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 12:15:13 +00:00
|
|
|
wxTabCtrl();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1998-06-14 12:15:13 +00:00
|
|
|
inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = "tabCtrl")
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
|
|
|
Create(parent, id, pos, size, style, name);
|
|
|
|
}
|
1998-06-14 12:15:13 +00:00
|
|
|
~wxTabCtrl();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Accessors
|
|
|
|
|
|
|
|
// Get the selection
|
1998-06-14 12:15:13 +00:00
|
|
|
int GetSelection() const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1998-06-28 11:32:14 +00:00
|
|
|
// Get the tab with the current keyboard focus
|
|
|
|
int GetCurFocus() const;
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
// Get the associated image list
|
1998-06-14 12:15:13 +00:00
|
|
|
wxImageList* GetImageList() const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the number of items
|
1998-06-14 12:15:13 +00:00
|
|
|
int GetItemCount() const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the rect corresponding to the tab
|
1998-06-14 12:15:13 +00:00
|
|
|
bool GetItemRect(int item, wxRect& rect) const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the number of rows
|
1998-06-14 12:15:13 +00:00
|
|
|
int GetRowCount() const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the item text
|
1998-06-14 12:15:13 +00:00
|
|
|
wxString GetItemText(int item) const ;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the item image
|
1998-06-14 12:15:13 +00:00
|
|
|
int GetItemImage(int item) const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Get the item data
|
1998-06-14 12:15:13 +00:00
|
|
|
void* GetItemData(int item) const;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Set the selection
|
1998-06-14 12:15:13 +00:00
|
|
|
int SetSelection(int item);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Set the image list
|
|
|
|
void SetImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
// Set the text for an item
|
1998-06-14 12:15:13 +00:00
|
|
|
bool SetItemText(int item, const wxString& text);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Set the image for an item
|
1998-06-14 12:15:13 +00:00
|
|
|
bool SetItemImage(int item, int image);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Set the data for an item
|
1998-06-14 12:15:13 +00:00
|
|
|
bool SetItemData(int item, void* data);
|
1998-05-20 14:12:05 +00: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 15:17:35 +00:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0, const wxString& name = "tabCtrl");
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Delete all items
|
1998-06-14 12:15:13 +00:00
|
|
|
bool DeleteAllItems();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Delete an item
|
1998-06-14 12:15:13 +00:00
|
|
|
bool DeleteItem(int item);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Hit test
|
|
|
|
int HitTest(const wxPoint& pt, long& flags);
|
|
|
|
|
|
|
|
// Insert an item
|
1998-06-14 12:15:13 +00:00
|
|
|
bool InsertItem(int item, const wxString& text, int imageId = -1, void* data = NULL);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-19 00:53:27 +00:00
|
|
|
// Implementation
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-05-13 21:21:04 +00:00
|
|
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxImageList* m_imageList;
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxTabEvent: public wxCommandEvent
|
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxTabEvent)
|
|
|
|
|
|
|
|
public:
|
1998-06-26 20:19:48 +00:00
|
|
|
wxTabEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (wxEvtHandler::*wxTabEventFunction)(wxTabEvent&);
|
|
|
|
|
2001-01-26 18:58:14 +00:00
|
|
|
#define EVT_TAB_SEL_CHANGED(id, fn) wxEventTableEntry(wxEVT_COMMAND_TAB_SEL_CHANGED, \
|
|
|
|
id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL),
|
|
|
|
#define EVT_TAB_SEL_CHANGING(id, fn) wxEventTableEntry(wxEVT_COMMAND_TAB_SEL_CHANGING, \
|
|
|
|
id, -1, (wxObjectEventFunction) (wxEventFunction) (wxTabEventFunction) & fn, NULL),
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_TABCTRL_H_
|