/[adonthell]/adonthell-0.3/src/win_manager.cc
ViewVC logotype

Diff of /adonthell-0.3/src/win_manager.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by ksterker, Sun Sep 29 16:08:34 2002 UTC revision 1.12 by ksterker, Mon Oct 25 06:55:01 2004 UTC
# Line 30  win_manager* win_manager::active = NULL; Line 30  win_manager* win_manager::active = NULL;
30  // List of loaded themes  // List of loaded themes
31  hash_map<string, win_theme *> win_manager::theme;  hash_map<string, win_theme *> win_manager::theme;
32  // List of loaded fonts  // List of loaded fonts
33  hash_map<string, win_font *> win_manager::font;  hash_map<string, win_ttf *> win_manager::font;
34    // True type font to use
35  using namespace std;  string win_manager::font_file;
36    
37    
38  win_manager::win_manager ()  win_manager::win_manager ()
# Line 73  void win_manager::destroy() Line 73  void win_manager::destroy()
73      wnd_focus = NULL;      wnd_focus = NULL;
74  }  }
75    
76  void win_manager::init ()  void win_manager::init (const string & font)
77  {  {
78        font_file = font;
79        TTF_Init ();
80  }  }
81    
82  // Delete all fonts and themes  // Delete all fonts and themes
# Line 87  void win_manager::cleanup () Line 89  void win_manager::cleanup ()
89      theme.clear ();      theme.clear ();
90    
91      // Cleaning up fonts      // Cleaning up fonts
92      for (hash_map <string, win_font *>::iterator ifo = font.begin ();      for (hash_map <string, win_ttf *>::iterator ifo = font.begin ();
93           ifo != font.end (); ifo++)           ifo != font.end (); ifo++)
94          delete ifo->second;          delete ifo->second;
95      font.clear ();      font.clear ();
96        
97        TTF_Quit ();
98  }  }
99    
100  // add a window  // add a window
# Line 221  win_theme * win_manager::get_theme (stri Line 225  win_theme * win_manager::get_theme (stri
225  // load a font from disk  // load a font from disk
226  void win_manager::add_font (string name)  void win_manager::add_font (string name)
227  {  {
228      font[name] = new win_font ((char *) name.c_str ());      font[name] = new win_ttf ((char *) name.c_str (), font_file);
229  }  }
230    
231  // remove a font  // remove a font
232  bool win_manager::remove_font (string name)  bool win_manager::remove_font (string name)
233  {  {
234      hash_map <string, win_font *>::iterator it = font.find (name);      hash_map <string, win_ttf *>::iterator it = font.find (name);
235      if (it == font.end ()) return false;      if (it == font.end ()) return false;
236    
237      delete it->second;      delete it->second;
# Line 238  bool win_manager::remove_font (string na Line 242  bool win_manager::remove_font (string na
242  // return a pointer to a font  // return a pointer to a font
243  win_font * win_manager::get_font (string name)  win_font * win_manager::get_font (string name)
244  {  {
245      hash_map <string, win_font *>::iterator it = font.find (name);      hash_map <string, win_ttf *>::iterator it = font.find (name);
246            
247      // try to load the font if it's not in memory yet      // try to load the font if it's not in memory yet
248      if (it == font.end ())      if (it == font.end ())

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26