CMS 3D CMS Logo

GlobalContexts.cc
Go to the documentation of this file.
2 
3 #include "TGClient.h"
4 #include "TVirtualX.h"
5 #include "TSystem.h"
6 #include "TGFont.h"
7 #include "TGResourcePool.h"
8 #include "TGGC.h"
9 
10 namespace fireworks {
11  const TGGC& boldGC() {
12  static TGGC s_boldGC(*gClient->GetResourcePool()->GetFrameGC());
13 
14  TGFontPool* pool = gClient->GetFontPool();
15  //TGFont *font = pool->FindFontByHandle(s_boldGC.GetFont());
16  //FontAttributes_t attributes = font->GetFontAttributes();
17 
18  /*
19  This doesn't seem to work:
20  attributes.fWeight = 1;
21  TGFont *newFont = pool->GetFont(attributes.fFamily, 9,
22  attributes.fWeight, attributes.fSlant);
23 
24  But this does:
25  */
26 
27  TGFont* newFont = pool->GetFont("-*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
28 
29  if (!newFont)
30  return s_boldGC;
31 
32  s_boldGC.SetFont(newFont->GetFontHandle());
33 
34  return s_boldGC;
35  }
36 
37  const TGGC& greenGC() {
38  static TGGC s_greenGC(*gClient->GetResourcePool()->GetFrameGC());
39  s_greenGC.SetForeground(gVirtualX->GetPixel(kGreen - 5));
40  return s_greenGC;
41  }
42 
43  const TGGC& redGC() {
44  static TGGC s_redGC(*gClient->GetResourcePool()->GetFrameGC());
45  s_redGC.SetForeground(gVirtualX->GetPixel(kRed - 5));
46  return s_redGC;
47  }
48 
49  const TGGC& italicGC() {
50  static TGGC s_italicGC(*gClient->GetResourcePool()->GetFrameGC());
51 
52  TGFontPool* pool = gClient->GetFontPool();
53  TGFont* font = pool->FindFontByHandle(s_italicGC.GetFont());
54  FontAttributes_t attributes = font->GetFontAttributes();
55 
56  attributes.fSlant = 1;
57  TGFont* newFont = pool->GetFont(attributes.fFamily, 9, attributes.fWeight, attributes.fSlant);
58 
59  s_italicGC.SetFont(newFont->GetFontHandle());
60 
61  return s_italicGC;
62  }
63 } // namespace fireworks
fireworks::boldGC
const TGGC & boldGC()
Definition: GlobalContexts.cc:11
fireworks::greenGC
const TGGC & greenGC()
Definition: GlobalContexts.cc:37
fireworks::italicGC
const TGGC & italicGC()
Definition: GlobalContexts.cc:49
fireworks::redGC
const TGGC & redGC()
Definition: GlobalContexts.cc:43
GlobalContexts.h
fireworks
Definition: FWTauProxyBuilderBase.h:35
submitPVResolutionJobs.pool
pool
Definition: submitPVResolutionJobs.py:351