#include <Main/fg_props.hxx>
+class SGBinding;
+
class FGMenuBar;
class FGDialog;
-class FGBinding;
class FGColor;
class FGFontCache;
* @param name The name of the dialog box.
* @return node pointer if the dialog was found, zero otherwise.
*/
- virtual SGPropertyNode_ptr getDialog (const string &name);
+ virtual SGPropertyNode_ptr getDialogProperties (const string &name);
/**
* Return a pointer to the current menubar.
*/
virtual FGDialog * getActiveDialog ();
+
+ /**
+ * Get the named dialog if active.
+ *
+ * @return The named dialog, or 0 if it isn't active.
+ */
+ virtual FGDialog * getDialog (const string &name);
+
+
virtual FGColor *getColor (const char * name) const {
_citt_t it = _colors.find(name);
return (it != _colors.end()) ? it->second : NULL;
return (it != _colors.end()) ? it->second : NULL;
}
- virtual puFont *getDefaultFont() { return &_font; }
+ virtual puFont *getDefaultFont() { return _font; }
- /**
- * menu wide font cache, accessible from other classes as well.
- */
- FGFontCache *get_fontcache() { return _fontcache; }
-
protected:
- FGFontCache * _fontcache;
-
/**
* Test if the menubar is visible.
*
}
};
- fntTexFont _tex_font;
- puFont _font;
+ puFont *_font;
map<const char*,FGColor*, ltstr> _colors;
typedef map<const char*,FGColor*, ltstr>::iterator _itt_t;
typedef map<const char*,FGColor*, ltstr>::const_iterator _citt_t;
*/
class FGFontCache {
private:
+ struct fnt {
+ fnt(puFont *pu = 0) : pufont(pu), texfont(0) {}
+ ~fnt() { if (texfont) { delete pufont; delete texfont; } }
+ puFont *pufont;
+ fntTexFont *texfont;
+ };
SGPath _path;
- map<const char*,puFont*> _fonts;
- typedef map<const char*,puFont*>::iterator _itt_t;
+ map<const string,fnt *> _fonts;
+ typedef map<const string,fnt *>::const_iterator _itt_t;
+ bool _initialized;
+ struct fnt *getfnt(const char *name, float size, float slant);
public:
FGFontCache();
puFont *get(const char *name, float size=15.0, float slant=0.0);
puFont *get(SGPropertyNode *node);
+
+ fntTexFont *getTexFont(const char *name, float size=15.0, float slant=0.0);
+
+ SGPath getfntpath(const char *name);
};