cwidget
0.5.16
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
cwidget
widgets
button.h
1
// button.h -*-c++-*-
2
//
3
// A button is just a widget which accepts keyboard focus and can be
4
// "pressed". I'm going to make a stab at sharing code between
5
// normal buttons, radio buttons, and checkbuttons..this may not be
6
// worth it..
7
8
#ifndef BUTTON_H
9
#define BUTTON_H
10
11
#include "widget.h"
12
13
#include <string>
14
15
namespace
cwidget
16
{
17
class
fragment;
18
class
fragment_cache;
19
20
namespace
widgets
21
{
23
class
button
:
public
widget
24
{
25
fragment_cache
*
label
;
26
27
void
accept_focus();
28
void
lose_focus();
29
30
protected
:
31
bool
handle_key
(
const
config::key
&k);
32
fragment_cache
*get_label()
const
{
return
label
;}
33
39
button
(
const
std::wstring &_label);
40
button
(
fragment
*_label);
41
button
(
const
std::string &_label);
42
public
:
43
44
~
button
();
45
46
static
util::ref_ptr<button>
47
create(
const
std::wstring &
label
)
48
{
49
util::ref_ptr<button>
rval(
new
button
(label));
50
// Remove the initial construction reference.
51
rval->decref();
52
return
rval;
53
}
54
60
static
util::ref_ptr<button>
create(
fragment
*label)
61
{
62
util::ref_ptr<button>
rval(
new
button
(label));
63
rval->decref();
64
return
rval;
65
}
66
72
static
util::ref_ptr<button>
create(
const
std::string &label)
73
{
74
util::ref_ptr<button>
rval(
new
button
(label));
75
rval->decref();
76
return
rval;
77
}
78
79
void
paint
(
const
style
&st);
80
81
bool
get_cursorvisible();
82
point
get_cursorloc();
83
bool
focus_me();
84
85
int
width_request
();
86
int
height_request
(
int
width);
87
void
dispatch_mouse(
short
id
,
int
x,
int
y,
int
z, mmask_t bmask);
88
89
void
set_label(
const
fragment
*_label);
90
91
// Signals:
92
93
// The button has been "pressed" (activated)
94
sigc::signal0<void> pressed;
95
};
96
97
typedef
util::ref_ptr<button>
button_ref
;
98
}
99
}
100
101
#endif
Generated on Tue Mar 18 2014 22:48:00 for cwidget by
1.8.1.2