Adonthell  0.4
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 
54 {
55 }
56 
58 {
59  if (win_label::update ())
60  {
61  remain--;
62  if (!remain) return false;
63  }
64  return true;
65 }
static win_font * get_font(string name)
Returns a pointer to a font.
Definition: win_manager.cc:243
bool update()
Update process.
Definition: win_object.h:113
text_bubble(const string &text, const string &textcolor, const string &themename, u_int16 len=110)
Constructor.
Definition: text_bubble.cc:31
#define u_int16
16 bits long unsigned integer
Definition: types.h:32
static win_theme * get_theme(string name)
Returns a pointer to a theme.
Definition: win_manager.cc:212
void set_visible(const bool b)
Set the visible parameter.
Definition: win_base.h:136
Declares the text_bubble class.
bool update()
Update function.
Definition: text_bubble.cc:57
National Language Support.
void resize(u_int16 l, u_int16 h)
Resize the label.
Definition: label.cc:111
static const char * translate(const string &text)
Translate the given string if it&#39;s found in the message catalogue.
Definition: nls.cc:73
Declares the win_manager class.
~text_bubble()
Destructor.
Definition: text_bubble.cc:53