source: tags/ms_r16q2/WINDOW/aw_common_xm.hxx

Last change on this file was 13919, checked in by westram, 9 years ago
  • whitespace
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
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
26class AW_common_Xm;
27
28// @@@ misleading name (not motif dependent)
29class 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
38public:
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)
53class 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
59public:
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)); }
77    AW_GC_Xm *map_mod_gc(int gc) { return DOWNCAST(AW_GC_Xm*, AW_common::map_mod_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
86inline AW_common_Xm *AW_GC_Xm::get_common() const {
87    return DOWNCAST(AW_common_Xm*, AW_GC::get_common());
88}
89
90#else
91#error aw_common_xm.hxx included twice
92#endif // AW_COMMON_XM_HXX
Note: See TracBrowser for help on using the repository browser.