2003-02-15 18:28:22 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2001-2002, OpenBeOS
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: WinBorder.cpp
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
// Description: Layer subclass which handles window management
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
2003-02-14 04:53:53 +03:00
|
|
|
#include <Region.h>
|
|
|
|
#include <String.h>
|
|
|
|
#include <Locker.h>
|
|
|
|
#include <Region.h>
|
|
|
|
#include <Debug.h>
|
|
|
|
#include "View.h" // for mouse button defines
|
|
|
|
#include "ServerWindow.h"
|
|
|
|
#include "Decorator.h"
|
|
|
|
#include "DisplayDriver.h"
|
|
|
|
#include "Desktop.h"
|
|
|
|
#include "WinBorder.h"
|
2003-03-12 21:32:27 +03:00
|
|
|
#include "AppServer.h" // for new_decorator()
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2003-07-24 23:38:24 +04:00
|
|
|
// TODO: Document this file completely
|
|
|
|
|
2003-09-04 01:43:09 +04:00
|
|
|
#define DEBUG_WINBORDER
|
2003-03-23 23:52:37 +03:00
|
|
|
//#define DEBUG_WINBORDER_MOUSE
|
2003-08-31 21:38:34 +04:00
|
|
|
#define DEBUG_WINBORDER_CLICK
|
2003-03-23 23:52:37 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_WINBORDER_MOUSE
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
namespace winborder_private
|
|
|
|
{
|
|
|
|
bool is_moving_window=false;
|
|
|
|
bool is_resizing_window=false;
|
|
|
|
bool is_sliding_tab=false;
|
|
|
|
WinBorder *active_winborder=NULL;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern ServerWindow *active_serverwindow;
|
|
|
|
|
|
|
|
bool is_moving_window(void) { return winborder_private::is_moving_window; }
|
|
|
|
void set_is_moving_window(bool state) { winborder_private::is_moving_window=state; }
|
|
|
|
bool is_resizing_window(void) { return winborder_private::is_resizing_window; }
|
|
|
|
void set_is_resizing_window(bool state) { winborder_private::is_resizing_window=state; }
|
2003-04-05 05:51:35 +04:00
|
|
|
bool is_sliding_tab(void) { return winborder_private::is_sliding_tab; }
|
|
|
|
void set_is_sliding_tab(bool state) { winborder_private::is_sliding_tab=state; }
|
2003-02-14 04:53:53 +03:00
|
|
|
WinBorder * get_active_winborder(void) { return winborder_private::active_winborder; }
|
|
|
|
void set_active_winborder(WinBorder *win) { winborder_private::active_winborder=win; }
|
|
|
|
|
2003-07-24 23:38:24 +04:00
|
|
|
WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const int32 feel,
|
|
|
|
const int32 flags, ServerWindow *win)
|
2003-03-23 23:52:37 +03:00
|
|
|
: Layer(r,name,B_FOLLOW_NONE,flags,win)
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
2003-07-24 23:38:24 +04:00
|
|
|
// unlike BViews, windows start off as hidden, so we need to tweak the hidecount
|
|
|
|
// assignment made by Layer().
|
|
|
|
_hidecount=1;
|
2003-02-14 04:53:53 +03:00
|
|
|
_mbuttons=0;
|
2003-06-24 17:55:18 +04:00
|
|
|
_kmodifiers=0;
|
2003-02-14 04:53:53 +03:00
|
|
|
_win=win;
|
|
|
|
|
|
|
|
_mousepos.Set(0,0);
|
|
|
|
_update=false;
|
|
|
|
|
|
|
|
_title=new BString(name);
|
|
|
|
_hresizewin=false;
|
|
|
|
_vresizewin=false;
|
2003-06-24 17:55:18 +04:00
|
|
|
_driver=GetGfxDriver(ActiveScreen());
|
2003-04-05 05:51:35 +04:00
|
|
|
_decorator=new_decorator(r,name,look,feel,flags,GetGfxDriver(ActiveScreen()));
|
2003-08-31 21:38:34 +04:00
|
|
|
// WinBorder must also include the right/left/top/bottom Decorator'
|
|
|
|
// rects - given by _decorator::GetBorderRect() - to be able to draw the borders
|
|
|
|
_frame = _decorator->GetBorderRect();
|
|
|
|
_visible->Set( _frame );
|
2003-09-04 01:43:09 +04:00
|
|
|
_visible->Include( _decorator->GetTabRect() );
|
2003-08-31 21:38:34 +04:00
|
|
|
_full->Set( _frame );
|
2003-09-04 01:43:09 +04:00
|
|
|
_full->Include( _decorator->GetTabRect() );
|
2003-08-31 21:38:34 +04:00
|
|
|
_invalid->Set( _frame );
|
2003-09-04 01:43:09 +04:00
|
|
|
_invalid->Include( _decorator->GetTabRect() );
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2003-06-24 17:55:18 +04:00
|
|
|
_decorator->SetDriver(_driver);
|
|
|
|
_decorator->SetTitle(name);
|
2003-03-31 01:09:39 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s:\n",_title->String());
|
|
|
|
printf("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom);
|
|
|
|
printf("\tWindow %s\n",win?win->Title():"NULL");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WinBorder::~WinBorder(void)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s:~WinBorder()\n",_title->String());
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
delete _title;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::MouseDown(int8 *buffer)
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
// Buffer data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - modifier keys down
|
|
|
|
// 5) int32 - buttons down
|
|
|
|
// 6) int32 - clicks
|
|
|
|
int8 *index=buffer; index+=sizeof(int64);
|
|
|
|
float x=*((float*)index); index+=sizeof(float);
|
|
|
|
float y=*((float*)index); index+=sizeof(float);
|
|
|
|
int32 modifiers=*((int32*)index); index+=sizeof(int32);
|
|
|
|
int32 buttons=*((int32*)index);
|
|
|
|
|
|
|
|
BPoint pt(x,y);
|
|
|
|
|
|
|
|
_mbuttons=buttons;
|
|
|
|
_kmodifiers=modifiers;
|
|
|
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
2003-02-14 04:53:53 +03:00
|
|
|
_mousepos=pt;
|
|
|
|
|
|
|
|
switch(click)
|
|
|
|
{
|
|
|
|
case CLICK_MOVETOBACK:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: MoveToBack\n");
|
|
|
|
#endif
|
|
|
|
MakeTopChild();
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_MOVETOFRONT:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: MoveToFront\n");
|
|
|
|
#endif
|
|
|
|
MakeBottomChild();
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_CLOSE:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Close\n");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
_decorator->SetClose(true);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawClose();
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_ZOOM:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Zoom\n");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
_decorator->SetZoom(true);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawZoom();
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_MINIMIZE:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Minimize\n");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
_decorator->SetMinimize(true);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawMinimize();
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_DRAG:
|
|
|
|
{
|
|
|
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
2003-04-05 05:51:35 +04:00
|
|
|
{
|
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Drag\n");
|
|
|
|
#endif
|
|
|
|
MakeBottomChild();
|
|
|
|
set_is_moving_window(true);
|
|
|
|
}
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
2003-04-05 05:51:35 +04:00
|
|
|
{
|
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: MoveToBack\n");
|
|
|
|
#endif
|
|
|
|
MakeTopChild();
|
|
|
|
}
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_SLIDETAB:
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Slide Tab\n");
|
|
|
|
#endif
|
|
|
|
set_is_sliding_tab(true);
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_RESIZE:
|
|
|
|
{
|
|
|
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
2003-04-05 05:51:35 +04:00
|
|
|
{
|
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("Click: Resize\n");
|
|
|
|
#endif
|
|
|
|
set_is_resizing_window(true);
|
|
|
|
}
|
2003-02-14 04:53:53 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_NONE:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::MouseMoved(int8 *buffer)
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
// Buffer data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - buttons down
|
|
|
|
int8 *index=buffer; index+=sizeof(int64);
|
|
|
|
float x=*((float*)index); index+=sizeof(float);
|
|
|
|
float y=*((float*)index); index+=sizeof(float);
|
|
|
|
int32 buttons=*((int32*)index);
|
|
|
|
|
|
|
|
BPoint pt(x,y);
|
|
|
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
if(click!=CLICK_CLOSE && _decorator->GetClose())
|
|
|
|
{
|
|
|
|
_decorator->SetClose(false);
|
|
|
|
_decorator->Draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(click!=CLICK_ZOOM && _decorator->GetZoom())
|
|
|
|
{
|
|
|
|
_decorator->SetZoom(false);
|
|
|
|
_decorator->Draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(click!=CLICK_MINIMIZE && _decorator->GetMinimize())
|
|
|
|
{
|
|
|
|
_decorator->SetMinimize(false);
|
|
|
|
_decorator->Draw();
|
|
|
|
}
|
|
|
|
|
2003-04-05 05:51:35 +04:00
|
|
|
if(is_sliding_tab())
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("ClickMove: Slide Tab\n");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
float dx=pt.x-_mousepos.x;
|
2003-09-04 01:43:09 +04:00
|
|
|
float dy=pt.y-_mousepos.y;
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2003-09-04 01:43:09 +04:00
|
|
|
if(dx != 0 || dy != 0)
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
|
|
|
// SlideTab returns how much things were moved, and currently
|
|
|
|
// supports just the x direction, so get the value so
|
|
|
|
// we can invalidate the proper area.
|
2003-04-05 05:51:35 +04:00
|
|
|
lock_layers();
|
2003-09-04 01:43:09 +04:00
|
|
|
_parent->Invalidate(_decorator->SlideTab(dx,dy));
|
2003-04-05 05:51:35 +04:00
|
|
|
_parent->RequestDraw();
|
2003-09-04 01:43:09 +04:00
|
|
|
// _decorator->DrawTab();
|
2003-04-05 05:51:35 +04:00
|
|
|
unlock_layers();
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
|
|
|
}
|
2003-04-05 05:51:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
if(is_moving_window())
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("ClickMove: Drag\n");
|
|
|
|
#endif
|
2003-06-24 17:55:18 +04:00
|
|
|
//debugger("");
|
2003-02-14 04:53:53 +03:00
|
|
|
float dx=pt.x-_mousepos.x,
|
|
|
|
dy=pt.y-_mousepos.y;
|
2003-04-05 05:51:35 +04:00
|
|
|
if(buttons!=0 && (dx!=0 || dy!=0))
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
|
|
|
BRect oldmoveframe=_win->_frame;
|
2003-04-05 05:51:35 +04:00
|
|
|
_clientframe.OffsetBy(pt);
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
_win->Lock();
|
|
|
|
_win->_frame.OffsetBy(dx,dy);
|
|
|
|
_win->Unlock();
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2003-04-05 05:51:35 +04:00
|
|
|
lock_layers();
|
2003-06-24 17:55:18 +04:00
|
|
|
BRegion *reg=_decorator->GetFootprint();
|
2003-08-31 21:38:34 +04:00
|
|
|
// TODO: we get an error here!!! - this method is untested
|
2003-09-04 01:43:09 +04:00
|
|
|
// TODO: we really need to enable this method to avoid lots of drawings.
|
2003-08-31 21:38:34 +04:00
|
|
|
//_driver->CopyRegion(reg,_win->_frame.LeftTop());
|
2003-09-04 01:43:09 +04:00
|
|
|
_parent->Invalidate(*reg);
|
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
_decorator->MoveBy(BPoint(dx, dy));
|
2003-08-31 21:38:34 +04:00
|
|
|
MoveBy(dx,dy);
|
2003-09-04 01:43:09 +04:00
|
|
|
|
2003-08-31 21:38:34 +04:00
|
|
|
// ADI: what do those do???
|
|
|
|
BRegion reg2(oldmoveframe);
|
2003-07-09 04:41:50 +04:00
|
|
|
reg->OffsetBy((int32)dx, (int32)dy);
|
2003-06-24 17:55:18 +04:00
|
|
|
reg2.Exclude(reg);
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2003-06-24 17:55:18 +04:00
|
|
|
_parent->RebuildRegions();
|
2003-09-04 01:43:09 +04:00
|
|
|
printf("WinBorder: calling parent = %s::RequestDraw()\n", _parent->_name->String());
|
2003-06-24 17:55:18 +04:00
|
|
|
_parent->RequestDraw();
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2003-06-24 17:55:18 +04:00
|
|
|
delete reg;
|
2003-04-05 05:51:35 +04:00
|
|
|
unlock_layers();
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
|
|
|
}
|
2003-04-05 05:51:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
if(is_resizing_window())
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
#ifdef DEBUG_WINBORDER_CLICK
|
|
|
|
printf("ClickMove: Resize\n");
|
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
float dx=pt.x-_mousepos.x,
|
|
|
|
dy=pt.y-_mousepos.y;
|
2003-04-05 05:51:35 +04:00
|
|
|
if(buttons!=0 && (dx!=0 || dy!=0))
|
2003-02-14 04:53:53 +03:00
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
_clientframe.right+=dx;
|
|
|
|
_clientframe.bottom+=dy;
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
_win->Lock();
|
|
|
|
_win->_frame.right+=dx;
|
|
|
|
_win->_frame.bottom+=dy;
|
|
|
|
_win->Unlock();
|
|
|
|
|
2003-04-05 05:51:35 +04:00
|
|
|
lock_layers();
|
2003-02-14 04:53:53 +03:00
|
|
|
ResizeBy(dx,dy);
|
2003-04-05 05:51:35 +04:00
|
|
|
_parent->RequestDraw();
|
|
|
|
unlock_layers();
|
2003-02-14 04:53:53 +03:00
|
|
|
_decorator->ResizeBy(dx,dy);
|
|
|
|
_decorator->Draw();
|
|
|
|
}
|
|
|
|
}
|
2003-04-05 05:51:35 +04:00
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
_mousepos=pt;
|
2003-04-05 05:51:35 +04:00
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::MouseUp(int8 *buffer)
|
|
|
|
{
|
2003-04-05 05:51:35 +04:00
|
|
|
// buffer data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - modifier keys down
|
|
|
|
int8 *index=buffer; index+=sizeof(int64);
|
|
|
|
float x=*((float*)index); index+=sizeof(float);
|
|
|
|
float y=*((float*)index); index+=sizeof(float);
|
|
|
|
int32 modifiers=*((int32*)index);
|
|
|
|
BPoint pt(x,y);
|
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER_MOUSE
|
2003-07-24 23:38:24 +04:00
|
|
|
printf("WinBorder %s: MouseUp unimplemented\n",_title->String());
|
2003-03-23 23:52:37 +03:00
|
|
|
#endif
|
2003-02-14 04:53:53 +03:00
|
|
|
|
2003-04-05 05:51:35 +04:00
|
|
|
_mbuttons=0;
|
|
|
|
_kmodifiers=modifiers;
|
|
|
|
|
|
|
|
set_is_moving_window(false);
|
|
|
|
set_is_resizing_window(false);
|
|
|
|
set_is_sliding_tab(false);
|
|
|
|
|
|
|
|
click_type click=_decorator->Clicked(pt, _mbuttons, _kmodifiers);
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
switch(click)
|
|
|
|
{
|
|
|
|
case CLICK_CLOSE:
|
|
|
|
{
|
|
|
|
_decorator->SetClose(false);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawClose();
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
// call close window stuff here
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_ZOOM:
|
|
|
|
{
|
|
|
|
_decorator->SetZoom(false);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawZoom();
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
// call zoom stuff here
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CLICK_MINIMIZE:
|
|
|
|
{
|
|
|
|
_decorator->SetMinimize(false);
|
2003-07-24 23:38:24 +04:00
|
|
|
_decorator->DrawMinimize();
|
2003-02-14 04:53:53 +03:00
|
|
|
|
|
|
|
// call minimize stuff here
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-24 23:38:24 +04:00
|
|
|
/*!
|
|
|
|
\brief Function to pass focus value on to decorator
|
|
|
|
\param active Focus flag
|
|
|
|
*/
|
|
|
|
void WinBorder::SetFocus(const bool &active)
|
|
|
|
{
|
|
|
|
if(_decorator)
|
|
|
|
_decorator->SetFocus(active);
|
|
|
|
}
|
|
|
|
|
2003-02-15 18:28:22 +03:00
|
|
|
void WinBorder::RequestDraw(const BRect &r)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
2003-09-04 01:43:09 +04:00
|
|
|
printf("WinBorder %s: RequestDraw(BRect)\n",_title->String());
|
|
|
|
PrintToStream();
|
2003-03-23 23:52:37 +03:00
|
|
|
#endif
|
2003-03-12 21:32:27 +03:00
|
|
|
_decorator->Draw(r);
|
2003-09-04 01:43:09 +04:00
|
|
|
delete _invalid;
|
|
|
|
_invalid = NULL;
|
2003-02-15 18:28:22 +03:00
|
|
|
}
|
|
|
|
|
2003-02-14 04:53:53 +03:00
|
|
|
void WinBorder::RequestDraw(void)
|
|
|
|
{
|
2003-03-31 01:09:39 +04:00
|
|
|
#ifdef DEBUG_WINBORDER
|
2003-09-04 01:43:09 +04:00
|
|
|
printf("WinBorder %s::RequestDraw()\n",_title->String());
|
|
|
|
PrintToStream();
|
2003-03-31 01:09:39 +04:00
|
|
|
#endif
|
|
|
|
_decorator->Draw();
|
2003-09-04 01:43:09 +04:00
|
|
|
delete _invalid;
|
|
|
|
_invalid = NULL;
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
2003-06-24 17:55:18 +04:00
|
|
|
/*
|
2003-02-14 04:53:53 +03:00
|
|
|
void WinBorder::MoveBy(BPoint pt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::MoveBy(float x, float y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::ResizeBy(BPoint pt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::ResizeBy(float x, float y)
|
|
|
|
{
|
|
|
|
}
|
2003-06-24 17:55:18 +04:00
|
|
|
*/
|
2003-02-24 18:47:06 +03:00
|
|
|
void WinBorder::UpdateColors(void)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s: UpdateColors\n",_title->String());
|
|
|
|
#endif
|
2003-02-24 18:47:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::UpdateDecorator(void)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s: UpdateDecorator\n",_title->String());
|
|
|
|
#endif
|
2003-02-24 18:47:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::UpdateFont(void)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s: UpdateFont\n",_title->String());
|
|
|
|
#endif
|
2003-02-24 18:47:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WinBorder::UpdateScreen(void)
|
|
|
|
{
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_WINBORDER
|
|
|
|
printf("WinBorder %s: UpdateScreen\n",_title->String());
|
|
|
|
#endif
|
2003-02-24 18:47:06 +03:00
|
|
|
}
|