home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / program / gempp15b.zoo / src / gemfiw.cc < prev    next >
C/C++ Source or Header  |  1993-04-25  |  3KB  |  110 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is Copyright 1992,1993 by Warwick W. Allison.
  4. //  This file is part of the gem++ library.
  5. //  You are free to copy and modify these sources, provided you acknowledge
  6. //  the origin by retaining this notice, and adhere to the conditions
  7. //  described in the file COPYING.LIB.
  8. //
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #include "gemfiw.h"
  12. #include "geme.h"
  13.  
  14. class GEMiconformwindow : GEMformwindow {
  15. public:
  16.     GEMiconformwindow(GEMactivity& act, const GEMrsc& in, int RSCindex, GEMformwindow* of) :
  17.         GEMformwindow(act,in,RSCindex,0),
  18.         parent(of)
  19.     { }
  20.  
  21.     GEMiconformwindow(const GEMiconformwindow& copy, GEMformwindow* of) :
  22.         GEMformwindow(copy),
  23.         parent(of)
  24.     { }
  25.  
  26.     virtual void Top(const GEMevent& e)
  27.     {
  28.         Click(e);
  29.     }
  30.  
  31.     virtual GEMfeedback Click(const GEMevent&)
  32.     {
  33.         GEMevent ev;
  34.         ev.Rectangle(ev.X()-1,ev.Y()-1,3,3,TRUE); // Wait for mouse move >1 ...
  35.         ev.Button(1,0); // ... or for button up.
  36.         ev.Get(MU_M1|MU_BUTTON);
  37.         if (ev.Rectangle()) {
  38.             int bx,by,bw,bh;
  39.             int nx,ny;
  40.             wind_get(0,WF_WORKXYWH,&bx,&by,&bw,&bh);
  41.             GRect w=BorderRect();
  42.             graf_dragbox(w.g_w,w.g_h,w.g_x,w.g_y,bx,by,bw,bh,&nx,&ny);
  43.             GEMformwindow::Move(nx,ny);
  44.         } else {
  45.             Close();
  46.             if (parent->Zooms(TRUE)) {
  47.                 GRect s=BorderRect();
  48.                 GRect f=parent->BorderRect();
  49.                 graf_growbox(s.g_x,s.g_y,s.g_w,s.g_y,f.g_x,f.g_y,f.g_w,f.g_h);
  50.             } else {
  51.                 parent->Zooms(FALSE);
  52.             }
  53.             parent->Open();
  54.         }
  55.         return ContinueInteraction;
  56.     }
  57.  
  58. private:
  59.     GEMformwindow* parent;
  60. };
  61.  
  62. GEMformiconwindow::GEMformiconwindow(GEMactivity& act, const GEMrsc& in, int RSCform, int RSCicon) :
  63.     GEMformwindow(act,in,RSCform,CLOSER|MOVER|NAME|FULLER),
  64.     icon(new GEMiconformwindow(act,in,RSCicon,this))
  65. {
  66.     Zooms(TRUE);
  67. }
  68.  
  69. GEMformiconwindow::GEMformiconwindow(GEMactivity& act, const GEMrsc& in, int RSCform, int RSCicon, int Parts) :
  70.     GEMformwindow(act,in,RSCform,Parts),
  71.     icon(new GEMiconformwindow(act,in,RSCicon,this))
  72. {
  73.     Zooms(TRUE);
  74. }
  75.  
  76. GEMformiconwindow::GEMformiconwindow(const GEMformiconwindow& copy) :
  77.     GEMformwindow(copy),
  78.     icon(new GEMiconformwindow(*copy.icon,this))
  79. {
  80. }
  81.  
  82. GEMformiconwindow::~GEMformiconwindow()
  83. {
  84.     delete icon;
  85. }
  86.  
  87. void GEMformiconwindow::UserFulled()
  88. {
  89.     Close();
  90.     if (Zooms(TRUE)) {
  91.         GRect s=BorderRect();
  92.         GRect f=icon->BorderRect();
  93.         graf_shrinkbox(f.g_x,f.g_y,f.g_w,f.g_y,s.g_x,s.g_y,s.g_w,s.g_h);
  94.     } else {
  95.         Zooms(FALSE);
  96.     }
  97.     icon->Open();
  98. }
  99.  
  100. void GEMformiconwindow::Open()
  101. {
  102.     if (IsIconified()) icon->Close();
  103.     GEMformwindow::Open();
  104. }
  105.  
  106. bool GEMformiconwindow::IsIconified() const
  107. {
  108.     return icon->IsOpen();
  109. }
  110.