Adonthell
0.4
|
00001 /* 00002 $Id: text_bubble.cc,v 1.7 2002/06/28 12:15:21 gnurou Exp $ 00003 00004 Copyright (C) 2001/2002 Kai Sterker <kaisterker@linuxgames.com> 00005 Copyright (C) 2001 Alexandre Courbot <alexandrecourbot@linuxgames.com> 00006 Part of the Adonthell Project http://adonthell.linuxgames.com 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 00017 /** 00018 * @file text_bubble.cc 00019 * @author Kai Sterker <kaisterker@linuxgames.com> 00020 * @author Alexandre Courbot <alexandrecourbot@linuxgames.com> 00021 * 00022 * @brief Defines the text_bubble class. 00023 * 00024 * 00025 */ 00026 00027 #include "nls.h" 00028 #include "text_bubble.h" 00029 #include "win_manager.h" 00030 00031 text_bubble::text_bubble (const string & text, const string & textcolor, 00032 const string & themename, u_int16 len) : win_label () 00033 { 00034 remain = 75 + text.length () * 4; 00035 00036 win_font * font = win_manager::get_font (textcolor); 00037 win_theme * theme = win_manager::get_theme (themename); 00038 00039 set_font (*font); 00040 set_background (*theme); 00041 set_border (*theme, win_border::MINI); 00042 00043 label::resize (len, 0); 00044 set_form (label::AUTO_HEIGHT); 00045 set_text (nls::translate (text)); 00046 set_visible_border (true); 00047 set_visible_background (true); 00048 set_trans_background (true); 00049 set_visible (true); 00050 pack (); 00051 } 00052 00053 text_bubble::~text_bubble () 00054 { 00055 } 00056 00057 bool text_bubble::update () 00058 { 00059 if (win_label::update ()) 00060 { 00061 remain--; 00062 if (!remain) return false; 00063 } 00064 return true; 00065 }