Adonthell
0.4
Main Page
Related Pages
Classes
Files
File List
File Members
text_bubble.cc
Go to the documentation of this file.
1
/*
2
$Id: text_bubble.cc,v 1.7 2002/06/28 12:15:21 gnurou Exp $
3
4
Copyright (C) 2001/2002 Kai Sterker <kaisterker@linuxgames.com>
5
Copyright (C) 2001 Alexandre Courbot <alexandrecourbot@linuxgames.com>
6
Part of the Adonthell Project http://adonthell.linuxgames.com
7
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU General Public License.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY.
12
13
See the COPYING file for more details.
14
*/
15
16
17
/**
18
* @file text_bubble.cc
19
* @author Kai Sterker <kaisterker@linuxgames.com>
20
* @author Alexandre Courbot <alexandrecourbot@linuxgames.com>
21
*
22
* @brief Defines the text_bubble class.
23
*
24
*
25
*/
26
27
#include "
nls.h
"
28
#include "
text_bubble.h
"
29
#include "
win_manager.h
"
30
31
text_bubble::text_bubble
(
const
string
& text,
const
string
& textcolor,
32
const
string
& themename,
u_int16
len) :
win_label
()
33
{
34
remain = 75 + text.length () * 4;
35
36
win_font
* font =
win_manager::get_font
(textcolor);
37
win_theme
* theme =
win_manager::get_theme
(themename);
38
39
set_font (*font);
40
set_background (*theme);
41
set_border (*theme, win_border::MINI);
42
43
label::resize
(len, 0);
44
set_form (label::AUTO_HEIGHT);
45
set_text (
nls::translate
(text));
46
set_visible_border (
true
);
47
set_visible_background (
true
);
48
set_trans_background (
true
);
49
set_visible
(
true
);
50
pack ();
51
}
52
53
text_bubble::~text_bubble
()
54
{
55
}
56
57
bool
text_bubble::update
()
58
{
59
if
(
win_label::update
())
60
{
61
remain--;
62
if
(!remain)
return
false
;
63
}
64
return
true
;
65
}
win_manager::get_font
static win_font * get_font(string name)
Returns a pointer to a font.
Definition:
win_manager.cc:243
win_object::update
bool update()
Update process.
Definition:
win_object.h:113
text_bubble::text_bubble
text_bubble(const string &text, const string &textcolor, const string &themename, u_int16 len=110)
Constructor.
Definition:
text_bubble.cc:31
u_int16
#define u_int16
16 bits long unsigned integer
Definition:
types.h:32
win_manager::get_theme
static win_theme * get_theme(string name)
Returns a pointer to a theme.
Definition:
win_manager.cc:212
win_base::set_visible
void set_visible(const bool b)
Set the visible parameter.
Definition:
win_base.h:136
text_bubble.h
Declares the text_bubble class.
text_bubble::update
bool update()
Update function.
Definition:
text_bubble.cc:57
nls.h
National Language Support.
win_theme
Definition:
win_theme.h:20
win_object
Definition:
win_object.h:22
label::resize
void resize(u_int16 l, u_int16 h)
Resize the label.
Definition:
label.cc:111
nls::translate
static const char * translate(const string &text)
Translate the given string if it's found in the message catalogue.
Definition:
nls.cc:73
win_font
Definition:
win_font.h:32
win_manager.h
Declares the win_manager class.
text_bubble::~text_bubble
~text_bubble()
Destructor.
Definition:
text_bubble.cc:53
src
text_bubble.cc
Generated by
1.8.11