ARB
aw_common_xm.hxx
Go to the documentation of this file.
1 // =========================================================== //
2 // //
3 // File : aw_common_xm.hxx //
4 // Purpose : //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in May 2011 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // =========================================================== //
11 
12 #ifndef AW_COMMON_XM_HXX
13 #define AW_COMMON_XM_HXX
14 
15 #ifndef AW_COMMON_HXX
16 #include "aw_common.hxx"
17 #endif
18 #ifndef X_H
19 #include <X11/X.h>
20 #endif
21 #ifndef _XLIB_H_
22 #include <X11/Xlib.h>
23 #endif
24 
25 
26 class AW_common_Xm;
27 
28 // @@@ misleading name (not motif dependent)
29 class AW_GC_Xm : public AW_GC { // derived from Noncopyable
30  GC gc;
31  XFontStruct curfont;
32 
33  virtual void wm_set_foreground_color(AW_rgb col);
34  virtual void wm_set_function(AW_function mode);
35  virtual void wm_set_lineattributes(short lwidth, AW_linestyle lstyle);
36  virtual void wm_set_font(AW_font font_nr, int size, int *found_size);
37 
38 public:
39 
40  AW_GC_Xm(AW_common *common);
41  ~AW_GC_Xm();
42 
43  // AW_GC interface (uses motif call)
44  virtual int get_available_fontsizes(AW_font font_nr, int *available_sizes) const;
45 
46  inline AW_common_Xm *get_common() const;
47 
48  GC get_gc() const { return gc; }
49  const XFontStruct *get_xfont() const { return &curfont; }
50 };
51 
52 // @@@ misleading name (not motif dependent)
53 class AW_common_Xm: public AW_common { // derived from Noncopyable
54  Display *display;
55  XID window_id;
56 
57  void install_common_extends_cb(AW_window *aww, AW_area area);
58 
59 public:
60  AW_common_Xm(Display *display_in,
61  XID window_id_in,
62  AW_rgb*& fcolors,
63  AW_rgb*& dcolors,
64  long& dcolors_count,
65  AW_window *aww,
66  AW_area area)
67  : AW_common(fcolors, dcolors, dcolors_count),
68  display(display_in),
69  window_id(window_id_in)
70  {
71  install_common_extends_cb(aww, area);
72  }
73 
74  virtual AW_GC *create_gc();
75 
76  const AW_GC_Xm *map_gc(int gc) const { return DOWNCAST(const AW_GC_Xm*, AW_common::map_gc(gc)); }
78 
79  Display *get_display() const { return display; }
80  XID get_window_id() const { return window_id; }
81 
82  GC get_GC(int gc) const { return map_gc(gc)->get_gc(); }
83  const XFontStruct *get_xfont(int gc) const { return map_gc(gc)->get_xfont(); }
84 };
85 
88 }
89 
90 #else
91 #error aw_common_xm.hxx included twice
92 #endif // AW_COMMON_XM_HXX
XID get_window_id() const
AW_GC * map_mod_gc(int gc)
Definition: aw_common.hxx:268
unsigned long AW_rgb
Definition: aw_base.hxx:51
AW_GC_Xm * map_mod_gc(int gc)
#define DOWNCAST(totype, expr)
Definition: downcast.h:141
AW_area
Definition: aw_base.hxx:76
AW_GC_Xm(AW_common *common)
Definition: AW_device.cxx:348
const XFontStruct * get_xfont() const
Display * get_display() const
const AW_GC * map_gc(int gc) const
Definition: aw_common.hxx:267
AW_common * get_common() const
Definition: aw_common.hxx:131
GC get_gc() const
const XFontStruct * get_xfont(int gc) const
GC get_GC(int gc) const
virtual int get_available_fontsizes(AW_font font_nr, int *available_sizes) const
Definition: AW_xfont.cxx:846
AW_common_Xm(Display *display_in, XID window_id_in, AW_rgb *&fcolors, AW_rgb *&dcolors, long &dcolors_count, AW_window *aww, AW_area area)
AW_function
Definition: aw_device.hxx:283
virtual AW_GC * create_gc()
Definition: AW_device.cxx:429
AW_common_Xm * get_common() const
AW_linestyle
Definition: aw_device.hxx:276
const AW_GC_Xm * map_gc(int gc) const