vdk 2.4.0
checkbutton.h
1 /*
2  * ===========================
3  * VDK Visual Develeopment 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  * Modify by Salmaso Raffaele <r.salmaso@flashnet.it> 10 Jan 1999
12  * added 2 property: Caption and CaptionWrap
13  * added new constructor option: tooltip
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28  * 02111-1307, USA.
29  */
30 
31 #ifndef CHECKBUTTON_H
32 #define CHECKBUTTON_H
33 #include <vdk/abstract_button.h>
34 #include <vdk/vdkprops.h>
35 #include <vdk/tooltips.h>
36 
37 class VDKForm;
45 {
46  VDKTooltip* tooltip;
47 protected:
48  int connectId;
49  static void ToggleEvent(GtkWidget *wid, gpointer obj);
50 public:
51  // properties
56  VDKReadWriteValueProp<VDKCheckButton,bool> Checked;
60  VDKReadWriteValueProp<VDKCheckButton, char*> Caption;
64  VDKReadWriteValueProp<VDKCheckButton, bool> CaptionWrap;
71  VDKCheckButton(VDKForm* owner,char* label = (char*) NULL, char* tip = 0);
72  virtual ~VDKCheckButton() {}
76  void Toggle() { Checked = Checked ? false : true; }
77  void SetChecked(bool flag)
78  { gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),flag);}
79  bool GetChecked()
80  { return GTK_TOGGLE_BUTTON(widget)->active ? true : false; }
81 
82  void SetCaption (char* str);
83  char* GetCaption ();
84  void SetCaptionWrap (bool flag);
85  bool GetCaptionWrap ();
86 
87  virtual void SetForeground(VDKRgb color, GtkStateType state);
88  virtual void SetFont(VDKFont* font);
89 #ifdef USE_SIGCPLUSPLUS
90  public:
95  VDKSignal1<void, bool> OnButtonToggled;
96 #endif
97 };
98 
99 #endif