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

  1.  
  2. #ifndef _simple_h_
  3. #define _simple_h_
  4.  
  5.  
  6.  
  7.  
  8.  
  9. /*
  10.  *
  11.  *          Copyright (C) 1994, M. A. Sridhar
  12.  *  
  13.  *
  14.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  15.  *     to copy, modify or distribute this software  as you see fit,
  16.  *     and to use  it  for  any  purpose, provided   this copyright
  17.  *     notice and the following   disclaimer are included  with all
  18.  *     copies.
  19.  *
  20.  *                        DISCLAIMER
  21.  *
  22.  *     The author makes no warranties, either expressed or implied,
  23.  *     with respect  to  this  software, its  quality, performance,
  24.  *     merchantability, or fitness for any particular purpose. This
  25.  *     software is distributed  AS IS.  The  user of this  software
  26.  *     assumes all risks  as to its quality  and performance. In no
  27.  *     event shall the author be liable for any direct, indirect or
  28.  *     consequential damages, even if the  author has been  advised
  29.  *     as to the possibility of such damages.
  30.  *
  31.  */
  32.  
  33.  
  34.  
  35.  
  36. //   The SimpleVObject encapsulates a VisualObject that displays either a
  37. //   single data item or a homogeneous collection of data items. A 
  38. //   SimpleVObject includes in its state a data structure called the {\it
  39. //   model\/} 
  40. //   and a selection mechanism determined by a {\it selection}. The actual 
  41. //   interpretation of model and selection and their management is
  42. //   left to subclasses of the SimpleVObject. The model is not owned by
  43. //   this object but 
  44. //   passed to it at construction by the derived class. The simple object
  45. //   may however modify the
  46. //   model. The parent of a simple object must be a VObjCollection.
  47. // 
  48. // 
  49. //   The model has this object as a dependent and invokes
  50. //   {\tt _ModelChanged()} when it changes.
  51.  
  52.  
  53.  
  54. #if defined(__GNUC__)
  55. #pragma interface
  56. #endif
  57.  
  58.  
  59. #include "ui/visualob.h"
  60.  
  61. class CL_EXPORT UI_VObjCollection;
  62.  
  63. class CL_EXPORT UI_SimpleVObject: public UI_VisualObject {
  64.  
  65. public:
  66.  
  67.     virtual UI_WindowClass WindowClass () const;
  68.     
  69.     const char* ClassName() const {return "UI_SimpleVObject";};
  70.  
  71.     
  72. protected:
  73.  
  74.     UI_SimpleVObject (UI_VObjCollection* parent, const UI_Rectangle& r,
  75.                       UI_ViewID id = -1, long style = -1);
  76.     // model owned
  77.  
  78.     UI_SimpleVObject (UI_VObjCollection* parent, CL_Object* model,
  79.                       UI_ViewID = -1,
  80.                       const UI_Rectangle& r = UI_Rectangle(),
  81.                       long style = -1);
  82.     // model not owned
  83.  
  84. #if defined(__MS_WINDOWS__)
  85.     UI_SimpleVObject ( UI_VObjCollection* parent,
  86.                        UI_ViewID id, UI_ViewHandle h 
  87.                      );
  88.     // [MS-Windows-specific] For resource-based construction.
  89.  
  90. #endif
  91.                      
  92.  
  93.     ~UI_SimpleVObject(); 
  94.  
  95.     virtual bool _ModelChanged (CL_Object&, long);
  96.     // _ModelChanged: invoked by our model when it changes. The default
  97.     // implementation calls Paint().
  98.  
  99.     bool _FontChanged (CL_Object&, long);
  100.     
  101.     bool MakeVisualElement ();
  102.  
  103.     bool DestroyVisualElement ();
  104.  
  105.     void _PrivateInitialize();
  106.  
  107.  
  108.     friend class UI_Controller;
  109.  
  110.  
  111. public:
  112.  
  113.     // ------------- For YACL internal use only --------------
  114.  
  115.     bool SetFont (UI_Font* font);
  116.     
  117.     bool SetStyleParam();
  118.  
  119. protected:
  120.  
  121.     // Instance variables:
  122.     
  123.     bool       _ownModel;
  124.  
  125. #if defined(__OS2__)
  126.  
  127. private:
  128.     void _Subclass ();
  129.     // [OS/2-specific]
  130.  
  131.     PFNWP _oldProc;
  132.  
  133.     static MRESULT EXPENTRY SubclassProc (HWND hWnd, ULONG msg,
  134.                                           MPARAM p1, MPARAM p2);
  135.     // [OS/2-specific]
  136.     
  137. #endif
  138. };
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. #endif
  148.