forked from BoyC/GW2TacO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OverlayWindow.cpp
75 lines (63 loc) · 1.7 KB
/
OverlayWindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "OverlayWindow.h"
#include "OverlayConfig.h"
TBOOL OverlayWindow::IsMouseTransparent( CPoint &ClientSpacePoint, WBMESSAGE MessageType )
{
if ( GetConfigValue( "EditMode" ) ) return false;
return true;
}
OverlayWindow::OverlayWindow( CWBItem *Parent, CRect Position ) : CWBWindow( Parent, Position )
{
}
OverlayWindow::~OverlayWindow()
{
SetWindowPosition( GetID().GetPointer(), GetPosition() );
}
CWBItem * OverlayWindow::Factory( CWBItem *Root, CXMLNode &node, CRect &Pos )
{
return new OverlayWindow( Root, Pos );
}
void OverlayWindow::OnDraw( CWBDrawAPI *API )
{
if ( !GetConfigValue( "EditMode" ) ) return;
CWBWindow::OnDraw( API );
}
TBOOL OverlayWindow::MessageProc( CWBMessage &Message )
{
switch ( Message.GetMessage() )
{
case WBM_LEFTBUTTONDOWN:
if ( CWBItem::MessageProc( Message ) ) return true;
if ( App->GetMouseItem() == this )
{
SetCapture();
SavePosition();
if ( Style & WB_WINDOW_CLOSEABLE )
{
if ( GetElementPos( WB_WINELEMENT_CLOSE ).Contains( ScreenToClient( Message.GetPosition() ) ) )
{
DragMode = WB_DRAGMODE_CLOSEBUTTON;
return true;
}
}
if ( Style & WB_WINDOW_RESIZABLE )
{
DragMode = GetBorderSelectionArea( Message.GetPosition() );
if ( DragMode & WB_DRAGMASK ) return true;
}
if ( Style & WB_WINDOW_MOVEABLE )
{
DragMode = WB_DRAGMODE_MOVE;
return true;
}
DragMode = 0;
}
break;
case WBM_REPOSITION:
SetWindowPosition( GetID().GetPointer(), GetPosition() );
break;
case WBM_CLOSE:
SetWindowOpenState( GetID().GetPointer(), false );
break;
}
return CWBWindow::MessageProc( Message );
}