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

  1.  
  2.  
  3.  
  4. #ifndef _orbtngrp_h_ /* Tue Nov 22 09:04:24 1994 */
  5. #define _orbtngrp_h_
  6.  
  7.  
  8.  
  9.  
  10.  
  11. /*
  12.  *
  13.  *          Copyright (C) 1994, M. A. Sridhar
  14.  *  
  15.  *
  16.  *     This software is Copyright M. A. Sridhar, 1994. You are free
  17.  *     to copy, modify or distribute this software  as you see fit,
  18.  *     and to use  it  for  any  purpose, provided   this copyright
  19.  *     notice and the following   disclaimer are included  with all
  20.  *     copies.
  21.  *
  22.  *                        DISCLAIMER
  23.  *
  24.  *     The author makes no warranties, either expressed or implied,
  25.  *     with respect  to  this  software, its  quality, performance,
  26.  *     merchantability, or fitness for any particular purpose. This
  27.  *     software is distributed  AS IS.  The  user of this  software
  28.  *     assumes all risks  as to its quality  and performance. In no
  29.  *     event shall the author be liable for any direct, indirect or
  30.  *     consequential damages, even if the  author has been  advised
  31.  *     as to the possibility of such damages.
  32.  *
  33.  */
  34.  
  35.  
  36.  
  37.  
  38. // An  OrButtonGroup is a SimpleVObject that has an IntegerSet as model. The
  39. // set contains the ViewID's of those buttons in the group that are chosen
  40. // (or checked). If the contained buttons are ToggleButtons, the model
  41. // may possibly contain more than one id; if they are ExOrToggleButtons,
  42. // the model will contain at most one id (it may contain none, if no
  43. // button in the group is checked).
  44.  
  45.  
  46. #if defined(__GNUC__)
  47. #pragma interface
  48. #endif
  49.  
  50.  
  51. #include "ui/btngroup.h"
  52. #include "ui/composit.h"
  53.  
  54. class CL_EXPORT UI_OrButtonGroup: public UI_ButtonGroup {
  55.  
  56. public:
  57.  
  58.     UI_OrButtonGroup (UI_VObjCollection* parent, 
  59.                       const UI_Rectangle& shape, 
  60.                       UI_ViewID id = -1,
  61.                       UI_ViewDescriptor* vd = NULL);
  62.     // Constructor: creates an empty ButtonGroup as a child of {\tt
  63.     // parent}, with the given shape and view ID.
  64.  
  65.     
  66.     virtual CL_IntegerSet& Selection ();
  67.     // Return the current state of the selections, as a set of integers
  68.     // containing the id's of the selected buttons. The return value may be
  69.     // modified via the Set methods, and this results in modification of the
  70.     // display.
  71.  
  72.     CL_Object& Model () {return Selection();};
  73.     
  74.  
  75.  
  76. #if defined(__MS_WINDOWS__)
  77.     UI_OrButtonGroup (UI_CompositeVObject* parent,  UI_ViewID id,
  78.                     UI_ViewHandle h);
  79.     // Resource-based construction (only under MS-Windows). This assumes
  80.     // that (1) all (and only) the buttons in the group are geometrically
  81.     // contained within the button group box's rectangle,  (2) the
  82.     // contained buttons occur immediately after the group box in the
  83.     // resource file ordering, and (3) the group box has a valid id.
  84.     // Therefore, this does not allow (in particular) for groups within groups.
  85.  
  86. #endif
  87.  
  88.     
  89. protected:
  90.     CL_IntegerSet _selection;
  91.  
  92.     bool _ModelChanged (CL_Object&, long);
  93.  
  94.     bool Select ();
  95.     
  96. private:
  97.     void _Init ();
  98.  
  99.     void _UpdateSelection ();
  100.     
  101. };
  102.  
  103.  
  104.  
  105. #endif /* _orbtngrp_h_ */
  106.