/usr/include/vdk2/vdk/vdkcustombutton.h is in libvdk2-dev 2.4.0-5.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | /*
* ===========================
* VDK Visual Develeopment Kit
* Version 0.6.2
* May 1999
* ===========================
*
* Copyright (C) 1998, Mario Motta
* Developed by Mario Motta <mmotta@guest.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef _vdkcustombutton_h
#define _vdkcustombutton_h
#include <vdk/vdkobj.h>
#include <vdk/boxes.h>
#include <vdk/label.h>
#include <vdk/image.h>
#include <vdk/menu.h>
// #include <vdk/gtkcombobutton.h>
/*!
\class VDKCustomButton
\brief This class provides an unified wrapper for almost all kind
of GtkButton
\par Signals
\arg clicked signal, emitted when user clicks over button
\arg enter_signal, emitted when mouse goes over button
\arg leave_signal. emitted when mouse leaves button
\par Examples
In ./testvdk/testvdk.cc
*/
class VDKCustomButton: public VDKObject
{
protected:
void ConnectButtonSignals();
static void ToggleEvent(GtkWidget *wid, gpointer gp);
public:
// properties
/*!
<read-only>
Permits to access embedded VDKBox that already contains
a VDKLabel and probably a VDKImage
*/
VDKReadOnlyValueProp<VDKCustomButton, VDKBox*> ButtonBox;
/*!
<read-only>
Permits to access embedded VDKLabel
\code
VDKLabel* label = button->Label;
if(label)
{
label->Text = "new text";
label->Justify = GTK_JUSTIFY_RIGHT;
}
\endcode
*/
VDKReadOnlyValueProp<VDKCustomButton, VDKLabel*> Label;
/*!
<read-only>
Permits to access embedded VDKImage
*/
VDKReadOnlyValueProp<VDKCustomButton, VDKImage*> Pixmap;
/*!
Permits to change button caption
*/
VDKReadWriteValueProp<VDKCustomButton, const char*> Caption;
/*!
Permits to change button caption wrap
*/
VDKReadWriteValueProp<VDKCustomButton, bool> CaptionWrap;
/*
!
Permits to set/get checked state (meaningless if isn't
a toggle button
*/
VDKReadWriteValueProp<VDKCustomButton, bool> Checked;
/*
!
Permits to set/get button relief (meaningless if is
a toggle button
*/
VDKReadWriteValueProp<VDKCustomButton, GtkReliefStyle> Relief;
/*!
Constructor, makes a labeled button
\param owner
\param label
\param type
\par type and toggle
<type> arg is used to determine if the button is toggled and if it is
a combo button or not
- toggled can be VDK_CBUTTON_TOGGLED or VDK_CBUTTON_UNTOGGLED
- type can be: VDK_CBUTTON_NORMAL or VDK_CBUTTON_COMBO
- toggled and type can be or'ed togheter except that
VDK_CBUTTON_TOGGLED | VDK_CBUTTON_COMBO does not produce a combo
toggled button.
\par accelerators
custom button support accelerators, setting an underline into button label
makes an accelerator.
\code
VDKCustomButton *button = new VDKCustomButton(this,"_A button");
\endcode
this makes that a clicked or toggled signal will be emitted using
alt+a keystroke.
*/
VDKCustomButton(VDKForm* owner,
const char* label,
unsigned int type =
VDK_CBUTTON_UNTOGGLED | VDK_CBUTTON_NORMAL);
/*!
Constructor, makes a pixmapped button.
\param pixfile
\param label
\param type
\param position, refers to label position into button box
*/
VDKCustomButton(VDKForm* owner,
const char* pixfile,
const char* label,
unsigned int type =
VDK_CBUTTON_UNTOGGLED | VDK_CBUTTON_NORMAL,
GtkPositionType position = GTK_POS_RIGHT);
/*!
Constructor, same as above but using pixdata instead a pix file.
*/
VDKCustomButton(VDKForm* owner,
const char** pixdata,
const char* label,
unsigned int type =
VDK_CBUTTON_UNTOGGLED | VDK_CBUTTON_NORMAL,
GtkPositionType position = GTK_POS_RIGHT);
~VDKCustomButton();
/*!
Sets a menu into combo button.
Meaningless if button isn't a combo button
*/
void SetComboMenu(VDKMenu* menu);
/*
*/
virtual void SetForeground(VDKRgb color,
GtkStateType state = GTK_STATE_NORMAL)
{
VDKLabel *label = Label;
if( label)
_setForeground_(label->Widget(),
color.red,
color.green,
color.blue,
state);
}
/*
*/
virtual void SetFont(VDKFont* font)
{
VDKLabel *label = Label;
if( label)
_setFont_(label->Widget(),font);
}
/*
*/
void SetCaption(const char* str)
{
VDKLabel *label = Label;
if( label)
label->Caption = str;
}
/*
*/
const char* GetCaption ()
{
VDKLabel *label = Label;
if( label)
return label->Caption;
else
return (const char*) NULL;
}
/*
*/
void SetCaptionWrap (bool flag)
{
VDKLabel *label = Label;
if( label)
gtk_label_set_line_wrap (GTK_LABEL (label->Widget()), flag);
}
/*
*/
bool GetCaptionWrap ()
{
VDKLabel *label = Label;
if( label)
return GTK_LABEL (label->Widget())->wrap;
else
return false;
}
/*
*/
void SetRelief(GtkReliefStyle style)
{
if(GTK_IS_BUTTON(widget))
gtk_button_set_relief(GTK_BUTTON(widget), style);
}
/*
*/
GtkReliefStyle GetRelief()
{
if(GTK_IS_BUTTON(widget))
return gtk_button_get_relief(GTK_BUTTON(widget));
else
return GTK_RELIEF_NORMAL;
}
/*
*/
void Toggle() {
if(GTK_IS_TOGGLE_BUTTON(widget))
Checked = Checked ? false : true;
}
/*
*/
void SetChecked(bool flag)
{
if(GTK_IS_TOGGLE_BUTTON(widget))
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(widget),flag);
}
/*
*/
bool GetChecked()
{
if(GTK_IS_TOGGLE_BUTTON(widget))
return GTK_TOGGLE_BUTTON(widget)->active ? true : false;
else
return false;
}
/*
*/
virtual void Enable(bool flag = true);
#ifdef USE_SIGCPLUSPLUS
public:
/*!
Extended LS signal system:
Received when button is toggled
\param bool state
*/
VDKSignal1<void, bool> OnButtonToggled;
/*!
Extended LS signal system:
Received when button is clicked
*/
VDKSignal0<void> OnButtonClicked;
/*!
Extended LS signal system:
Received when button is pressed
*/
VDKSignal0<void> OnButtonPressed;
/*!
Extended LS signal system:
Received when mouse leaves button
*/
VDKSignal0<void> OnButtonLeave;
private:
static void _handle_clicked(GtkWidget*, gpointer);
static void _handle_pressed(GtkWidget*, gpointer);
static void _handle_leave(GtkWidget*, gpointer);
#endif /* USE_SIGCPLUSPLUS */
};
#endif
|