1 | #ifndef AW_COMMN_HXX |
---|
2 | #define AW_COMMN_HXX |
---|
3 | |
---|
4 | #define AW_INT(x) ( ((x)>=0) ? (int) ((x)+.5):(int )((x)-.5) ) |
---|
5 | |
---|
6 | class AW_GC_Xm { |
---|
7 | public: |
---|
8 | GC gc; |
---|
9 | class AW_common *common; |
---|
10 | XFontStruct curfont; |
---|
11 | short width_of_chars[256]; |
---|
12 | short ascent_of_chars[256]; |
---|
13 | short descent_of_chars[256]; |
---|
14 | AW_font_information fontinfo; |
---|
15 | short line_width; |
---|
16 | AW_linestyle style; |
---|
17 | short color; |
---|
18 | unsigned long last_fg_color; |
---|
19 | unsigned long last_bg_color; |
---|
20 | |
---|
21 | short fontsize; |
---|
22 | AW_font fontnr; |
---|
23 | |
---|
24 | AW_function function; |
---|
25 | AW_pos grey_level; |
---|
26 | |
---|
27 | AW_GC_Xm(class AW_common *common); |
---|
28 | ~AW_GC_Xm(); |
---|
29 | void set_fill(AW_grey_level grey_level); // <0 dont fill 0.0 white 1.0 black |
---|
30 | void set_font(AW_font font_nr, int size, int *found_size); |
---|
31 | void set_lineattributes(AW_pos width, AW_linestyle style); |
---|
32 | void set_function(AW_function function); |
---|
33 | void set_foreground_color(unsigned long color); |
---|
34 | void set_background_color(unsigned long color); |
---|
35 | |
---|
36 | int get_available_fontsizes(AW_font font_nr, int *available_sizes); |
---|
37 | }; |
---|
38 | |
---|
39 | |
---|
40 | class AW_common { |
---|
41 | public: |
---|
42 | AW_common(AW_window *aww, AW_area area, Display *display_in, |
---|
43 | XID window_id_in,unsigned long *fcolors, |
---|
44 | unsigned int **dcolors, long *data_colors_size); |
---|
45 | |
---|
46 | unsigned long *frame_colors; |
---|
47 | unsigned long **data_colors; |
---|
48 | long *data_colors_size; |
---|
49 | AW_root *root; |
---|
50 | AW_rectangle screen; |
---|
51 | int screen_x_offset; |
---|
52 | int screen_y_offset; |
---|
53 | AW_GC_Xm **gcs; |
---|
54 | int ngcs; |
---|
55 | Display *display; |
---|
56 | XID window_id; |
---|
57 | |
---|
58 | AW_pos x_alignment(AW_pos x_pos,AW_pos x_size,AW_pos alignment) { return x_pos- x_size*alignment; }; |
---|
59 | }; |
---|
60 | |
---|
61 | |
---|
62 | // #define AW_MAP_GC(gc) (aw_assert(gc<common->ngcs), common->gcs[gc]) |
---|
63 | |
---|
64 | inline bool AW_GC_MAPABLE(AW_common *common, int gc) { |
---|
65 | return gc<common->ngcs && common->gcs[gc] != 0; |
---|
66 | } |
---|
67 | |
---|
68 | inline AW_GC_Xm *AW_MAP_GC_tested(AW_common *common, int gc) { |
---|
69 | aw_assert(AW_GC_MAPABLE(common, gc)); |
---|
70 | return common->gcs[gc]; |
---|
71 | } |
---|
72 | #define AW_MAP_GC(gc) AW_MAP_GC_tested(common, gc) |
---|
73 | |
---|
74 | #else |
---|
75 | #error aw_commn.hxx included twice |
---|
76 | #endif |
---|