Stubbed out WinBorder class
Uncommented code in other files dependent on WinBorder git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2703 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -382,7 +382,7 @@ void AppServer::DispatchMessage(int32 code, int8 *buffer)
|
|||||||
if(r==B_NO_MORE_PORTS || r==B_BAD_VALUE)
|
if(r==B_NO_MORE_PORTS || r==B_BAD_VALUE)
|
||||||
{
|
{
|
||||||
release_sem(_applist_lock);
|
release_sem(_applist_lock);
|
||||||
printf("No more ports left. Time to crash. :)\n");
|
printf("No more ports left. Time to crash. Have a nice day! :)\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ServerApp *newapp=new ServerApp(app_port,r,app_signature);
|
ServerApp *newapp=new ServerApp(app_port,r,app_signature);
|
||||||
@@ -627,9 +627,7 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
|
|
||||||
// We got this far, so apparently it's safe to pass to the active
|
// We got this far, so apparently it's safe to pass to the active
|
||||||
// window.
|
// window.
|
||||||
|
ServerWindow::HandleKeyEvent(code, buffer);
|
||||||
// TODO: Call ServerWindow::HandleKeyEvent when we have ServerWindow.h
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case B_KEY_UP:
|
case B_KEY_UP:
|
||||||
@@ -705,8 +703,7 @@ void AppServer::HandleKeyMessage(int32 code, int8 *buffer)
|
|||||||
// 4) int32 number of elements in the key state array to follow
|
// 4) int32 number of elements in the key state array to follow
|
||||||
// 5) int8 state of all keys
|
// 5) int8 state of all keys
|
||||||
|
|
||||||
// TODO: Call ServerWindow::HandleKeyEvent when we have ServerWindow.h
|
ServerWindow::HandleMouseEvent(code,buffer);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -747,9 +744,18 @@ ServerApp *AppServer::FindApp(const char *sig)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Creates a new decorator instance
|
||||||
|
\param rect Frame size
|
||||||
|
\param title Title string for the "window"
|
||||||
|
\param wlook Window look type. See Window.h
|
||||||
|
\param wfeel Window feel type. See Window.h
|
||||||
|
\param wflags Window flags. See Window.h
|
||||||
|
*/
|
||||||
Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
|
Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel,
|
||||||
int32 wflags, DisplayDriver *ddriver)
|
int32 wflags, DisplayDriver *ddriver)
|
||||||
{
|
{
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ void DefaultDecorator::MoveBy(BPoint pt)
|
|||||||
BRegion * DefaultDecorator::GetFootprint(void)
|
BRegion * DefaultDecorator::GetFootprint(void)
|
||||||
{
|
{
|
||||||
// This function calculates the decorator's footprint in coordinates
|
// This function calculates the decorator's footprint in coordinates
|
||||||
// relative to the layer. This is most often used to set a WindowBorder
|
// relative to the layer. This is most often used to set a WinBorder
|
||||||
// object's visible region.
|
// object's visible region.
|
||||||
|
|
||||||
BRegion *reg=new BRegion(_borderrect);
|
BRegion *reg=new BRegion(_borderrect);
|
||||||
|
|||||||
@@ -43,12 +43,19 @@
|
|||||||
namespace desktop_private {
|
namespace desktop_private {
|
||||||
int8 *dragmessage;
|
int8 *dragmessage;
|
||||||
int32 dragmessagesize;
|
int32 dragmessagesize;
|
||||||
sem_id draglock,
|
BLocker draglock,
|
||||||
layerlock,
|
layerlock,
|
||||||
workspacelock;
|
workspacelock;
|
||||||
BList *screenlist;
|
BList *screenlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lock_layers(void) { desktop_private::layerlock.Lock(); }
|
||||||
|
void unlock_layers(void) { desktop_private::layerlock.Unlock(); }
|
||||||
|
void lock_dragdata(void) { desktop_private::draglock.Lock(); }
|
||||||
|
void unlock_dragdata(void) { desktop_private::draglock.Unlock(); }
|
||||||
|
void lock_workspaces(void) { desktop_private::workspacelock.Lock(); }
|
||||||
|
void unlock_workspaces(void) { desktop_private::workspacelock.Unlock(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Initializes the desktop for use.
|
\brief Initializes the desktop for use.
|
||||||
|
|
||||||
|
|||||||
@@ -60,4 +60,11 @@ void set_drag_message(int32 size, int8 *flattened);
|
|||||||
int8* get_drag_message(int32 *size);
|
int8* get_drag_message(int32 *size);
|
||||||
void empty_drag_message(void);
|
void empty_drag_message(void);
|
||||||
|
|
||||||
|
void lock_layers(void);
|
||||||
|
void unlock_layers(void);
|
||||||
|
void lock_dragdata(void);
|
||||||
|
void unlock_dragdata(void);
|
||||||
|
void lock_workspaces(void);
|
||||||
|
void unlock_workspaces(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ Server app_server :
|
|||||||
ServerBitmap.cpp
|
ServerBitmap.cpp
|
||||||
ServerCursor.cpp
|
ServerCursor.cpp
|
||||||
ViewDriver.cpp
|
ViewDriver.cpp
|
||||||
|
WinBorder.cpp
|
||||||
;
|
;
|
||||||
LinkSharedOSLibs app_server : be root game translation
|
LinkSharedOSLibs app_server : be root game translation
|
||||||
<boot!home!config!lib>libopenbeos.so
|
<boot!home!config!lib>libopenbeos.so
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
class ServerWindow;
|
class ServerWindow;
|
||||||
class PortLink;
|
class PortLink;
|
||||||
class RootLayer;
|
class RootLayer;
|
||||||
|
class WinBorder;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Layer Layer.h
|
\class Layer Layer.h
|
||||||
@@ -46,7 +47,7 @@ class RootLayer;
|
|||||||
|
|
||||||
Layers provide all sorts of functionality. They are the shadow class for BViews,
|
Layers provide all sorts of functionality. They are the shadow class for BViews,
|
||||||
but they also provide the base class for other classes which handle drawing to
|
but they also provide the base class for other classes which handle drawing to
|
||||||
the frame buffer, like RootLayer and WindowBorder.
|
the frame buffer, like RootLayer and WinBorder.
|
||||||
*/
|
*/
|
||||||
class Layer
|
class Layer
|
||||||
{
|
{
|
||||||
@@ -95,6 +96,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend RootLayer;
|
friend RootLayer;
|
||||||
|
friend WinBorder;
|
||||||
|
|
||||||
BRect _frame;
|
BRect _frame;
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ ServerApp::~ServerApp(void)
|
|||||||
{
|
{
|
||||||
int32 i;
|
int32 i;
|
||||||
|
|
||||||
// TODO: Enable this when we have ServerWindow implemented
|
|
||||||
ServerWindow *tempwin;
|
ServerWindow *tempwin;
|
||||||
for(i=0;i<_winlist->CountItems();i++)
|
for(i=0;i<_winlist->CountItems();i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,20 +36,16 @@
|
|||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
#include "WinBorder.h"
|
||||||
//#include "WindowBorder.h"
|
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "TokenHandler.h"
|
#include "TokenHandler.h"
|
||||||
|
|
||||||
//! Handler to get BWindow tokens from
|
//! Handler to get BWindow tokens from
|
||||||
TokenHandler win_token_handler;
|
TokenHandler win_token_handler;
|
||||||
|
|
||||||
// defined in WindowBorder.cpp. Locking is not necessary - the only
|
// defined in WinBorder.cpp. Locking is not necessary - the only
|
||||||
// _monitorthread which accesses them is the Poller _monitorthread
|
// _monitorthread which accesses them is the Poller _monitorthread
|
||||||
|
|
||||||
// TODO: Uncomment the extern keyword when we have WindowBorder.h
|
|
||||||
/* extern */bool is_moving_window,is_resizing_window,is_sliding_tab;
|
|
||||||
|
|
||||||
//! Used in window focus management
|
//! Used in window focus management
|
||||||
ServerWindow *active_serverwindow=NULL;
|
ServerWindow *active_serverwindow=NULL;
|
||||||
|
|
||||||
@@ -64,7 +60,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
_title=new BString;
|
_title=new BString;
|
||||||
_title->SetTo( (string)?string:"Window" );
|
_title->SetTo( (string)?string:"Window" );
|
||||||
|
|
||||||
// This must happen before the WindowBorder object - it needs this object's _frame
|
// This must happen before the WinBorder object - it needs this object's _frame
|
||||||
// to be valid
|
// to be valid
|
||||||
_frame=rect;
|
_frame=rect;
|
||||||
|
|
||||||
@@ -73,12 +69,9 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
_look=wlook;
|
_look=wlook;
|
||||||
_feel=wfeel;
|
_feel=wfeel;
|
||||||
|
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
|
||||||
// _winborder=new WindowBorder(this, _title->String());
|
|
||||||
|
|
||||||
_decorator=new_decorator(_frame,_title->String(),_look,_feel,_flags,GetGfxDriver());
|
_decorator=new_decorator(_frame,_title->String(),_look,_feel,_flags,GetGfxDriver());
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
|
||||||
// _winborder->SetDecorator(_decorator);
|
_winborder=new WinBorder(_frame,_title->String(),0,wflags,this);
|
||||||
|
|
||||||
// _sender is the monitored _app's event port
|
// _sender is the monitored _app's event port
|
||||||
_sender=winport;
|
_sender=winport;
|
||||||
@@ -112,7 +105,7 @@ ServerWindow::~ServerWindow(void)
|
|||||||
delete _title;
|
delete _title;
|
||||||
delete _winlink;
|
delete _winlink;
|
||||||
delete _decorator;
|
delete _decorator;
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
// TODO: uncomment this when we have WinBorder.h
|
||||||
// delete _winborder;
|
// delete _winborder;
|
||||||
}
|
}
|
||||||
kill_thread(_monitorthread);
|
kill_thread(_monitorthread);
|
||||||
@@ -147,7 +140,7 @@ void ServerWindow::Show(void)
|
|||||||
{
|
{
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
// TODO: uncomment this when we have WinBorder.h
|
||||||
// _winborder->ShowLayer();
|
// _winborder->ShowLayer();
|
||||||
ActivateWindow(this);
|
ActivateWindow(this);
|
||||||
}
|
}
|
||||||
@@ -155,7 +148,7 @@ void ServerWindow::Show(void)
|
|||||||
|
|
||||||
void ServerWindow::Hide(void)
|
void ServerWindow::Hide(void)
|
||||||
{
|
{
|
||||||
// TODO: uncomment this when we have WindowBorder.h
|
// TODO: uncomment this when we have WinBorder.h
|
||||||
// if(_winborder)
|
// if(_winborder)
|
||||||
// _winborder->HideLayer();
|
// _winborder->HideLayer();
|
||||||
}
|
}
|
||||||
@@ -335,12 +328,12 @@ int32 ServerWindow::MonitorWin(void *data)
|
|||||||
|
|
||||||
void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
||||||
{
|
{
|
||||||
ServerWindow *mousewin=NULL;
|
/* ServerWindow *mousewin=NULL;
|
||||||
int8 *index=buffer;
|
int8 *index=buffer;
|
||||||
|
|
||||||
// Find the window which will receive our mouse event.
|
// Find the window which will receive our mouse event.
|
||||||
Layer *root=GetRootLayer();
|
Layer *root=GetRootLayer();
|
||||||
WindowBorder *_winborder;
|
WinBorder *_winborder;
|
||||||
|
|
||||||
// activeborder is used to remember windows when resizing/moving windows
|
// activeborder is used to remember windows when resizing/moving windows
|
||||||
// or sliding a tab
|
// or sliding a tab
|
||||||
@@ -373,12 +366,11 @@ void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
// If we have clicked on a window,
|
// If we have clicked on a window,
|
||||||
_winborder=(WindowBorder*)root->GetChildAt(pt);
|
_winborder=(WinBorder*)root->GetChildAt(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
// TODO: Uncomment when we have WindowBorder.h
|
mousewin=_winborder->Window();
|
||||||
// mousewin=_winborder->Window();
|
_winborder->MouseDown(pt,buttons,modifiers);
|
||||||
// _winborder->MouseDown(pt,buttons,modifiers);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -399,12 +391,11 @@ void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|||||||
// int32 modifiers=*((int32*)index);
|
// int32 modifiers=*((int32*)index);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
is_moving_window=false;
|
set_is_moving_window(false);
|
||||||
_winborder=(WindowBorder*)root->GetChildAt(pt);
|
_winborder=(WinBorder*)root->GetChildAt(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
// TODO: Uncomment when we have WindowBorder.h
|
mousewin=_winborder->Window();
|
||||||
// mousewin=_winborder->Window();
|
|
||||||
|
|
||||||
// Eventually, we will build in MouseUp messages with buttons specified
|
// Eventually, we will build in MouseUp messages with buttons specified
|
||||||
// For now, we just "assume" no mouse specification with a 0.
|
// For now, we just "assume" no mouse specification with a 0.
|
||||||
@@ -429,20 +420,18 @@ void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|||||||
uint32 buttons=*((uint32*)index);
|
uint32 buttons=*((uint32*)index);
|
||||||
BPoint pt(x,y);
|
BPoint pt(x,y);
|
||||||
|
|
||||||
if(is_moving_window || is_resizing_window || is_sliding_tab)
|
if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
||||||
{
|
{
|
||||||
mousewin=active_serverwindow;
|
mousewin=active_serverwindow;
|
||||||
// TODO: Uncomment when we have WindowBorder.h
|
mousewin->_winborder->MouseMoved(pt,buttons,0);
|
||||||
// mousewin->_winborder->MouseMoved(pt,buttons,0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_winborder=(WindowBorder*)root->GetChildAt(pt);
|
_winborder=(WinBorder*)root->GetChildAt(pt);
|
||||||
if(_winborder)
|
if(_winborder)
|
||||||
{
|
{
|
||||||
// TODO: Uncomment when we have WindowBorder.h
|
mousewin=_winborder->Window();
|
||||||
// mousewin=_winborder->Window();
|
_winborder->MouseMoved(pt,buttons,0);
|
||||||
// _winborder->MouseMoved(pt,buttons,0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -452,6 +441,11 @@ void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServerWindow::HandleKeyEvent(int32 code, int8 *buffer)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivateWindow(ServerWindow *win)
|
void ActivateWindow(ServerWindow *win)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class BPoint;
|
|||||||
class ServerApp;
|
class ServerApp;
|
||||||
class Decorator;
|
class Decorator;
|
||||||
class PortLink;
|
class PortLink;
|
||||||
class WindowBorder;
|
class WinBorder;
|
||||||
|
|
||||||
class ServerWindow
|
class ServerWindow
|
||||||
{
|
{
|
||||||
@@ -79,6 +79,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend ServerApp;
|
friend ServerApp;
|
||||||
|
friend WinBorder;
|
||||||
|
|
||||||
BString *_title;
|
BString *_title;
|
||||||
int32 _look, _feel, _flags;
|
int32 _look, _feel, _flags;
|
||||||
int32 _workspace;
|
int32 _workspace;
|
||||||
@@ -87,7 +89,7 @@ protected:
|
|||||||
ServerApp *_app;
|
ServerApp *_app;
|
||||||
|
|
||||||
Decorator *_decorator;
|
Decorator *_decorator;
|
||||||
WindowBorder *_winborder;
|
WinBorder *_winborder;
|
||||||
|
|
||||||
thread_id _monitorthread;
|
thread_id _monitorthread;
|
||||||
port_id _receiver; // Messages from window
|
port_id _receiver; // Messages from window
|
||||||
|
|||||||
@@ -0,0 +1,300 @@
|
|||||||
|
#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"
|
||||||
|
|
||||||
|
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; }
|
||||||
|
WinBorder * get_active_winborder(void) { return winborder_private::active_winborder; }
|
||||||
|
void set_active_winborder(WinBorder *win) { winborder_private::active_winborder=win; }
|
||||||
|
|
||||||
|
WinBorder::WinBorder(BRect r, const char *name, int32 resize, int32 flags, ServerWindow *win)
|
||||||
|
: Layer(r,name,resize,flags,win)
|
||||||
|
{
|
||||||
|
_mbuttons=0;
|
||||||
|
_win=win;
|
||||||
|
if(_win)
|
||||||
|
_frame=_win->_frame;
|
||||||
|
|
||||||
|
_mousepos.Set(0,0);
|
||||||
|
_update=false;
|
||||||
|
|
||||||
|
_title=new BString(name);
|
||||||
|
_hresizewin=false;
|
||||||
|
_vresizewin=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
WinBorder::~WinBorder(void)
|
||||||
|
{
|
||||||
|
delete _title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::MouseDown(int8 *buffer)
|
||||||
|
{
|
||||||
|
/* _mbuttons=buttons;
|
||||||
|
kmodifiers=modifiers;
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
||||||
|
_mousepos=pt;
|
||||||
|
|
||||||
|
switch(click)
|
||||||
|
{
|
||||||
|
case CLICK_MOVETOBACK:
|
||||||
|
{
|
||||||
|
MoveToBack();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_MOVETOFRONT:
|
||||||
|
{
|
||||||
|
MoveToFront();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_CLOSE:
|
||||||
|
{
|
||||||
|
_decorator->SetClose(true);
|
||||||
|
_decorator->Draw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_ZOOM:
|
||||||
|
{
|
||||||
|
_decorator->SetZoom(true);
|
||||||
|
_decorator->Draw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_MINIMIZE:
|
||||||
|
{
|
||||||
|
_decorator->SetMinimize(true);
|
||||||
|
_decorator->Draw();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_DRAG:
|
||||||
|
{
|
||||||
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
||||||
|
is_moving_window=true;
|
||||||
|
|
||||||
|
if(buttons==B_SECONDARY_MOUSE_BUTTON)
|
||||||
|
MoveToBack();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_SLIDETAB:
|
||||||
|
{
|
||||||
|
is_sliding_tab=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_RESIZE:
|
||||||
|
{
|
||||||
|
if(buttons==B_PRIMARY_MOUSE_BUTTON)
|
||||||
|
is_resizing_window=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_NONE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(click!=CLICK_NONE)
|
||||||
|
ActivateWindow(_win);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::MouseMoved(int8 *buffer)
|
||||||
|
{
|
||||||
|
/* _mbuttons=buttons;
|
||||||
|
kmodifiers=modifiers;
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_sliding_tab)
|
||||||
|
{
|
||||||
|
float dx=pt.x-_mousepos.x;
|
||||||
|
|
||||||
|
if(dx!=0)
|
||||||
|
{
|
||||||
|
// 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.
|
||||||
|
layerlock->Lock();
|
||||||
|
parent->Invalidate(_decorator->SlideTab(dx,0));
|
||||||
|
parent->RequestDraw();
|
||||||
|
_decorator->DrawTab();
|
||||||
|
layerlock->Unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(is_moving_window)
|
||||||
|
{
|
||||||
|
float dx=pt.x-_mousepos.x,
|
||||||
|
dy=pt.y-_mousepos.y;
|
||||||
|
if(dx!=0 || dy!=0)
|
||||||
|
{
|
||||||
|
BRect oldmoveframe=_win->_frame;
|
||||||
|
clientframe.OffsetBy(pt);
|
||||||
|
|
||||||
|
_win->Lock();
|
||||||
|
_win->_frame.OffsetBy(dx,dy);
|
||||||
|
_win->Unlock();
|
||||||
|
|
||||||
|
layerlock->Lock();
|
||||||
|
// InvalidateLowerSiblings(oldmoveframe);
|
||||||
|
parent->Invalidate(oldmoveframe);
|
||||||
|
MoveBy(dx,dy);
|
||||||
|
parent->RequestDraw();
|
||||||
|
_decorator->MoveBy(BPoint(dx, dy));
|
||||||
|
_decorator->Draw();
|
||||||
|
layerlock->Unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(is_resizing_window)
|
||||||
|
{
|
||||||
|
float dx=pt.x-_mousepos.x,
|
||||||
|
dy=pt.y-_mousepos.y;
|
||||||
|
if(dx!=0 || dy!=0)
|
||||||
|
{
|
||||||
|
clientframe.right+=dx;
|
||||||
|
clientframe.bottom+=dy;
|
||||||
|
|
||||||
|
_win->Lock();
|
||||||
|
_win->_frame.right+=dx;
|
||||||
|
_win->_frame.bottom+=dy;
|
||||||
|
_win->Unlock();
|
||||||
|
|
||||||
|
layerlock->Lock();
|
||||||
|
ResizeBy(dx,dy);
|
||||||
|
parent->RequestDraw();
|
||||||
|
layerlock->Unlock();
|
||||||
|
_decorator->ResizeBy(dx,dy);
|
||||||
|
_decorator->Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_mousepos=pt;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::MouseUp(int8 *buffer)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
_mbuttons=buttons;
|
||||||
|
kmodifiers=modifiers;
|
||||||
|
is_moving_window=false;
|
||||||
|
is_resizing_window=false;
|
||||||
|
is_sliding_tab=false;
|
||||||
|
|
||||||
|
click_type click=_decorator->Clicked(pt, _mbuttons, kmodifiers);
|
||||||
|
|
||||||
|
switch(click)
|
||||||
|
{
|
||||||
|
case CLICK_CLOSE:
|
||||||
|
{
|
||||||
|
_decorator->SetClose(false);
|
||||||
|
_decorator->Draw();
|
||||||
|
|
||||||
|
// call close window stuff here
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_ZOOM:
|
||||||
|
{
|
||||||
|
_decorator->SetZoom(false);
|
||||||
|
_decorator->Draw();
|
||||||
|
|
||||||
|
// call zoom stuff here
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLICK_MINIMIZE:
|
||||||
|
{
|
||||||
|
_decorator->SetMinimize(false);
|
||||||
|
_decorator->Draw();
|
||||||
|
|
||||||
|
// call minimize stuff here
|
||||||
|
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::Draw(BRect update_rect)
|
||||||
|
{
|
||||||
|
/* if(_update && _visible!=NULL)
|
||||||
|
_is_updating=true;
|
||||||
|
|
||||||
|
_decorator->Draw(update_rect);
|
||||||
|
|
||||||
|
if(_update && _visible!=NULL)
|
||||||
|
_is_updating=false;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::RequestDraw(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
//printf("Layer %s::RequestDraw\n",name->String());
|
||||||
|
if(_invalid)
|
||||||
|
{
|
||||||
|
//printf("drew something\n");
|
||||||
|
// for(int32 i=0; i<invalid->CountRects();i++)
|
||||||
|
// _decorator->Draw(ConvertToTop(invalid->RectAt(i)));
|
||||||
|
_decorator->Draw();
|
||||||
|
delete _invalid;
|
||||||
|
_invalid=NULL;
|
||||||
|
_is_dirty=false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::MoveBy(BPoint pt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::MoveBy(float x, float y)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::ResizeBy(BPoint pt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void WinBorder::ResizeBy(float x, float y)
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#ifndef _WINBORDER_H_
|
||||||
|
#define _WINBORDER_H_
|
||||||
|
|
||||||
|
#include <Rect.h>
|
||||||
|
#include <String.h>
|
||||||
|
#include "Layer.h"
|
||||||
|
|
||||||
|
class ServerWindow;
|
||||||
|
class Decorator;
|
||||||
|
class DisplayDriver;
|
||||||
|
|
||||||
|
class WinBorder : public Layer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WinBorder(BRect r, const char *name, int32 resize, int32 flags, ServerWindow *win);
|
||||||
|
~WinBorder(void);
|
||||||
|
void RequestDraw(void);
|
||||||
|
void MoveBy(BPoint pt);
|
||||||
|
void MoveBy(float x, float y);
|
||||||
|
void ResizeBy(BPoint pt);
|
||||||
|
void ResizeBy(float x, float y);
|
||||||
|
void MouseDown(int8 *buffer);
|
||||||
|
void MouseMoved(int8 *buffer);
|
||||||
|
void MouseUp(int8 *buffer);
|
||||||
|
void Draw(BRect update);
|
||||||
|
void UpdateColors(void);
|
||||||
|
void UpdateDecorator(void);
|
||||||
|
void UpdateFont(void);
|
||||||
|
void UpdateScreen(void);
|
||||||
|
void RebuildRegions(bool recursive=true);
|
||||||
|
void Activate(bool active=false);
|
||||||
|
ServerWindow *Window(void) { return _win; }
|
||||||
|
protected:
|
||||||
|
ServerWindow *_win;
|
||||||
|
BString *_title;
|
||||||
|
Decorator *_decorator;
|
||||||
|
int32 _flags;
|
||||||
|
BRect _frame, _clientframe;
|
||||||
|
int32 _mbuttons,_kmodifiers;
|
||||||
|
BPoint _mousepos;
|
||||||
|
bool _update;
|
||||||
|
bool _hresizewin,_vresizewin;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_moving_window(void);
|
||||||
|
void set_is_moving_window(bool state);
|
||||||
|
bool is_resizing_window(void);
|
||||||
|
void set_is_resizing_window(bool state);
|
||||||
|
void set_active_winborder(WinBorder *win);
|
||||||
|
WinBorder * get_active_winborder(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user