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 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/toolx/Xt/ImageArea (Version 11.3.0) and /externals/g4tools/include/toolx/Xt/ImageArea (Version 10.0.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef toolx_Xt_ImageArea                        
  5 #define toolx_Xt_ImageArea                        
  6                                                   
  7 #include <X11/IntrinsicP.h>                       
  8 #include <X11/CoreP.h>                            
  9 #include <X11/CompositeP.h>                       
 10 #include <X11/StringDefs.h>                       
 11                                                   
 12 //#define TOOLX_XT_IMAGEAREA_DEBUG                
 13                                                   
 14 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
 15 #include <stdio.h>                                
 16 #endif                                            
 17                                                   
 18 namespace toolx {                                 
 19 namespace Xt {                                    
 20                                                   
 21 //////////////////////////////////////////////    
 22 //////////////////////////////////////////////    
 23 //////////////////////////////////////////////    
 24                                                   
 25 typedef struct _ImageAreaClassRec* ImageAreaWi    
 26 typedef struct _ImageAreaRec* ImageAreaWidget;    
 27                                                   
 28 //////////////////////////////////////////////    
 29 //////////////////////////////////////////////    
 30 //////////////////////////////////////////////    
 31                                                   
 32 typedef struct {                                  
 33   void* extension;                                
 34 } ImageAreaClassPart;                             
 35                                                   
 36 typedef struct _ImageAreaClassRec {               
 37   CoreClassPart core_class;                       
 38   CompositeClassPart composite_class;             
 39   ImageAreaClassPart imageArea_class;             
 40 } ImageAreaClassRec;                              
 41                                                   
 42 typedef struct {                                  
 43   XtCallbackList resizeCallback;                  
 44   XtCallbackList paintCallback;                   
 45   XtCallbackList eventCallback;                   
 46 } ImageAreaPart;                                  
 47                                                   
 48 typedef struct _ImageAreaRec {                    
 49   CorePart core;                                  
 50   CompositePart composite;                        
 51   ImageAreaPart imageArea;                        
 52 } ImageAreaRec;                                   
 53                                                   
 54 //////////////////////////////////////////////    
 55 //////////////////////////////////////////////    
 56 //////////////////////////////////////////////    
 57                                                   
 58 class ImageArea {                                 
 59 protected:                                        
 60   static const char* class_name() {static cons    
 61 public:                                           
 62   typedef struct {                                
 63     int reason;                                   
 64     XEvent* event;                                
 65   } XoAnyCallbackStruct;                          
 66                                                   
 67   static int XoCR_RESIZE() {return 1;}            
 68   static int XoCR_PAINT()  {return 2;}            
 69   static int XoCR_EVENT()  {return 3;}            
 70                                                   
 71   static const char* XoN_resizeCallback() {sta    
 72   static const char* XoN_paintCallback()  {sta    
 73   static const char* XoN_eventCallback()  {sta    
 74 public:                                           
 75   static void paint(Widget a_this) {              
 76     if(!XtIsRealized(a_this)) return;             
 77     XoAnyCallbackStruct value;                    
 78     value.reason = XoCR_PAINT();                  
 79     value.event = 0;                              
 80     ::XtCallCallbacks(a_this,XoN_paintCallback    
 81   }                                               
 82 protected:                                        
 83   static void initialize_class(void) {            
 84 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
 85     ::printf("debug: toolx::Xt::ImageArea: ini    
 86 #endif                                            
 87   }                                               
 88                                                   
 89   static void initialize_widget(Widget a_reque    
 90     if(a_request->core.width<=0)  a_this->core    
 91     if(a_request->core.height<=0) a_this->core    
 92                                                   
 93 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
 94     ::printf("debug: toolx::Xt::ImageArea: ini    
 95 #endif                                            
 96                                                   
 97     ::XtAddEventHandler                           
 98        (a_this,ButtonPressMask|ButtonReleaseMa    
 99                                                   
100 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
101     ::printf("debug: toolx::Xt::ImageArea: ini    
102 #endif                                            
103   }                                               
104                                                   
105   static void destroy_widget(Widget) {            
106 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
107     ::printf("debug: toolx::Xt::ImageArea: des    
108 #endif                                            
109   }                                               
110                                                   
111   static void change_widget_size(Widget a_this    
112 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
113     ::printf("debug: toolx::Xt::ImageArea: cha    
114 #endif                                            
115                                                   
116     if(widget_class()->core_class.superclass->    
117       (widget_class()->core_class.superclass->    
118                                                   
119     XoAnyCallbackStruct value;                    
120     value.reason = XoCR_RESIZE();                 
121     value.event = 0;                              
122     ::XtCallCallbacks(a_this,XoN_resizeCallbac    
123                                                   
124 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
125     ::printf("debug: toolx::Xt::ImageArea: cha    
126 #endif                                            
127 }                                                 
128                                                   
129   static void draw_widget(Widget  a_this,XEven    
130 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
131     ::printf("debug: toolx::Xt::ImageArea: dra    
132 #endif                                            
133                                                   
134     if(widget_class()->core_class.superclass->    
135       (widget_class()->core_class.superclass->    
136                                                   
137     XoAnyCallbackStruct value;                    
138     value.reason = XoCR_PAINT();                  
139     value.event = a_event;                        
140     ::XtCallCallbacks(a_this,XoN_paintCallback    
141                                                   
142 #ifdef TOOLX_XT_IMAGEAREA_DEBUG                   
143     ::printf("debug: toolx::Xt::ImageArea: dra    
144 #endif                                            
145   }                                               
146                                                   
147 protected:                                        
148   static void event_handler(Widget a_this,XtPo    
149     XoAnyCallbackStruct value;                    
150     value.reason = XoCR_EVENT();                  
151     value.event = a_event;                        
152     ::XtCallCallbacks(a_this,XoN_eventCallback    
153   }                                               
154                                                   
155 public:                                           
156   static WidgetClass widget_class() {             
157     static XtResource s_resources[] = {           
158       {(String)XoN_resizeCallback(),XtCCallbac    
159        XtOffset(ImageAreaWidget,imageArea.resi    
160       {(String)XoN_paintCallback(),XtCCallback    
161        XtOffset(ImageAreaWidget,imageArea.pain    
162       {(String)XoN_eventCallback(),XtCCallback    
163        XtOffset(ImageAreaWidget,imageArea.even    
164     };                                            
165                                                   
166     static ImageAreaClassRec s_imageAreaClassR    
167       // Core Class Part :                        
168       {                                           
169         (WidgetClass) &compositeClassRec, // p    
170         (String)class_name(),             // w    
171         sizeof(ImageAreaRec),            // si    
172         initialize_class,                // cl    
173         NULL,                            // dy    
174         FALSE,                           // ha    
175         initialize_widget,               // in    
176         NULL,                            // no    
177         XtInheritRealize,                // XC    
178         NULL,                            // wi    
179         0,                               // nu    
180         s_resources,                     // re    
181         XtNumber(s_resources),           // nu    
182         NULLQUARK,                       // re    
183         TRUE,                            // co    
184         TRUE,                            // co    
185         TRUE,                            // co    
186         TRUE,                            // se    
187         destroy_widget,                  // fr    
188         change_widget_size,              // ge    
189         draw_widget,                     // re    
190         NULL,                            // se    
191         NULL,                            // no    
192         XtInheritSetValuesAlmost,        // Se    
193         NULL,                            // no    
194         XtInheritAcceptFocus,            // as    
195         XtVersion,                       // ve    
196         NULL,                            // li    
197         XtInheritTranslations,           // tr    
198         XtInheritQueryGeometry,          // re    
199         XtInheritDisplayAccelerator,     // di    
200         NULL                             // po    
201       },                                          
202       // Composite Class Part :                   
203       {                                           
204         XtInheritGeometryManager,   // geometr    
205         XtInheritChangeManaged,     // change     
206         XtInheritInsertChild,       // physica    
207         XtInheritDeleteChild,       // physica    
208         NULL                        // pointer    
209       },                                          
210       // ImageArea :                              
211       {                                           
212         NULL                                      
213       }                                           
214     };                                            
215     return (WidgetClass)&s_imageAreaClassRec;     
216   }                                               
217 };                                                
218                                                   
219 }}                                                
220                                                   
221                                                   
222 #endif