1
///////////////////////////////////////////////////////////////////////////////
3
// Purpose: wxListbook: wxListCtrl and wxNotebook combination
4
// Author: Vadim Zeitlin
7
// RCS-ID: $Id: listbook.h,v 1.12 2005/08/04 00:16:43 VZ Exp $
8
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
9
// Licence: wxWindows licence
10
///////////////////////////////////////////////////////////////////////////////
12
#ifndef _WX_LISTBOOK_H_
13
#define _WX_LISTBOOK_H_
15
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16
#pragma interface "listbook.h"
23
// this can be defined to put a static line as separator between the list
24
// control and the page area; but I think it finally looks better without it so
25
// it is not enabled by default
26
#define wxUSE_LINE_IN_LISTBOOK 0
29
#undef wxUSE_LINE_IN_LISTBOOK
30
#define wxUSE_LINE_IN_LISTBOOK 0
33
#include "wx/bookctrl.h"
35
class WXDLLEXPORT wxListView;
36
class WXDLLEXPORT wxListEvent;
38
#if wxUSE_LINE_IN_LISTBOOK
39
class WXDLLEXPORT wxStaticLine;
40
#endif // wxUSE_LINE_IN_LISTBOOK
42
// ----------------------------------------------------------------------------
44
// ----------------------------------------------------------------------------
46
class WXDLLEXPORT wxListbook : public wxBookCtrlBase
54
wxListbook(wxWindow *parent,
56
const wxPoint& pos = wxDefaultPosition,
57
const wxSize& size = wxDefaultSize,
59
const wxString& name = wxEmptyString)
63
(void)Create(parent, id, pos, size, style, name);
67
bool Create(wxWindow *parent,
69
const wxPoint& pos = wxDefaultPosition,
70
const wxSize& size = wxDefaultSize,
72
const wxString& name = wxEmptyString);
75
virtual int GetSelection() const;
76
virtual bool SetPageText(size_t n, const wxString& strText);
77
virtual wxString GetPageText(size_t n) const;
78
virtual int GetPageImage(size_t n) const;
79
virtual bool SetPageImage(size_t n, int imageId);
80
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
81
virtual bool InsertPage(size_t n,
86
virtual int SetSelection(size_t n);
87
virtual void SetImageList(wxImageList *imageList);
89
// returns true if we have wxLB_TOP or wxLB_BOTTOM style
90
bool IsVertical() const { return HasFlag(wxLB_BOTTOM | wxLB_TOP); }
92
virtual bool DeleteAllPages();
94
wxListView* GetListView() { return m_list; }
97
virtual wxWindow *DoRemovePage(size_t page);
99
// get the size which the list control should have
100
wxSize GetListSize() const;
103
wxRect GetPageRect() const;
106
void OnSize(wxSizeEvent& event);
107
void OnListSelected(wxListEvent& event);
109
// the list control we use for showing the pages index
112
#if wxUSE_LINE_IN_LISTBOOK
113
// the line separating it from the page area
114
wxStaticLine *m_line;
115
#endif // wxUSE_LINE_IN_LISTBOOK
117
// the currently selected page or wxNOT_FOUND if none
121
// common part of all constructors
124
DECLARE_EVENT_TABLE()
125
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbook)
128
// ----------------------------------------------------------------------------
129
// listbook event class and related stuff
130
// ----------------------------------------------------------------------------
132
class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent
135
wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
136
int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
137
: wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
142
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListbookEvent)
145
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED;
146
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING;
148
typedef void (wxEvtHandler::*wxListbookEventFunction)(wxListbookEvent&);
150
#define wxListbookEventHandler(func) \
151
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxListbookEventFunction, &func)
153
#define EVT_LISTBOOK_PAGE_CHANGED(winid, fn) \
154
wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED, winid, wxListbookEventHandler(fn))
156
#define EVT_LISTBOOK_PAGE_CHANGING(winid, fn) \
157
wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, winid, wxListbookEventHandler(fn))
159
#endif // wxUSE_LISTBOOK
161
#endif // _WX_LISTBOOK_H_