About Store Forum Documentation Contact



Post Reply 
Hide window
Author Message
Dynad Offline
Member

Post: #1
Hide window
Hey,

How can you hide the window like it works in the ME->particles? So the region appears when to mouse gets over. Now i try it with size(Vec2(D.w()*2,0)); and then i have to reposition the bar at the right place somewhere at the bottom of the Main Window. Is there a easier way to accomplish this or?


Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
10-27-2010 12:59 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Hide window
Code:
struct WindowHider
{
   Bool    hidden;
   Vec2    original_size;
   Window *window;

   // manage
   WindowHider& create(Window &window);
   void         update();

   WindowHider() {Zero(T);}
};



WindowHider& WindowHider::create(Window &window)
{
   T.hidden       = false ;
   T.window       =&window;
   T.original_size= window.rect.size();
   return T;
}
void WindowHider::update()
{
   if(window)
   {
      Bool       want_to_be_visible=((Gui.window()==window && !(window->flag&WIN_IMMEDIATE_DEACT)) || window->contains(Gui.ms()));
      if(hidden==want_to_be_visible)
      {
         if(hidden^=1) // new state
         {
            // hidden
            original_size=window->rect.size();
            Rect rect=window->rect; Flt h=rect.h()-window->barHeight();
            if(Abs(rect.max.y-D.h())<Abs(rect.min.y+D.h()))
            {
                  rect.min.y+=h;
               if(rect.max.y>D.h())
               {
                  Flt d=rect.max.y-D.h();
                  rect.min.y-=d;
                  rect.max.y-=d;
               }
            }else
            {
                  rect.max.y-=h;
               if(rect.min.y<-D.h())
               {
                  Flt d=-D.h()-rect.min.y;
                  rect.min.y+=d;
                  rect.max.y+=d;
               }
            }
            window->setRect(rect);
         }else
         {
            // visible
            Rect rect=window->rect; Flt h=original_size.y-rect.h();
            if(Abs(rect.max.y-D.h())<Abs(rect.min.y+D.h()))rect.min.y-=h;else rect.max.y+=h;
            window->setRect(rect);
         }
      }
   }
}
10-27-2010 01:22 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: Hide window
Thnx grin

There is always evil somewhere, you just have to look for it properly.
10-27-2010 06:15 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply