home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / program / gempp15b / gemo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-23  |  5.0 KB  |  148 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  GEMobject
  4. //
  5. //  A GEMobject is a true C++ object which are components of GEMforms.
  6. //  It has basic abilities similar to the abilities of GEM OBJECTs, but
  7. //  with the ability to be "called back", or "touched", and so to act
  8. //  on this stimulus.  As a base class, a GEMobject does not actually
  9. //  do anything in response - this is for derived classes.
  10. //
  11. //  This file is Copyright 1992,1993 by Warwick W. Allison.
  12. //  This file is part of the gem++ library.
  13. //  You are free to copy and modify these sources, provided you acknowledge
  14. //  the origin by retaining this notice, and adhere to the conditions
  15. //  described in the file COPYING.LIB.
  16. //
  17. /////////////////////////////////////////////////////////////////////////////
  18.  
  19. #ifndef GEMo_h
  20. #define GEMo_h
  21.  
  22. #include <gemrawo.h>
  23. #include <gemf.h>
  24.  
  25. class GEMevent;
  26.  
  27. class GEMobject
  28. // A GEMobject represents an extension of the OBJECT concept.
  29. // But, because GEM uses ARRAYS of OBJECTs, we cannot extend them :-(.
  30. // We make do by coping functionality.
  31. {
  32. public:
  33.     GEMobject(GEMform&, int RSCindex);
  34.     virtual ~GEMobject();
  35.  
  36.     bool Selected(bool s)                        { return me().Selected(s); }
  37.     bool Selected() const                        { return me().Selected(); }
  38.     void Select()                                { me().Select(); }
  39.     void Deselect()                                { me().Deselect(); }
  40.     bool Crossed(bool s)                        { return me().Crossed(s); }
  41.     bool Crossed() const                        { return me().Crossed(); }
  42.     void Cross()                                { me().Cross(); }
  43.     void Uncross()                                { me().Uncross(); }
  44.     bool Checked(bool s)                        { return me().Checked(s); }
  45.     bool Checked() const                        { return me().Checked(); }
  46.     void Check()                                { me().Check(); }
  47.     void Uncheck()                                { me().Uncheck(); }
  48.     bool Disabled(bool s)                        { return me().Disabled(s); }
  49.     bool Disabled() const                        { return me().Disabled(); }
  50.     void Disable()                                { me().Disable(); }
  51.     void Enable()                                { me().Enable(); }
  52.     bool Outlined(bool s)                        { return me().Outlined(s); }
  53.     bool Outlined() const                        { return me().Outlined(); }
  54.     void Outline()                                { me().Outline(); }
  55.     void Unoutline()                            { me().Unoutline(); }
  56.     bool Shadowed(bool s)                        { return me().Shadowed(s); }
  57.     bool Shadowed() const                        { return me().Shadowed(); }
  58.     void Shadow()                                { me().Shadow(); }
  59.     void Unshadow()                                { me().Unshadow(); }
  60.  
  61.     bool Selectable(bool f)                        { return me().Selectable(f); }
  62.     bool Selectable() const                        { return me().Selectable(); }
  63.     bool Default(bool f)                        { return me().Default(f); }
  64.     bool Default() const                        { return me().Default(); }
  65.     bool Exit(bool f)                            { return me().Exit(f); }
  66.     bool Exit() const                            { return me().Exit(); }
  67.     bool Editable(bool f)                        { return me().Editable(f); }
  68.     bool Editable() const                        { return me().Editable(); }
  69.     bool RadioButton(bool f)                    { return me().RadioButton(f); }
  70.     bool RadioButton() const                    { return me().RadioButton(); }
  71.  
  72.     bool LastObject(bool f)                        { return me().LastObject(f); }
  73.     bool LastObject() const                        { return me().LastObject(); }
  74.  
  75.     bool TouchExit(bool f)                        { return me().TouchExit(f); }
  76.     bool TouchExit() const                        { return me().TouchExit(); }
  77.     bool HideTree(bool f)                        { return me().HideTree(f); }
  78.     bool HideTree() const                        { return me().HideTree(); }
  79.  
  80.     short States() const                        { return me().States(); }
  81.     short Flags() const                            { return me().Flags(); }
  82.  
  83.     void MoveTo(short x, short y)                { me().MoveTo(x,y); }
  84.  
  85.     short X() const                                { return me().X(); }
  86.     short Y() const                                { return me().Y(); }
  87.     void Resize(short w, short h)                { me().Resize(w,h); }
  88.     short Width() const                            { return me().Width(); }
  89.     short Height() const                        { return me().Height(); }
  90.  
  91.     // The ob_spec functions below call the above type/ob_spec methods.
  92.  
  93.     char* ImageBitmap(bool Mask=FALSE) const;
  94.     short ImageHeight() const;
  95.     short ImageWidth() const;
  96.     void SetImageBitmap(char* bitmap, short w, short h, bool Mask=FALSE);
  97.     char* Text() const;
  98.     void SetText(char* str);
  99.  
  100.     int FillPattern() const;
  101.  
  102.     int Font() const;
  103.     void Font(int font);
  104.  
  105.     bool ContainsPoint(int x, int y) const;
  106.  
  107.     virtual int Type() const;
  108.     virtual void Type(int);
  109.     virtual int ObjectSpecific() const;
  110.     virtual void ObjectSpecific(int);
  111.  
  112.     void RedrawParent();
  113.     void Redraw();
  114.  
  115.     // Child stuff...
  116.     void Detach(); // Remove from parent child-list
  117.     void Attach(GEMobject& o); // Attach child to self
  118.     void Attach(int RSCindex); // Attach child to self
  119.  
  120.     // RSCindex-based
  121.     int NumberOfChildren() const;
  122.     int FirstChild() const; // -1 = none
  123.     int NextChild(int after) const; // -1 = none.
  124.     GEMrawobject* Child(int) const;
  125.     int Index() const { return myindex; }
  126.  
  127.     // GEMobject-based
  128.     int NumberOfComponents() const;
  129.     GEMobject* FirstComponent() const;
  130.     GEMobject* NextComponent(const GEMobject*) const;
  131.  
  132.     // Call backs...  (x,y) are relative, GEMevent contains absolute.
  133.     virtual GEMfeedback Touch(int x, int y, const GEMevent& e);
  134.  
  135.     void GetAbsoluteXY(int& x, int& y) const;
  136.  
  137. protected:
  138.     unsigned long original_ob_spec;
  139.     GEMform& form;
  140.     int myindex;
  141.  
  142. private:
  143.     GEMrawobject& me() const { return form[myindex]; }
  144. };
  145.  
  146.  
  147. #endif
  148.