Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

notebook.h

00001 /* 00002 * =========================== 00003 * VDK Visual Development Kit 00004 * Version 0.4 00005 * October 1998 00006 * =========================== 00007 * 00008 * Copyright (C) 1998, Mario Motta 00009 * Developed by Mario Motta <mmotta@guest.net> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Library General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00024 * 02111-1307, USA. 00025 */ 00026 00027 #ifndef NOTEBOOK_H 00028 #define NOTEBOOK_H 00029 #include <vdk/widcontain.h> 00030 #include <vdk/dlist.h> 00031 #include <vdk/vdkprops.h> 00032 extern char *book_open_xpm[]; 00033 extern char *book_closed_xpm[]; 00034 00035 class VDKPixmap; 00036 class VDKLabel; 00037 class VDKBox; 00038 class VDKForm; 00039 class VDKNotebook; 00040 class PageList; 00041 class VDKTabPage; 00042 typedef VDKList<VDKTabPage> PList; 00043 typedef VDKListiterator<VDKTabPage> PListIterator; 00044 #define PageListIterator PListIterator 00045 /* 00046 */ 00047 typedef VDKReadWriteValueProp<VDKNotebook,int> NoteBookIntProp; 00048 00049 class ActivePageProperty: public NoteBookIntProp 00050 { 00051 00052 public: 00053 ActivePageProperty(); 00054 ActivePageProperty( 00055 char* name, 00056 VDKNotebook* object, 00057 void (VDKNotebook::*write)(int) = NULL, 00058 int (VDKNotebook::*read)(void) = NULL 00059 ); 00060 virtual ~ActivePageProperty(); 00061 operator int(); 00062 void operator=(int page); 00063 void operator++(); 00064 void operator--(); 00065 void operator++(int); 00066 void operator--(int); 00067 }; 00068 00069 /* 00070 */ 00071 class NotebookTabPosProperty: public NoteBookIntProp 00072 { 00073 00074 public: 00075 NotebookTabPosProperty(); 00076 NotebookTabPosProperty( 00077 char* name, 00078 VDKNotebook* object, 00079 void (VDKNotebook::*write)(int) = NULL, 00080 int (VDKNotebook::*read)(void) = NULL 00081 ); 00082 virtual ~NotebookTabPosProperty(); 00083 void operator = (int pos); 00084 }; 00089 class VDKTabPage 00090 { 00091 00092 GtkWidget *tab; 00093 GdkPixmap *open; 00094 GdkPixmap *closed; 00095 GdkBitmap *open_mask; 00096 GdkBitmap *closed_mask; 00097 friend class PageList; 00098 friend class VDKNotebook; 00099 VDKObject* child; 00100 VDKObject* book; 00101 00102 public: 00103 00104 // properties 00108 VDKLabel* TabLabel; // the tab label 00112 VDKObject* Child() { return child; } 00116 VDKTabPage(VDKObject* owner, 00117 VDKObject* child, 00118 const char *label, 00119 char **pixmap_closed, 00120 char **pixmap_open); 00121 virtual ~VDKTabPage() {} 00122 }; 00127 class PageList: public PList 00128 { 00129 friend class VDKNotebook; 00130 VDKNotebook *book; 00131 public: 00135 PageList(VDKNotebook* book = NULL): PList(), book(book) {} 00136 ~PageList(); 00140 void AddPage(VDKObject* child, 00141 const char *label, 00142 char **pixmap_closed, 00143 char **pixmap_open); 00148 VDKTabPage* operator[](int n); 00152 int size() { return PList::size() ; } 00153 }; 00165 class VDKNotebook: public VDKObjectContainer 00166 { 00167 static void PageSwitch(GtkWidget *widget, 00168 GtkNotebookPage *page, 00169 int pagenum, 00170 gpointer gp); 00171 protected: 00172 00173 public: 00174 // properties 00184 PageList Pages; // run-time read only 00194 ActivePageProperty ActivePage; 00198 NotebookTabPosProperty TabPosition; 00202 VDKReadWriteValueProp<VDKNotebook,bool> Scrollable; 00206 VDKReadWriteValueProp<VDKNotebook,bool> PopUp; 00210 VDKReadOnlyValueProp<VDKNotebook,int> PreviousActivePage; 00211 // 00216 VDKNotebook(VDKForm* owner = NULL); 00220 virtual ~VDKNotebook(); 00226 void Add(VDKObject* obj, int , int , int , int ) 00227 { AddPage(obj,""); } 00239 void AddPage(VDKObject* obj, 00240 const char *label, 00241 char **pixmap_closed = NULL, 00242 char **pixmap_open = NULL); 00252 void RemovePage(int page, bool removechild = true); 00253 bool GetScrollable() 00254 { return Scrollable; } 00255 void SetScrollable(bool flag) 00256 { 00257 gtk_notebook_set_show_tabs (GTK_NOTEBOOK(widget), flag); 00258 gtk_notebook_set_scrollable (GTK_NOTEBOOK(widget), flag); 00259 } 00260 bool GetPopUp() 00261 { return PopUp; } 00262 void SetPopUp(bool flag) 00263 { 00264 if (flag) 00265 gtk_notebook_popup_enable (GTK_NOTEBOOK(widget)); 00266 else 00267 gtk_notebook_popup_disable (GTK_NOTEBOOK(widget)); 00268 } 00269 int GetPreviousActivePage() 00270 { return gtk_notebook_current_page(GTK_NOTEBOOK(widget)); } 00271 #ifdef USE_SIGCPLUSPLUS 00272 VDKSignal1<void,int> OnPageSwitch; 00273 #endif // USE_SIGCPLUSPLUS 00274 }; 00275 #endif 00276 00277 00278

Generated on Tue Aug 17 12:39:50 2004 for vdk 2.4.0 by doxygen 1.3.7