1
- /*
2
- this file is part of Function List Plugin for Notepad++
3
- Copyright (C)2005 Jens Lorenz <[email protected] >
1
+ // this file is part of Function List Plugin for Notepad++
2
+ // Copyright (C)2005 Jens Lorenz <[email protected] >
3
+ //
4
+ // This program is free software; you can redistribute it and/or
5
+ // modify it under the terms of the GNU General Public License
6
+ // as published by the Free Software Foundation; either
7
+ // version 2 of the License, or (at your option) any later version.
8
+ //
9
+ // Note that the GPL places important restrictions on "derived works", yet
10
+ // it does not provide a detailed definition of that term. To avoid
11
+ // misunderstandings, we consider an application to constitute a
12
+ // "derivative work" for the purpose of this license if it does any of the
13
+ // following:
14
+ // 1. Integrates source code from Notepad++.
15
+ // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
16
+ // installer, such as those produced by InstallShield.
17
+ // 3. Links to a library or executes a program that does any of the above.
18
+ //
19
+ // This program is distributed in the hope that it will be useful,
20
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ // GNU General Public License for more details.
23
+ //
24
+ // You should have received a copy of the GNU General Public License
25
+ // along with this program; if not, write to the Free Software
26
+
27
+
28
+ #pragma once
4
29
5
- This program is free software; you can redistribute it and/or
6
- modify it under the terms of the GNU General Public License
7
- as published by the Free Software Foundation; either
8
- version 2 of the License, or (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program; if not, write to the Free Software
17
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
- */
19
-
20
- #ifndef DOCKINGDLGINTERFACE_H
21
- #define DOCKINGDLGINTERFACE_H
22
-
23
- #include " StaticDialog.h"
24
30
#include " dockingResource.h"
25
31
#include " Docking.h"
32
+
33
+ #include < assert.h>
26
34
#include < shlwapi.h>
35
+ #include " Common.h"
36
+ #include " StaticDialog.h"
37
+
27
38
28
39
29
40
class DockingDlgInterface : public StaticDialog
30
41
{
31
42
public:
32
- DockingDlgInterface (): StaticDialog() {};
33
- DockingDlgInterface (int dlgID): StaticDialog(), _dlgID(dlgID) {};
34
-
35
- virtual void init (HINSTANCE hInst, HWND parent)
36
- {
43
+ DockingDlgInterface () = default ;
44
+ explicit DockingDlgInterface (int dlgID): _dlgID(dlgID) {}
45
+
46
+ virtual void init (HINSTANCE hInst, HWND parent) {
37
47
StaticDialog::init (hInst, parent);
38
- ::GetModuleFileName ((HMODULE)hInst, _moduleName, MAX_PATH);
39
- lstrcpy (_moduleName, PathFindFileName (_moduleName));
48
+ TCHAR temp[MAX_PATH];
49
+ ::GetModuleFileName (reinterpret_cast <HMODULE>(hInst), temp, MAX_PATH);
50
+ _moduleName = ::PathFindFileName (temp);
40
51
}
41
52
42
- void create (tTbData * data, bool isRTL = false ){
53
+ void create (tTbData* data, bool isRTL = false ) {
54
+ assert (data != nullptr );
43
55
StaticDialog::create (_dlgID, isRTL);
44
- ::GetWindowText (_hSelf, _pluginName, sizeof (_pluginName)/sizeof(TCHAR));
56
+ TCHAR temp[MAX_PATH];
57
+ ::GetWindowText (_hSelf, temp, MAX_PATH);
58
+ _pluginName = temp;
45
59
46
60
// user information
47
- data->hClient = _hSelf;
48
- data->pszName = _pluginName;
61
+ data->hClient = _hSelf;
62
+ data->pszName = _pluginName. c_str () ;
49
63
50
64
// supported features by plugin
51
- data->uMask = 0 ;
65
+ data->uMask = 0 ;
52
66
53
67
// additional info
54
- data->pszAddInfo = NULL ;
55
- _data = data;
56
-
57
- };
68
+ data->pszAddInfo = NULL ;
69
+ }
58
70
59
- virtual void updateDockingDlg (void ) {
60
- ::SendMessage (_hParent, NPPM_DMMUPDATEDISPINFO, 0 , ( LPARAM) _hSelf);
71
+ virtual void updateDockingDlg () {
72
+ ::SendMessage (_hParent, NPPM_DMMUPDATEDISPINFO, 0 , reinterpret_cast < LPARAM>( _hSelf) );
61
73
}
62
74
63
- virtual void destroy () {
64
- };
75
+ virtual void destroy () {}
76
+
77
+ virtual void setBackgroundColor (COLORREF) {}
78
+ virtual void setForegroundColor (COLORREF) {}
65
79
66
80
virtual void display (bool toShow = true ) const {
67
- ::SendMessage (_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0 , (LPARAM)_hSelf);
68
- };
81
+ ::SendMessage (_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0 , reinterpret_cast <LPARAM>(_hSelf));
82
+ }
83
+
84
+ bool isClosed () const {
85
+ return _isClosed;
86
+ }
87
+
88
+ void setClosed (bool toClose) {
89
+ _isClosed = toClose;
90
+ }
69
91
70
92
const TCHAR * getPluginFileName () const {
71
- return _moduleName;
72
- };
93
+ return _moduleName. c_str () ;
94
+ }
73
95
74
96
protected :
75
- virtual INT_PTR CALLBACK run_dlgProc (UINT message, WPARAM /* wParam*/ , LPARAM lParam)
76
- {
77
- switch (message)
97
+ int _dlgID = -1 ;
98
+ bool _isFloating = true ;
99
+ int _iDockedPos = 0 ;
100
+ generic_string _moduleName;
101
+ generic_string _pluginName;
102
+ bool _isClosed = false ;
103
+
104
+ virtual INT_PTR CALLBACK run_dlgProc (UINT message, WPARAM, LPARAM lParam) {
105
+ switch (message)
78
106
{
79
-
80
107
case WM_NOTIFY:
81
108
{
82
- LPNMHDR pnmh = ( LPNMHDR) lParam;
109
+ LPNMHDR pnmh = reinterpret_cast < LPNMHDR>( lParam) ;
83
110
84
111
if (pnmh->hwndFrom == _hParent)
85
112
{
@@ -96,6 +123,7 @@ protected :
96
123
}
97
124
case DMN_DOCK:
98
125
{
126
+ _iDockedPos = HIWORD (pnmh->code );
99
127
_isFloating = false ;
100
128
break ;
101
129
}
@@ -110,14 +138,4 @@ protected :
110
138
}
111
139
return FALSE ;
112
140
};
113
-
114
- // Handles
115
- HWND _HSource;
116
- tTbData* _data;
117
- int _dlgID;
118
- bool _isFloating;
119
- TCHAR _moduleName[MAX_PATH];
120
- TCHAR _pluginName[MAX_PATH];
121
141
};
122
-
123
- #endif // DOCKINGDLGINTERFACE_H
0 commit comments