home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / ui / visualob.h < prev    next >
C/C++ Source or Header  |  1995-04-08  |  26KB  |  751 lines

  1.  
  2.  
  3. #ifndef _visualobj_h_
  4. #define _visualobj_h_
  5.  
  6.  
  7.  
  8.  
  9.  
  10. /*
  11.  *
  12.  *          Copyright (C) 1994, M. A. Sridhar
  13.  *  
  14.  *
  15.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  16.  *     to copy, modify or distribute this software  as you see fit,
  17.  *     and to use  it  for  any  purpose, provided   this copyright
  18.  *     notice and the following   disclaimer are included  with all
  19.  *     copies.
  20.  *
  21.  *                        DISCLAIMER
  22.  *
  23.  *     The author makes no warranties, either expressed or implied,
  24.  *     with respect  to  this  software, its  quality, performance,
  25.  *     merchantability, or fitness for any particular purpose. This
  26.  *     software is distributed  AS IS.  The  user of this  software
  27.  *     assumes all risks  as to its quality  and performance. In no
  28.  *     event shall the author be liable for any direct, indirect or
  29.  *     consequential damages, even if the  author has been  advised
  30.  *     as to the possibility of such damages.
  31.  *
  32.  */
  33.  
  34.  
  35.  
  36. #if defined(__GNUC__)
  37. #pragma interface
  38. #endif
  39.  
  40.  
  41.  
  42. #include "base/map.h"
  43. #include "base/clntset.h"
  44.  
  45. #include "ui/uidefs.h"
  46. #include "ui/rectangl.h"
  47. #include "ui/event.h"
  48. #include "ui/cursor.h"
  49. #include "ui/font.h"
  50. #include "ui/color.h"
  51.  
  52. class CL_EXPORT UI_Dialog;
  53. class CL_EXPORT UI_VObjCollection;
  54. class CL_EXPORT UI_CompositeVObject;
  55. class CL_EXPORT UI_Controller;
  56. class CL_EXPORT UI_Application;
  57. class CL_EXPORT UI_DisplaySurface;
  58.  
  59.  
  60. // This  class is the root of the inheritance hierarchy for the GUI
  61. // objects of YACL. It encapsulates the common features of a View (or a
  62. // window). A View is any visible area on the desktop available to the 
  63. // user for input, output or both. Every  View is divided into two parts-
  64. // the client area and the non client area. As the name suggests the 
  65. // client area is the one available to the user for interaction while
  66. // the nonclient area is used by the system for its use.
  67. // The coordinates of the rectangle are always interpreted relative to 
  68. // the parent's top left corner.
  69. //
  70. // YACL does not allow views as C++ static objects. Nor can a VisualObject 
  71. // be explicitly destroyed. That is, {\it never\/} do a {\tt delete} of a
  72. // VisualObject or any of its derivatives! In order to destroy a
  73. // VisualObject, it must
  74. // be sent an {\small\tt Event_Destroy} via the controller. Before it is
  75. // destroyed, 
  76. // the method WantToQuit() is invoked; if the latter returns TRUE, then the
  77. // controller destroys the view and all its children. This
  78. // method may be overriden in derived classes. A VisualObject may also be
  79. // unequivocally destroyed by sending it an Event_Quit.
  80. //
  81. // Every VisualObject inherits two static protected instance variables {\tt
  82. // _Application} and {\tt _Controller}, which are respectively the
  83. // application and controller pointers for this application.
  84. // 
  85. // Of special interest is the method HandleEvent (UI_Event* );
  86. // All events originating in a VisualObject are passed to the HandleEvent
  87. // method oh that VisualObject which provides default interpretation
  88. // to these events by invoking the corresponding method outlined in
  89. // the protected section. Being virtual, all these methods may be overwrriten
  90. // in derived classes so that individual VisualObjects may interpret the
  91. // same event differently. The HandleEvent () method may also be overriden-but
  92. // must only be done after a clear understanding of how YACL works.
  93. //
  94. //     Every visual object exports a method \\
  95. //          {\small\tt    UI_Font& UI_VisualObject::Font() }\\
  96. // which returns a reference to the font used by the object. By default,
  97. // each visual object uses the same font as its parent; the root of the
  98. // window hierarchy creates a font when it is created, and all its
  99. // descendants inherit this font. When a client program modifies the
  100. // return value of the Font() method of a particular visual object v, this
  101. // font change is propagated to all the descendants of v in
  102. // the view tree; but the fonts used by v's ancestors are not affected.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. enum UI_MouseButton { UIM_None = 0, UIM_Left, UIM_Middle, UIM_Right };
  110.  
  111. enum UIVObj_AttributeEnum {
  112.     UIV_Title, UIV_Model, UIV_Shape, UIV_Enabled, UIV_Visible
  113. };
  114.  
  115.  
  116. class CL_EXPORT  UI_VisualObject: public CL_Object {
  117.  
  118. public:
  119.  
  120.     // ----------------- Querying and setting attributes ----------------
  121.  
  122.     virtual CL_Object& Model ();
  123.     // Return the model corresponding to the visual object.
  124.  
  125.     virtual CL_String& Title ();
  126.     // Return the title. Note that the return value can be assigned to,
  127.     // thereby modifying the title.
  128.  
  129.     virtual UI_Rectangle Area () const; 
  130.     // Return the entire canvas comprising this view, including title bar etc. 
  131.  
  132.     virtual UI_Rectangle& ClientArea ();
  133.     // Return the client area of the canvas. Note that assigning to
  134.     // the return value causes the object to resize and/or reposition itself.
  135.  
  136.  
  137.     virtual UI_VObjCollection* Parent () const;
  138.     // Return the visual object enclosing me. Return NULL if this is the
  139.     // root of the visual object hierarchy.
  140.  
  141.     virtual UI_ViewID ViewID () const {return _id;} ;
  142.     // Returns   the integer  ID  that  is  passed  to   the view during
  143.     // construction.  Unlike the handle, the  ID may be used to identify
  144.     // objects uniquely between  runs of the  same application. If no ID
  145.     // is passed during to the  constructor, then the  handle and id are
  146.     // the same. In this case, the id is thus assigned at run time.
  147.  
  148.     virtual bool WantToQuit ();
  149.     // WantToQuit: return TRUE if this object can be closed down. The
  150.     // default implementation returns TRUE. Can be overridden by derived
  151.     // classes.
  152.  
  153.     class ViewSize {
  154.     public:
  155.         long _width;
  156.         long _height;
  157.         ViewSize (long w, long h) : _width (w), _height (h) {};
  158.     };
  159.  
  160.     virtual ViewSize MinSize () const {return ViewSize (0, 0);};
  161.     // Return the smallest that this VisualObject's client area can be
  162.     // resized to. The default implementation returns zeros.
  163.  
  164.     virtual ViewSize MaxSize () const {return ViewSize (32767, 32767);};
  165.     // Return the largest that this VisualObject's client area can be
  166.     // resized to. The default implementation returns 32767's for both width
  167.     // and height.
  168.  
  169.  
  170.     
  171. #if defined(__MS_WINDOWS__)
  172.     virtual bool CreatedViaResource ();
  173.     // [MS-Windows-specific] Return TRUE if this object was created via a
  174.     // resource name. The default implementation returns TRUE if the parent
  175.     // was created via a resource.
  176.  
  177.     virtual bool Has3DLook () const;
  178.  
  179. #elif defined(__X_MOTIF__)    
  180.     virtual CL_String InstanceName ();
  181.     // Used only under X windows, to specify the instance name for the
  182.     // widget when creating it. The default implementation returns the value
  183.     // returned by the Application's InstanceName method.
  184.  
  185. #endif
  186.     // ------------------- View-related methods ---------------
  187.     
  188.     virtual bool Enable ();
  189.     // Allow the VisualObject to respond to events.
  190.     // By default, every VisualObject is enabled at creation.
  191.  
  192.     virtual bool Disable ();
  193.     // Prevent view from responding to events.
  194.  
  195.     bool IsEnabled () { return _enabled;};
  196.     // Return whether the VisualObject is enabled.
  197.  
  198.     bool ToggleEnabledState () { return IsEnabled() ? Disable() : Enable();};
  199.     // Toggle the enabled state; i.e., disable it if it is enabled, and
  200.     // enable it otherwise.
  201.     
  202.     bool SetEnabledState (bool enabled)
  203.         { return enabled ? Enable() : Disable();};
  204.     // Set the enabled state explicitly; i.e., if {\tt enabled} is TRUE,
  205.     // enable this object, otherwise disable it.
  206.  
  207.     virtual void MakeInvisible ();
  208.     // Make the VisualObject invisible.
  209.     
  210.     virtual void MakeVisible ();
  211.     // Make the VisualObject visible.
  212.  
  213.     bool IsVisible () {return _visible;};
  214.     // Return whether the VisualObject is currently visible.
  215.  
  216.     void SetVisibility (bool visible);
  217.     // Set the visibility explicitly; i.e., if {\tt visible} is TRUE, make
  218.     // this object visible, otherwise make it invisible.
  219.  
  220.     void ToggleVisibility ();
  221.  
  222.     virtual void Invalidate ();
  223.     // Invalidate the client area of this VisualObject, so that the platform
  224.     // sends it a Paint event.
  225.     
  226.     virtual void ScrollView (const UI_Rectangle& scrollArea, short xAmount,
  227.                              short yAmount);
  228.     // Scroll the {\tt scrollArea} rectangle within the client area of this
  229.     // VisualObject by {\tt xAmount} and {\tt yAmount}. These amounts can be
  230.     // positive or negative.
  231.     
  232.     bool ShowBorder ();
  233.     // Show a border around this VisualObject. The exact look of the border
  234.     // is platform-dependent.
  235.  
  236.     bool HideBorder ();
  237.     // Hide the border.
  238.     
  239.  
  240.     virtual bool IsTabStop () const {return _isTabStop;};
  241.     // Are we a tab stop in our parent composite?
  242.  
  243.     virtual void TabStop (bool b) {_isTabStop = b;} ;
  244.     // Change our tab-stop status to the given value.
  245.     
  246.  
  247.     virtual bool IsIconified();
  248.     
  249.     
  250.     // ------------------ Display resource methods -------------------
  251.     
  252.     virtual UI_DisplaySurface* DisplaySurface ();
  253.     // Return the display surface for this visual object. The returned
  254.     // pointer is to an object owned by this VisualObject. The return value
  255.     // is NULL if this VisualObject has not created a DisplaySurface for
  256.     // itself.
  257.  
  258.     UI_Cursor& Cursor ();
  259.     // Return the cursor displayed when the mouse is on this
  260.     // object. Whenever the mouse enters the client area of a particular
  261.     // visual object, the controller sets the current cursor to be the one
  262.     // returned by this method. (The only exception to this is when the
  263.     // controller is currently in "wait" state, displaying a wait cursor.)
  264.     
  265.     virtual UI_Font&   Font ();
  266.     // Font used by this object. The return value can be modified.
  267.  
  268.     UI_Color& Foreground(); 
  269.     // The foreground color of the visual object.
  270.     
  271.     void Foreground (const UI_Color &c);
  272.     // Set the foreground color of the visual object to the specified
  273.     // color.
  274.     
  275.     UI_Color& Background();
  276.     // The background color used by the visual object.
  277.     
  278.     void Background (const UI_Color& c);
  279.     // Set the background color of the visual object to the specified
  280.     // color.
  281.     
  282.     // ------------------ Dependents ------------------------------
  283.     bool AddEventDependent (UI_EventType eType,
  284.                             const CL_AbstractBinding& bind,
  285.                             long code);
  286.     // Add an event dependent to this VisualObject. After each event of
  287.     // type {\tt eType} is
  288.     // handled, the event dependent binding is executed; the first
  289.     // parameter of the binding method will be the event, and the second
  290.     // will be the value {\tt code}.
  291.     //
  292.     // The return value of this method is TRUE if the binding was added, and
  293.     // FALSE if this binding was already present or else memory allocation
  294.     // failure occurred.
  295.  
  296.     bool RemoveEventDependent (UI_EventType eType,
  297.                                const CL_AbstractBinding& bind);
  298.     // Remove the given binding from the set of event dependents. The return
  299.     // value of this method is TRUE if the binding was removed, and FALSE if
  300.     // this binding was already absent or else memory allocation failure
  301.     // occurred.
  302.     
  303.     // ------------------ Basic methods ----------------------------
  304.     
  305.     
  306.     virtual UI_WindowClass WindowClass () const;
  307.     // Return the platform-specific window class for this VisualObject. This
  308.     // method is used by {\tt MakeVisualElement}.
  309.  
  310.     const char* ClassName () const { return "UI_VisualObject";};
  311.  
  312.  
  313.  
  314.  
  315. protected:
  316.     // 
  317.     // ------------------Construction---------------------
  318.     // 
  319.  
  320.     UI_VisualObject (UI_VObjCollection* parent, 
  321.                      const UI_Rectangle& shape, UI_ViewID id,
  322.                      long style = -1);
  323.     // Create a view with the given rectangle as the canvas.
  324.     // All Visualobjects are enabled at creation. The id, if assigned may be
  325.     // used to uniquely identify the object between runs.
  326.  
  327. #if defined(__MS_WINDOWS__)
  328.     UI_VisualObject (UI_VObjCollection* parent, UI_ViewID id,
  329.                      UI_ViewHandle handle = 0);
  330.     // For resource-based construction (only under MS-Windows)
  331.  
  332. #endif
  333.     
  334.     virtual ~UI_VisualObject () = 0;
  335.  
  336.     // ---------------- Initialization and termination -------------
  337.  
  338.     virtual void Initialize () {};
  339.     // Called by the Controller, just after the visual element
  340.     // of this object has been created. This is a hook,
  341.     // meant to be overridden by derived classes. Its default implementation
  342.     // does nothing.
  343.  
  344.     virtual void Finalize () {};
  345.     // Called just before the visual element is destroyed. This is a hook,
  346.     // meant to be overridden by derived classes. Its default implementation
  347.     // does nothing.
  348.     
  349.     // 
  350.     // Display Context methods:
  351.     // 
  352.  
  353.     // A display context does not exist untill a call to CreateDisplayContex()
  354.     // One thus created stays alive untill a call to DestroyDisplayObject()
  355.     // or till the VisualObject terminates.
  356.  
  357.     virtual UI_DisplaySurface& CreateDisplaySurface ();
  358.  
  359.     virtual void DestroyDisplaySurface ();
  360.  
  361.     friend UI_Controller;
  362.  
  363.  
  364.  
  365.     // ------------------Event Handling------------------
  366.  
  367.     // The following event-handling methods are intended only for being
  368.     // overridden by derived classes; they are never (and should never be)
  369.     // called by any object except the Controller.
  370.     
  371.     virtual bool HandleEvent (UI_Event* anEvent);
  372.     // HandleEvent: the "gateway" through which this object receives
  373.     // events from the controller. This method is called by the controller on
  374.     // receiving an event on this object (the event destination). This
  375.     // virtual method is a dummy and simply calls the non-virtual method
  376.     // ProcessEvent (UI_Event* e) that actually process all events.
  377.     // Therefore, the HandleEvent method may be overridden in derived 
  378.     // classes to capture special events and deal with them.However,
  379.     // the overwritten method {\it must\/} invoke ProcessEvent(e)
  380.     // to deal with events not handled by it. A sample implementation
  381.     // of this method in a derived class may be:
  382.     // \par{\small\begin{verbatim}
  383.     //      bool UI_DerivedClass::HandleEvent (UI_Event *e)
  384.     //      {
  385.     //           if(e satisfies some condition) {
  386.     //               do the special processing;
  387.     //           
  388.     //           } else
  389.     //               return ProcessEvent(e);
  390.     //      } 
  391.     // \end{verbatim}
  392.     // }\par
  393.  
  394.      
  395.     bool ProcessEvent (UI_Event *e);
  396.     // ProcessEvent: A non-virtual method that provides default
  397.     // implementation for all events that occur on every object. Special
  398.     // events, specific to a class, may be taken care of by the
  399.     // HandleEvent() method.
  400.  
  401.     // The following comprise the entire set of events that are
  402.     // recognised by any visual object.
  403.     // Each event returns a bool response -TRUE if the event is
  404.     // recognized and processed by it , FALSE otherwise. Each of the
  405.     // following methods gets invoked by the ProcessEvent() method when
  406.     // the corresponding event occurs on the object. If the object
  407.     // wishes to recognize the event, it must provide an
  408.     // appropriate implementation and return TRUE.
  409.     // The default implementation provided in this top class, for each
  410.     // of the methods, do nothing and return FALSE.
  411.     // Point 'origin' refers to the upper leftmost corner of the 
  412.     // enclosing visual object unless otherwise mentioned.
  413.          
  414.  
  415.     // 
  416.     // --------------------Hard Events------------------
  417.     // 
  418.  
  419.     // 
  420.     // Mouse Events:
  421.     // 
  422.    
  423.    
  424.     virtual bool ButtonDown (const UI_Point& curPos, UI_MouseButton btn,
  425.                               bool shiftKey, bool ctrlKey); 
  426.     // Inform the view that the mouse button 'btn' was pressed on it. The
  427.     // parameters are the position of the mouse, the mouse button, and
  428.     // whether the shift or control key was depressed at the time of click.
  429.  
  430.     virtual bool ButtonUp (const UI_Point& curPos, UI_MouseButton btn);
  431.     // Inform the view that the mouse button 'btn' was released on it. The
  432.     // parameters are the position of the mouse and the mouse button.
  433.   
  434.     virtual bool DoubleClick (const UI_Point& curPos, UI_MouseButton btn);
  435.     // Inform the view that the left mouse button was double-clicked on it.
  436.     // The parameter is where the left mouse button double clicked.
  437.  
  438.     virtual bool ViewEnter (const UI_Point& p);
  439.     // Informs the view that the mouse has just moved into its client area.
  440.     // (This has nothing to do with focus.)
  441.     // The parameter is the point of entry.
  442.  
  443.     virtual bool ViewLeave (const UI_Point& p);
  444.     // Inform the view that the mouse has just moved out of its client area. 
  445.     // The parameter is the point of exit.
  446.  
  447.     virtual bool MouseMove (const UI_Point& cursorPos);
  448.     // Inform view that the mouse has moved on its client area
  449.  
  450.     // 
  451.     // KeyBoard Events: 
  452.     // 
  453.  
  454.     virtual bool GetFocus ();
  455.     // Inform the view that it has focus.
  456.  
  457.     virtual bool LoseFocus ();
  458.     // Inform the view that it has lost focus.
  459.  
  460.     virtual bool KeyTyped (char aKey);
  461.     // Inform the view with current keyboard control that a key  has
  462.     // been pressed. The paremeter is the ASCII value of the key.
  463.  
  464.  
  465.     // 
  466.     // Motion and Sizing Events:
  467.     // 
  468.  
  469.     virtual bool Reconfigure (const UI_Rectangle& new_rect);
  470.     // Inform view that it has been either resized or moved or both. The
  471.     // parameter specifies the new shape rectangle.
  472.  
  473.     // 
  474.     // ----------------Soft Events------------------------
  475.     // 
  476.  
  477.  
  478.     // 
  479.     // Display:
  480.     // 
  481.  
  482.     virtual bool Paint () {return FALSE;};
  483.     // Inform view to display a representation of itself on the display
  484.     // surface.
  485.  
  486.     virtual bool Select () { return FALSE; };
  487.     // We received an Event_Select. This means that this VisualObject was
  488.     // somehow "selected" -- exact semantics if this is left to derived
  489.     // classes.
  490.  
  491.     virtual bool Iconify () {return FALSE; };
  492.     // We were iconfied.
  493.  
  494.     
  495.     virtual bool Deiconify () {return FALSE; };
  496.     // We were de-iconfied.
  497.  
  498.     
  499.     virtual bool FullScreen () {return FALSE; };
  500.     // We were "maximized."
  501.  
  502.     
  503.     // 
  504.     // ------------- Creating and destroying the visual element -----
  505.     //
  506.  
  507.     virtual bool MakeVisualElement ();
  508.     // MakeVisualElement: create the visual aspect of this view.  The
  509.     // implementation creates a default window.
  510.  
  511.     virtual bool DestroyVisualElement ();
  512.  
  513.     virtual void CloseDown  ();
  514.     // CloseDown: Called in response to a CloseDown event. The default
  515.     // implementation calls {\tt WantToQuit}, and if the latter returns
  516.     // TRUE, calls {\tt Application->Destroy} on this object.
  517.  
  518.  
  519. #if defined(__X_MOTIF__)
  520.     virtual void _SetupStyle (void* arg, short& argn);
  521.     // [YACL internal use only] X-windows-specific: set the resources for
  522.     // this widget. Called by MakeVisualElement. The first parameter will be
  523.     // a pointer to an Arg array.
  524.  
  525. #endif
  526.     
  527.     // ------------------- Miscellaneous methods -----------------------
  528.  
  529.     void _SetShapeRectangle (const UI_Rectangle& r);
  530.     // Set our shape rectangle. This method is to ensure that when we assign
  531.     // to our shape rectangle, the shape doesn't notify us that we changed
  532.     // it.
  533.     
  534.     void _SetTitle (const char*);
  535.     // Set our title. This method is to ensure that when we assign
  536.     // to our title, it doesn't notify us that we changed
  537.     // it.
  538.     
  539.     void _MakeNewFont ();
  540.     // _MakeNewFont: called to create a new font for ourselves
  541.  
  542.     UI_Font* OurFont ();
  543.     // OurFont: return the font used by this object
  544.  
  545.     virtual bool _ShapeRectChanged (CL_Object&, long);
  546.     // The application has invoked a method on our shape rectangle that
  547.     // modified it; so our shape rectangle is telling us that it's modified.
  548.  
  549.     virtual bool _TitleChanged (CL_Object&, long);
  550.     // TitleChanged: called by our title string to notify us that it has
  551.     // changed. 
  552.  
  553.     virtual bool _FontChanged (CL_Object&, long);
  554.     // The method that our font object uses to notify that someone
  555.     // modified our font.
  556.  
  557.     virtual bool _ModelChanged (CL_Object&, long) {return TRUE;};
  558.     // The method that our model uses to notify us that its value has
  559.     // changed.
  560.     
  561.     void _SetModelValue (const CL_Object&);
  562.     
  563.     virtual void _PrivateInitialize ();
  564.  
  565.     virtual bool _DoShowBorder (bool);
  566.     
  567. public:
  568.  
  569.  
  570.     // -------------------- For YACL internal use only -------------------
  571.  
  572.     virtual UI_ViewHandle ViewHandle () const;
  573.     // [YACL internal use only.]
  574.     // Returns the integer handle that identifies this view. A handle
  575.     // is assigned by the application at run time and may thus change
  576.     // values between runs.
  577.  
  578.     virtual bool SetFont (UI_Font* font);
  579.     // [YACL Internal use only]
  580.     // set the font used for this object in the underlying
  581.     // window system. Return TRUE on success, FALSE on failure. Child
  582.     // classes override this method according to their implementation.
  583.  
  584. #if defined(__MS_WINDOWS__) || defined(__OS2__)
  585.     virtual void TakeFocus ();
  586.     // [Specific to OS/2 and Windows. YACL internal use only.]
  587.  
  588. #endif
  589.     
  590. #if defined(__MS_WINDOWS__)
  591.     virtual void  SetStyle (ulong style);
  592.     // [MS/Windows-specific; internal use only.]
  593.  
  594.     ulong Style () const {return _style;};
  595.     // [MS/Windows-specific; internal use only.]
  596.  
  597. #elif defined (__X_MOTIF__)
  598.  
  599.     // -------------------- For YACL internal use only ------------------
  600.  
  601.     operator struct _WidgetRec* () { return _xwidget; };
  602.     // [Internal use only]
  603.     // Return the Widget corresponding to the visual object for the X
  604.     // implementation.
  605.  
  606. #endif
  607.     
  608.     
  609. protected:
  610.     // 
  611.     // ------------------Instance variables------------------
  612.     // 
  613.   
  614.     UI_VObjCollection*   _parent;
  615.     UI_Rectangle         _shape;
  616.     CL_String            _title;
  617.     CL_IntPtrMap*        _eventDependents;
  618.     
  619. #if defined(__MS_WINDOWS__)
  620.     UI_ViewHandle        _handle;
  621.     long                 _style;
  622. #elif defined(__OS2__)
  623.     UI_ViewHandle        _handle;
  624.     UI_ViewHandle        _borderHandle;
  625.     ulong                _style;
  626. #elif defined(__X_MOTIF__)
  627.     UI_ViewHandle        _xwidget;
  628.     CL_String            _instanceName;
  629. #endif
  630.     UI_ViewID            _id;              // An assigned ID used to uniquely
  631.                                            // identify a view
  632.     UI_DisplaySurface*   _displaySurface;  // Not initialized until call to
  633.                                            // CreateDisplaySurface
  634.     UI_Cursor            _cursor;
  635.     UI_Font*             _font;
  636.     UI_Color             _bgColor;
  637.     UI_Color             _fgColor;
  638.     
  639.     CL_Object*           _model  ; 
  640.  
  641.  
  642.     bool                 _isTabStop;
  643.     bool                 _ownFont;         // Do we own our font object?
  644.     bool                 _created;         // Has the interface element for
  645.                                            // this  object been created?
  646.                                            // (Set by Initialize)
  647.     bool                 _visible;         // Are we currently visible?
  648.     bool                 _enabled;         // Are we currently enabled?
  649.     bool                 _borderShown;
  650.  
  651.     //  Static instance variables:
  652.     static UI_Controller*  _Controller;
  653.     static UI_Application* _Application;
  654.     
  655. #if defined(__X_MOTIF__)    
  656.     static _WidgetRec*     _shell;
  657.     
  658. #endif
  659.  
  660.  
  661. private:
  662.     void _Init (UI_VObjCollection* parent, UI_ViewID id);
  663.  
  664.     bool _PrivateHandleEvent (UI_Event* e);
  665.     // The real event gateway.
  666.  
  667. };
  668.  
  669.  
  670. inline CL_Object& UI_VisualObject::Model()
  671. {
  672.     return *_model;
  673. }
  674.  
  675.  
  676. inline UI_ViewHandle UI_VisualObject::ViewHandle() const
  677. {
  678. #if defined (__MS_WINDOWS__)
  679.     return _handle;
  680.  
  681. #elif defined(__OS2__)
  682.     return _handle;
  683.     
  684. #elif defined (__X_MOTIF__)
  685.     return (UI_ViewHandle) (_xwidget);
  686.     
  687. #endif
  688. }
  689.  
  690.  
  691.  
  692. inline UI_DisplaySurface* UI_VisualObject::DisplaySurface ()
  693. {
  694.     return _displaySurface;
  695. }
  696.  
  697. inline UI_Cursor& UI_VisualObject::Cursor ()
  698. {
  699.     return _cursor;
  700. }
  701.  
  702.  
  703. inline UI_Color& UI_VisualObject::Foreground ()
  704. {
  705.     return _fgColor;
  706. }
  707.  
  708. inline UI_Color& UI_VisualObject::Background ()
  709. {
  710.     return _bgColor;
  711. }
  712.  
  713.  
  714. inline UI_VObjCollection* UI_VisualObject::Parent() const
  715. {
  716.     return _parent;
  717. }
  718.  
  719. inline UI_Rectangle& UI_VisualObject::ClientArea()
  720. {
  721.     return _shape;
  722. }
  723.  
  724. inline CL_String& UI_VisualObject::Title() 
  725. {
  726.     return _title;
  727. }
  728.  
  729. inline void UI_VisualObject::SetVisibility (bool visible)
  730. {
  731.     if (visible)
  732.         MakeVisible();
  733.     else
  734.         MakeInvisible();
  735. }
  736.  
  737. inline void UI_VisualObject::ToggleVisibility ()
  738. {
  739.     if (IsVisible())
  740.         MakeInvisible();
  741.     else
  742.         MakeVisible();
  743. }
  744.  
  745. #if defined(__OS2__)
  746. long _YACLWindowHeight (UI_ViewHandle h);
  747. #endif
  748.  
  749.  
  750. #endif
  751.