Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:33

0001 #include "Fireworks/TableWidget/interface/GlobalContexts.h"
0002 
0003 #include "TGClient.h"
0004 #include "TVirtualX.h"
0005 #include "TSystem.h"
0006 #include "TGFont.h"
0007 #include "TGResourcePool.h"
0008 #include "TGGC.h"
0009 
0010 namespace fireworks {
0011   const TGGC& boldGC() {
0012     static TGGC s_boldGC(*gClient->GetResourcePool()->GetFrameGC());
0013 
0014     TGFontPool* pool = gClient->GetFontPool();
0015     //TGFont *font = pool->FindFontByHandle(s_boldGC.GetFont());
0016     //FontAttributes_t attributes = font->GetFontAttributes();
0017 
0018     /*
0019      This doesn't seem to work:
0020      attributes.fWeight = 1; 
0021      TGFont *newFont = pool->GetFont(attributes.fFamily, 9,
0022      attributes.fWeight, attributes.fSlant);
0023 
0024      But this does:
0025    */
0026 
0027     TGFont* newFont = pool->GetFont("-*-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
0028 
0029     if (!newFont)
0030       return s_boldGC;
0031 
0032     s_boldGC.SetFont(newFont->GetFontHandle());
0033 
0034     return s_boldGC;
0035   }
0036 
0037   const TGGC& greenGC() {
0038     static TGGC s_greenGC(*gClient->GetResourcePool()->GetFrameGC());
0039     s_greenGC.SetForeground(gVirtualX->GetPixel(kGreen - 5));
0040     return s_greenGC;
0041   }
0042 
0043   const TGGC& redGC() {
0044     static TGGC s_redGC(*gClient->GetResourcePool()->GetFrameGC());
0045     s_redGC.SetForeground(gVirtualX->GetPixel(kRed - 5));
0046     return s_redGC;
0047   }
0048 
0049   const TGGC& italicGC() {
0050     static TGGC s_italicGC(*gClient->GetResourcePool()->GetFrameGC());
0051 
0052     TGFontPool* pool = gClient->GetFontPool();
0053     TGFont* font = pool->FindFontByHandle(s_italicGC.GetFont());
0054     FontAttributes_t attributes = font->GetFontAttributes();
0055 
0056     attributes.fSlant = 1;
0057     TGFont* newFont = pool->GetFont(attributes.fFamily, 9, attributes.fWeight, attributes.fSlant);
0058 
0059     s_italicGC.SetFont(newFont->GetFontHandle());
0060 
0061     return s_italicGC;
0062   }
0063 }  // namespace fireworks