OpendTect-6_4  6.4
uifont.h
Go to the documentation of this file.
1 #ifndef uifont_h
2 #define uifont_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Lammertink
9  Date: 22/05/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 #include "uibasemod.h"
15 #include "fontdata.h"
16 #include "uistring.h"
17 
18 class uiFont;
19 class uiParent;
20 class BufferStringSet;
21 class Settings;
22 mFDQtclass(QFont)
23 mFDQtclass(QFontMetrics)
24 
25 
26 mGlobal(uiBase) bool selectFont(uiFont&,uiParent* =0,
27  const uiString& title=uiString::emptyString());
32 mGlobal(uiBase) bool selectFont(FontData&,uiParent* =0,
33  const uiString& title = uiString::emptyString());
39 mExpClass(uiBase) uiFont : public CallBacker
40 {
41 friend class uiFontList;
42 
43 public:
44  virtual ~uiFont();
45 
46  uiFont& operator=(const uiFont&);
47 
48  FontData fontData() const ;
49  void setFontData(const FontData&);
51  static void setFontData(mQtclass(QFont)&,const FontData&);
52  static void getFontData(FontData&,const mQtclass(QFont)&);
53  static mQtclass(QFont)* createQFont(const FontData&);
54 
55  inline const mQtclass(QFont&) qFont() const { return *qfont_; }
56 
57  int height() const;
58  int leading() const;
59  int maxWidth() const;
60  int avgWidth() const;
61  int width(const uiString&) const;
62  int ascent() const;
63  int descent() const;
64 
65  const char* key() const { return key_; }
67 
68 protected:
70  uiFont(const char* ky, const char* family,
73  bool it=FontData::defaultItalic());
74  uiFont(const char* ky,FontData fd=FontData());
75  uiFont(const uiFont&);
76 
77  // don't change order of these attributes!
78  mQtclass(QFont*) qfont_;
79  mQtclass(QFontMetrics&) qfontmetrics_;
80 
82 
83  void updateMetrics();
84 };
85 
86 
87 mExpClass(uiBase) uiFontList : public CallBacker
88 {
89 friend class uiFontSettingsGroup;
90 
91 public:
92 
93  uiFontList() : inited_(false) {}
94  ~uiFontList();
95  static uiFontList& getInst();
96 
97  int nrKeys();
98  const char* key(int);
99  void listKeys(BufferStringSet&);
100 
101  const ObjectSet<uiFont>& fonts() const { return fonts_; }
102  ObjectSet<uiFont>& fonts() { return fonts_; }
103 
104  uiFont& get(const char* ky=0);
105  uiFont& get(FontData::StdSz);
106  uiFont& getFromQfnt(mQtclass(QFont*));
107 
108  uiFont& add(const char* ky,const FontData&);
109  uiFont& add(const char* ky,
110  const char* f=FontData::defaultFamily(),
111  int ptsz=FontData::defaultPointSize(),
113  bool it=FontData::defaultItalic());
114 
115  void update(Settings&);
116 
117 protected:
118 
120  void initialise();
121  uiFont& gtFont(const char*,const FontData* =0,
122  const mQtclass(QFont*) =0 );
123 
124  void use(const Settings&);
125 
126 private:
127 
128  bool inited_;
129 
130  void addOldGuess(const IOPar&,const char*);
131  void removeOldEntries(Settings&);
132  void setDefaults();
133 
134 };
135 
136 #define FontList uiFontList::getInst
137 
138 #endif
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
static bool defaultItalic()
uiFontList()
Definition: uifont.h:93
#define mQtclass(cls)
Definition: commondefs.h:229
#define mGlobal(module)
Definition: commondefs.h:163
bool inited_
Definition: uifont.h:128
Definition: uifont.h:39
Definition: uistring.h:89
mFDQtclass(QFont) mFDQtclass(QFontMetrics) bool selectFont(uiFont &
Definition: uiparent.h:26
Definition: uifont.h:87
Set of BufferString objects.
Definition: bufstringset.h:28
Weight
Definition: fontdata.h:24
Data needed to make an actual font.
Definition: fontdata.h:20
ObjectSet< uiFont > & fonts()
Definition: uifont.h:102
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Settings class holds the user settings. It is an IOPar.
Definition: settings.h:34
const mQtclass(QFont &) qFont() const
Definition: uifont.h:55
static const char * defaultFamily()
uiParent const uiString & title
pops a selector box to select a new font
Definition: uifont.h:27
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
const ObjectSet< uiFont > & fonts() const
Definition: uifont.h:101
Definition: uifontsel.h:28
bool selectFont(FontData &, uiParent *=0, const uiString &title=uiString::emptyString())
pops a selector box to select a new font
StdSz
Definition: fontdata.h:65
ObjectSet< uiFont > fonts_
Definition: uifont.h:119
Notifier< uiFont > changed
Definition: uifont.h:66
const char * key() const
Definition: uifont.h:65
static Weight defaultWeight()
static int defaultPointSize()

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019