This example adds to XT Example 2 by adding a background color to the window.
New concepts include:
Create a file named "demo_xt3.cpp" with the contents shown in the
box (the changes from demo_xt2.cpp are highlighted):
#include <X11/IntrinsicP.h> // IntrinsicP.h has some faster macros than Intrinsic.h #include <X11/ShellP.h> // Needed for Widget class definitions #include <stdio.h> //fprintf, stderr //------------------------------------------------ // This function is called by a ButtonPress event in the main widget // Button 1 is the loft mouse button, Button 3 is the right button, // Button 2 is the middle button (or the left & right button pressed together) // Button 3 quits the program void EvProc(Widget w, XtPointer client_data, XEvent *event, char* CTmp) { } //------------------------------------------------ void main (int argc, char **argv) { //--- Create and initialize the top-level widget //--- Make it the desired size //--- Realize the main widget //Save main widget Window & Display values //--- Load default colormap and allocate a color close to the desired background color //--- Add Mouse Button Event Handler //----- } |