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 Notepad++ project
2+ // Copyright (C)2006 Jens Lorenz <[email protected] >43
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.
4+ // This program is free software: you can redistribute it and/or modify
5+ // it under the terms of the GNU General Public License as published by
6+ // the Free Software Foundation, either version 3 of the License, or
7+ // at your option any later version.
8+ //
9+ // This program is distributed in the hope that it will be useful,
10+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ // GNU General Public License for more details.
13+ //
14+ // You should have received a copy of the GNU General Public License
15+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
916
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.
1417
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- */
18+ #pragma once
1919
20- #ifndef DOCKINGDLGINTERFACE_H
21- #define DOCKINGDLGINTERFACE_H
22-
23- #include " StaticDialog.h"
2420#include " dockingResource.h"
2521#include " Docking.h"
22+
23+ #include < assert.h>
2624#include < shlwapi.h>
25+ #include < string>
26+ #include " StaticDialog.h"
27+
2728
2829
2930class DockingDlgInterface : public StaticDialog
3031{
3132public:
32- DockingDlgInterface (): StaticDialog() {};
33- DockingDlgInterface (int dlgID): StaticDialog(), _dlgID(dlgID) {};
34-
35- virtual void init (HINSTANCE hInst, HWND parent)
36- {
33+ DockingDlgInterface () = default ;
34+ explicit DockingDlgInterface (int dlgID): _dlgID(dlgID) {}
35+
36+ virtual void init (HINSTANCE hInst, HWND parent) {
3737 StaticDialog::init (hInst, parent);
38- ::GetModuleFileName ((HMODULE)hInst, _moduleName, MAX_PATH);
39- lstrcpy (_moduleName, PathFindFileName (_moduleName));
38+ TCHAR temp[MAX_PATH];
39+ ::GetModuleFileName (reinterpret_cast <HMODULE>(hInst), temp, MAX_PATH);
40+ _moduleName = ::PathFindFileName (temp);
4041 }
4142
42- void create (tTbData * data, bool isRTL = false ){
43+ void create (tTbData* data, bool isRTL = false ) {
44+ assert (data != nullptr );
4345 StaticDialog::create (_dlgID, isRTL);
44- ::GetWindowText (_hSelf, _pluginName, sizeof (_pluginName));
46+ TCHAR temp[MAX_PATH];
47+ ::GetWindowText (_hSelf, temp, MAX_PATH);
48+ _pluginName = temp;
4549
4650 // user information
47- data->hClient = _hSelf;
48- data->pszName = _pluginName;
51+ data->hClient = _hSelf;
52+ data->pszName = _pluginName. c_str () ;
4953
5054 // supported features by plugin
51- data->uMask = 0 ;
55+ data->uMask = 0 ;
5256
5357 // additional info
54- data->pszAddInfo = NULL ;
55- _data = data;
56-
57- };
58+ data->pszAddInfo = NULL ;
59+ }
5860
59- virtual void updateDockingDlg (void ) {
60- ::SendMessage (_hParent, NPPM_DMMUPDATEDISPINFO, 0 , ( LPARAM) _hSelf);
61+ virtual void updateDockingDlg () {
62+ ::SendMessage (_hParent, NPPM_DMMUPDATEDISPINFO, 0 , reinterpret_cast < LPARAM>( _hSelf) );
6163 }
6264
63- virtual void destroy () {
64- };
65+ virtual void destroy () {}
66+
67+ virtual void setBackgroundColor (COLORREF) {}
68+ virtual void setForegroundColor (COLORREF) {}
6569
6670 virtual void display (bool toShow = true ) const {
67- ::SendMessage (_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0 , (LPARAM)_hSelf);
68- };
71+ ::SendMessage (_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0 , reinterpret_cast <LPARAM>(_hSelf));
72+ }
73+
74+ bool isClosed () const {
75+ return _isClosed;
76+ }
77+
78+ void setClosed (bool toClose) {
79+ _isClosed = toClose;
80+ }
6981
7082 const TCHAR * getPluginFileName () const {
71- return _moduleName;
72- };
83+ return _moduleName. c_str () ;
84+ }
7385
7486protected :
75- virtual INT_PTR CALLBACK run_dlgProc (UINT message, WPARAM /* wParam*/ , LPARAM lParam)
76- {
77- switch (message)
87+ int _dlgID = -1 ;
88+ bool _isFloating = true ;
89+ int _iDockedPos = 0 ;
90+ std::wstring _moduleName;
91+ std::wstring _pluginName;
92+ bool _isClosed = false ;
93+
94+ virtual INT_PTR CALLBACK run_dlgProc (UINT message, WPARAM, LPARAM lParam) {
95+ switch (message)
7896 {
79-
8097 case WM_NOTIFY:
8198 {
82- LPNMHDR pnmh = ( LPNMHDR) lParam;
99+ LPNMHDR pnmh = reinterpret_cast < LPNMHDR>( lParam) ;
83100
84101 if (pnmh->hwndFrom == _hParent)
85102 {
@@ -96,6 +113,7 @@ protected :
96113 }
97114 case DMN_DOCK:
98115 {
116+ _iDockedPos = HIWORD (pnmh->code );
99117 _isFloating = false ;
100118 break ;
101119 }
@@ -110,14 +128,4 @@ protected :
110128 }
111129 return FALSE ;
112130 };
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];
121131};
122-
123- #endif // DOCKINGDLGINTERFACE_H
0 commit comments