-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathNotepad.cpp
83 lines (68 loc) · 1.88 KB
/
Notepad.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
76
77
78
79
80
81
82
83
#include "Notepad.h"
#include "MumbleLink.h"
#include "gw2tactical.h"
#include "OverlayConfig.h"
TBOOL GW2Notepad::IsMouseTransparent( CPoint& ClientSpacePoint, WBMESSAGE MessageType )
{
return true;
}
GW2Notepad::GW2Notepad( CWBItem* Parent, CRect Position ) : CWBItem( Parent, Position )
{
App->GenerateGUITemplate( this, "gw2pois", "notepad" );
SetID( "notepad" );
CStreamReaderMemory nptext;
if ( !nptext.Open( "notepad.txt" ) )
return;
CWBTextBox* tb = (CWBTextBox*)FindChildByID( "notepad", "textbox" );
if ( !tb )
return;
tb->SetForcedMouseTransparency( true );
tb->SetText( CString( (TS8*)nptext.GetData(), (TS32)( nptext.GetLength() ) ) );
tb->SetCursorPos( 0, false );
}
GW2Notepad::~GW2Notepad()
{
CWBTextBox* tb = (CWBTextBox*)FindChildByID( "notepad", "textbox" );
if ( !tb )
return;
CStreamWriterFile nptext;
if ( !nptext.Open( "notepad.txt" ) )
return;
nptext.Write( tb->GetText().GetPointer(), tb->GetText().Length() );
}
CWBItem* GW2Notepad::Factory( CWBItem* Root, CXMLNode& node, CRect& Pos )
{
return new GW2Notepad( Root, Pos );
}
void GW2Notepad::StartEdit()
{
CWBTextBox* tb = (CWBTextBox*)FindChildByID( "notepad", "textbox" );
if ( !tb )
return;
canSetFocus = true;
tb->SetFocus();
tb->SetCursorPos( tb->GetText().Length(), false );
}
void GW2Notepad::OnDraw( CWBDrawAPI* API )
{}
TBOOL GW2Notepad::MessageProc( CWBMessage& Message )
{
switch ( Message.GetMessage() )
{
case WBM_FOCUSGAINED:
{
CWBItem* tb = (CWBItem*)FindChildByID( "notepad", "textbox" );
if ( tb->GetGuid() == Message.GetTarget() )
tb->SetForcedMouseTransparency( false );
}
break;
case WBM_FOCUSLOST:
{
CWBItem* tb = (CWBItem*)FindChildByID( "notepad", "textbox" );
if ( tb->GetGuid() == Message.GetTarget() )
tb->SetForcedMouseTransparency( true );
}
break;
}
return CWBItem::MessageProc( Message );
}