cwidget
0.5.16
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
cwidget
widgets
label.h
1
// label.h -*-c++-*-
2
3
#ifndef LABEL_H
4
#define LABEL_H
5
6
#include "widget.h"
7
8
namespace
cwidget
9
{
10
class
fragment;
11
class
fragment_cache;
12
13
namespace
widgets
14
{
24
class
label
:
public
widget
25
{
26
fragment_cache
*txt;
27
protected
:
28
label
(
fragment
*f);
29
label
(
const
std::string &_txt,
const
style
&st);
30
label
(
const
std::string &_txt);
31
label
(
const
std::wstring &_txt,
const
style
&st);
32
label
(
const
std::wstring &_txt);
33
34
public
:
35
static
util::ref_ptr<label>
create(
fragment
*f)
36
{
37
util::ref_ptr<label>
rval(
new
label
(f));
38
rval->decref();
39
return
rval;
40
}
41
43
static
util::ref_ptr<label>
create(
const
std::string &txt,
const
style
&st);
44
46
static
util::ref_ptr<label>
create(
const
std::string &txt);
47
49
static
util::ref_ptr<label>
create(
const
std::wstring &txt,
const
style
&st);
50
52
static
util::ref_ptr<label>
create(
const
std::wstring &txt);
53
54
55
~
label
();
56
57
bool
get_cursorvisible();
58
point
get_cursorloc();
59
61
int
width_request
();
62
64
int
height_request
(
int
width);
65
66
void
paint
(
const
style
&st);
67
void
set_text(
const
std::string &_txt,
const
style
&st);
68
void
set_text(
const
std::string &_txt);
69
void
set_text(
const
std::wstring &_txt,
const
style
&st);
70
void
set_text(
const
std::wstring &_txt);
71
void
set_text(
fragment
*f);
72
};
73
74
class
transientlabel
:
public
label
75
// Displays a transient message -- grabs the input focus and vanishes when a
76
// key is pressed.
77
{
78
protected
:
79
virtual
bool
handle_char(chtype ch);
80
81
transientlabel
(
const
std::string &msg,
const
style
&st)
82
:
label
(msg, st)
83
{
84
}
85
public
:
86
static
87
util::ref_ptr<transientlabel>
create
(
const
std::string &msg,
88
const
style
&st)
89
{
90
return
new
transientlabel
(msg, st);
91
}
92
93
bool
focus_me() {
return
true
;}
94
};
95
96
typedef
util::ref_ptr<label> label_ref;
97
98
typedef
util::ref_ptr<transientlabel> transientlabel_ref;
99
}
100
}
101
102
#endif
Generated on Tue Jun 26 2012 10:39:47 for cwidget by
1.8.1.1