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

  1.  
  2.  
  3. #ifndef _xrbtngrp_h_ /* Tue Nov 22 09:36:40 1994 */
  4. #define _xrbtngrp_h_
  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. // An ExOrButtonGroup is a SimpleVObject that has an Integer as model. The
  35. // visual representation of the ExOrButtonGroup is a group of toggle buttons
  36. // (``radio buttons'' under MS-Windows), at most one of which may be
  37. // selected at any given time. The Integer model contains the view id of the
  38. // button currently selected, and the {\tt Selection} method returns this
  39. // view id.
  40.  
  41.  
  42. #if defined(__GNUC__)
  43. #pragma interface
  44. #endif
  45.  
  46.  
  47. #include "base/integer.h"
  48. #include "ui/composit.h"
  49. #include "ui/btngroup.h"
  50.  
  51.  
  52. class CL_EXPORT UI_ExOrButtonGroup: public UI_ButtonGroup {
  53.  
  54. public:
  55.  
  56.     UI_ExOrButtonGroup (UI_VObjCollection* parent, 
  57.                         const UI_Rectangle& shape,
  58.                         UI_ViewID id = -1, UI_ViewDescriptor* vd = NULL);
  59.     // Constructor: creates an empty ButtonGroup as a child of {\tt
  60.     // parent}, with the given shape and view ID.
  61.  
  62.     
  63.     virtual CL_Integer& Selection ();
  64.     // Return the view ID of the currently selected toggle button, as a {\tt
  65.     // CL_Integer}.  The return value may be
  66.     // modified via the Integer methods, and this results in modification of
  67.     // the display.
  68.  
  69.     CL_Object& Model () {return Selection();};
  70.     
  71.  
  72.  
  73. #if defined(__MS_WINDOWS__)
  74.     UI_ExOrButtonGroup (UI_CompositeVObject* parent,  UI_ViewID id,
  75.                         UI_ViewHandle h);
  76.     // Resource-based construction (only under MS-Windows). This assumes
  77.     // that (1) all (and only) the buttons in the group are geometrically
  78.     // contained within the button group box's rectangle,  (2) the
  79.     // contained buttons occur immediately after the group box in the
  80.     // resource file ordering, and (3) the group box has a valid id.
  81.     // Therefore, this does not allow (in particular) for groups within groups.
  82.  
  83. #endif
  84.  
  85.     
  86. protected:
  87.  
  88.     bool _ModelChanged (CL_Object&, long);
  89.  
  90.     bool HandleChildEvent (const UI_Event& e);
  91.     
  92.     CL_Integer _selection;
  93.  
  94. private:
  95.     void _Init ();
  96.  
  97.     void _UpdateSelection ();
  98.     
  99. };
  100.  
  101.  
  102.  
  103.  
  104. #endif /* _xrbtngrp_h_ */
  105.