vdk 2.4.0
notebook.h
1/*
2 * ===========================
3 * VDK Visual Development Kit
4 * Version 0.4
5 * October 1998
6 * ===========================
7 *
8 * Copyright (C) 1998, Mario Motta
9 * Developed by Mario Motta <mmotta@guest.net>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 * 02111-1307, USA.
25 */
26
27#ifndef NOTEBOOK_H
28#define NOTEBOOK_H
29#include <vdk/widcontain.h>
30#include <vdk/dlist.h>
31#include <vdk/vdkprops.h>
32extern char *book_open_xpm[];
33extern char *book_closed_xpm[];
34
35class VDKPixmap;
36class VDKLabel;
37class VDKBox;
38class VDKForm;
39class VDKNotebook;
40class PageList;
41class VDKTabPage;
44#define PageListIterator PListIterator
45/*
46*/
47typedef VDKReadWriteValueProp<VDKNotebook,int> NoteBookIntProp;
48
49class ActivePageProperty: public NoteBookIntProp
50{
51
52public:
53 ActivePageProperty();
54 ActivePageProperty(
55 char* name,
56 VDKNotebook* object,
57 void (VDKNotebook::*write)(int) = NULL,
58 int (VDKNotebook::*read)(void) = NULL
59 );
60 virtual ~ActivePageProperty();
61 operator int();
62 void operator=(int page);
63 void operator++();
64 void operator--();
65 void operator++(int);
66 void operator--(int);
67};
68
69/*
70 */
71class NotebookTabPosProperty: public NoteBookIntProp
72{
73
74public:
75 NotebookTabPosProperty();
76 NotebookTabPosProperty(
77 char* name,
78 VDKNotebook* object,
79 void (VDKNotebook::*write)(int) = NULL,
80 int (VDKNotebook::*read)(void) = NULL
81 );
82 virtual ~NotebookTabPosProperty();
83 void operator = (int pos);
84};
89class VDKTabPage
90{
91
92 GtkWidget *tab;
93 GdkPixmap *open;
94 GdkPixmap *closed;
95 GdkBitmap *open_mask;
96 GdkBitmap *closed_mask;
97 friend class PageList;
98 friend class VDKNotebook;
99 VDKObject* child;
100 VDKObject* book;
101
102 public:
103
104 // properties
108 VDKLabel* TabLabel; // the tab label
112 VDKObject* Child() { return child; }
116 VDKTabPage(VDKObject* owner,
117 VDKObject* child,
118 const char *label,
119 char **pixmap_closed,
120 char **pixmap_open);
121 virtual ~VDKTabPage() {}
122};
127class PageList: public PList
128{
129 friend class VDKNotebook;
130 VDKNotebook *book;
131 public:
135 PageList(VDKNotebook* book = NULL): PList(), book(book) {}
136 ~PageList();
140 void AddPage(VDKObject* child,
141 const char *label,
142 char **pixmap_closed,
143 char **pixmap_open);
148 VDKTabPage* operator[](int n);
152 int size() { return PList::size() ; }
153};
166{
167 static void PageSwitch(GtkWidget *widget,
168 GtkNotebookPage *page,
169 int pagenum,
170 gpointer gp);
171 protected:
172
173public:
174 // properties
184 PageList Pages; // run-time read only
194 ActivePageProperty ActivePage;
198 NotebookTabPosProperty TabPosition;
202 VDKReadWriteValueProp<VDKNotebook,bool> Scrollable;
206 VDKReadWriteValueProp<VDKNotebook,bool> PopUp;
210 VDKReadOnlyValueProp<VDKNotebook,int> PreviousActivePage;
211 //
216 VDKNotebook(VDKForm* owner = NULL);
220 virtual ~VDKNotebook();
226 void Add(VDKObject* obj, int , int , int , int )
227 { AddPage(obj,""); }
239 void AddPage(VDKObject* obj,
240 const char *label,
241 char **pixmap_closed = NULL,
242 char **pixmap_open = NULL);
252 void RemovePage(int page, bool removechild = true);
253 bool GetScrollable()
254 { return Scrollable; }
255 void SetScrollable(bool flag)
256 {
257 gtk_notebook_set_show_tabs (GTK_NOTEBOOK(widget), flag);
258 gtk_notebook_set_scrollable (GTK_NOTEBOOK(widget), flag);
259 }
260 bool GetPopUp()
261 { return PopUp; }
262 void SetPopUp(bool flag)
263 {
264 if (flag)
265 gtk_notebook_popup_enable (GTK_NOTEBOOK(widget));
266 else
267 gtk_notebook_popup_disable (GTK_NOTEBOOK(widget));
268 }
269 int GetPreviousActivePage()
270 { return gtk_notebook_current_page(GTK_NOTEBOOK(widget)); }
271#ifdef USE_SIGCPLUSPLUS
272 VDKSignal1<void,int> OnPageSwitch;
273#endif // USE_SIGCPLUSPLUS
274};
275#endif
276
277
278
Pages list of a notebook.
Definition: notebook.h:128
VDKTabPage * operator[](int n)
Definition: notebook.cc:85
int size()
Definition: notebook.h:152
One of the most used widget containers.
Definition: boxes.h:38
VDKForm widgets, generally the outermost widget container.
Definition: forms.h:69
Provides a gtklabel wrapper.
Definition: label.h:41
Provides a reference semantic double linked list.
Definition: dlist.h:65
int size()
Definition: dlist.h:181
Provides a VDKList iterator.
Definition: dlist.h:201
Provides a notebook widget.
Definition: notebook.h:166
VDKReadOnlyValueProp< VDKNotebook, int > PreviousActivePage
Definition: notebook.h:210
ActivePageProperty ActivePage
Definition: notebook.h:194
NotebookTabPosProperty TabPosition
Definition: notebook.h:198
void AddPage(VDKObject *obj, const char *label, char **pixmap_closed=NULL, char **pixmap_open=NULL)
Definition: notebook.cc:229
void RemovePage(int page, bool removechild=true)
Definition: notebook.cc:239
virtual ~VDKNotebook()
Definition: notebook.cc:224
PageList Pages
Definition: notebook.h:184
VDKNotebook(VDKForm *owner=NULL)
Definition: notebook.cc:207
VDKReadWriteValueProp< VDKNotebook, bool > PopUp
Definition: notebook.h:206
VDKReadWriteValueProp< VDKNotebook, bool > Scrollable
Definition: notebook.h:202
void Add(VDKObject *obj, int, int, int, int)
Definition: notebook.h:226
Containers base class.
Definition: widcontain.h:40
Definition: vdkobj.h:141
GtkWidget * widget
Definition: vdkobj.h:241
Provides a pixmap widget.
Definition: pixmaps.h:44