GUI Enhancement: Plugins Admin dialog
- add key accelerators - remove unused define - add initializers - fix override warnings - optimize dark mode - resize listview controls based on other child controls Fix #13622, close #13623
This commit is contained in:
parent
571c815b1e
commit
4e0f50416d
|
@ -547,12 +547,12 @@ Translation note:
|
|||
<PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible">
|
||||
<ColumnPlugin name="Plugin"/>
|
||||
<ColumnVersion name="Version"/>
|
||||
<Item id="5501" name="Search:"/>
|
||||
<Item id="5503" name="Install"/>
|
||||
<Item id="5504" name="Update"/>
|
||||
<Item id="5505" name="Remove"/>
|
||||
<Item id="5508" name="Next"/>
|
||||
<Item id="5509" name="Plugin list version: "/>
|
||||
<Item id="5501" name="&Search:"/>
|
||||
<Item id="5503" name="&Install"/>
|
||||
<Item id="5504" name="&Update"/>
|
||||
<Item id="5505" name="&Remove"/>
|
||||
<Item id="5508" name="&Next"/>
|
||||
<Item id="5509" name="Plugin list version:"/>
|
||||
<Item id="5511" name="Plugin list repository"/>
|
||||
<Item id="2" name="Close"/>
|
||||
</PluginsAdminDlg>
|
||||
|
|
|
@ -547,12 +547,12 @@ Translation note:
|
|||
<PluginsAdminDlg title="Plugins Admin" titleAvailable="Available" titleUpdates="Updates" titleInstalled="Installed" titleIncompatible="Incompatible">
|
||||
<ColumnPlugin name="Plugin"/>
|
||||
<ColumnVersion name="Version"/>
|
||||
<Item id="5501" name="Search:"/>
|
||||
<Item id="5503" name="Install"/>
|
||||
<Item id="5504" name="Update"/>
|
||||
<Item id="5505" name="Remove"/>
|
||||
<Item id="5508" name="Next"/>
|
||||
<Item id="5509" name="Plugin list version: "/>
|
||||
<Item id="5501" name="&Search:"/>
|
||||
<Item id="5503" name="&Install"/>
|
||||
<Item id="5504" name="&Update"/>
|
||||
<Item id="5505" name="&Remove"/>
|
||||
<Item id="5508" name="&Next"/>
|
||||
<Item id="5509" name="Plugin list version:"/>
|
||||
<Item id="5511" name="Plugin list repository"/>
|
||||
<Item id="2" name="Close"/>
|
||||
</PluginsAdminDlg>
|
||||
|
|
|
@ -127,7 +127,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
|||
|
||||
StaticDialog::create(dialogID, isRTL, msgDestParent);
|
||||
|
||||
RECT rect;
|
||||
RECT rect{};
|
||||
getClientRect(rect);
|
||||
_tab.init(_hInst, _hSelf, false, true);
|
||||
NppDarkMode::subclassTabControl(_tab.getHSelf());
|
||||
|
@ -146,124 +146,53 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
|||
_tab.insertAtEnd(installed);
|
||||
_tab.insertAtEnd(incompatible);
|
||||
|
||||
rect.bottom -= dpiManager.scaleY(105);
|
||||
RECT rcDesc{};
|
||||
getMappedChildRect(IDC_PLUGINADM_EDIT, rcDesc);
|
||||
|
||||
const long margeX = ::GetSystemMetrics(SM_CXEDGE);
|
||||
const long margeY = tabDpiDynamicalHeight;
|
||||
|
||||
rect.bottom = rcDesc.bottom + margeY;
|
||||
_tab.reSizeTo(rect);
|
||||
_tab.display();
|
||||
|
||||
const long marge = dpiManager.scaleX(10);
|
||||
const int topMarge = dpiManager.scaleY(42);
|
||||
RECT rcSearch{};
|
||||
getMappedChildRect(IDC_PLUGINADM_SEARCH_EDIT, rcSearch);
|
||||
|
||||
HWND hResearchLabel = ::GetDlgItem(_hSelf, IDC_PLUGINADM_SEARCH_STATIC);
|
||||
RECT researchLabelRect;
|
||||
::GetClientRect(hResearchLabel, &researchLabelRect);
|
||||
researchLabelRect.left = rect.left + marge;
|
||||
long leftCusor = researchLabelRect.left + researchLabelRect.right;
|
||||
researchLabelRect.top = topMarge + dpiManager.scaleY(4);
|
||||
::MoveWindow(hResearchLabel, researchLabelRect.left, researchLabelRect.top, researchLabelRect.right, researchLabelRect.bottom, TRUE);
|
||||
::InvalidateRect(hResearchLabel, nullptr, TRUE);
|
||||
|
||||
HWND hResearchEdit = ::GetDlgItem(_hSelf, IDC_PLUGINADM_SEARCH_EDIT);
|
||||
RECT researchEditRect;
|
||||
::GetClientRect(hResearchEdit, &researchEditRect);
|
||||
researchEditRect.left = leftCusor;
|
||||
leftCusor += researchEditRect.right;
|
||||
researchEditRect.top = topMarge + dpiManager.scaleX(1);
|
||||
::MoveWindow(hResearchEdit, researchEditRect.left, researchEditRect.top, researchEditRect.right, researchEditRect.bottom, TRUE);
|
||||
::InvalidateRect(hResearchEdit, nullptr, TRUE);
|
||||
|
||||
HWND hNextButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_RESEARCH_NEXT);
|
||||
RECT researchNextRect;
|
||||
::GetClientRect(hNextButton, &researchNextRect);
|
||||
researchNextRect.left = leftCusor + marge;
|
||||
leftCusor = researchNextRect.left + researchNextRect.right;
|
||||
researchNextRect.top = topMarge;
|
||||
::MoveWindow(hNextButton, researchNextRect.left, researchNextRect.top, researchNextRect.right, researchNextRect.bottom, TRUE);
|
||||
::InvalidateRect(hNextButton, nullptr, TRUE);
|
||||
|
||||
HWND hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_INSTALL);
|
||||
RECT actionRect;
|
||||
::GetClientRect(hActionButton, &actionRect);
|
||||
long w = actionRect.right - actionRect.left;
|
||||
actionRect.left = rect.right - w - marge;
|
||||
actionRect.top = topMarge;
|
||||
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
|
||||
::InvalidateRect(hActionButton, nullptr, TRUE);
|
||||
|
||||
hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_UPDATE);
|
||||
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
|
||||
::InvalidateRect(hActionButton, nullptr, TRUE);
|
||||
|
||||
hActionButton = ::GetDlgItem(_hSelf, IDC_PLUGINADM_REMOVE);
|
||||
::MoveWindow(hActionButton, actionRect.left, actionRect.top, actionRect.right, actionRect.bottom, TRUE);
|
||||
::InvalidateRect(hActionButton, nullptr, TRUE);
|
||||
|
||||
long actionZoneHeight = dpiManager.scaleY(50);
|
||||
rect.top += actionZoneHeight;
|
||||
rect.bottom -= actionZoneHeight;
|
||||
|
||||
RECT listRect = rect;
|
||||
RECT descRect = rect;
|
||||
|
||||
long descHeight = rect.bottom / 3 - marge;
|
||||
long listHeight = (rect.bottom / 3) * 2 - marge * 3;
|
||||
|
||||
listRect.top += marge;
|
||||
listRect.bottom = listHeight;
|
||||
listRect.left += marge;
|
||||
listRect.right -= marge * 2;
|
||||
|
||||
descRect.top += listHeight + marge * 3;
|
||||
descRect.bottom = descHeight;
|
||||
descRect.left += marge;
|
||||
descRect.right -= marge * 2;
|
||||
RECT listRect{
|
||||
rcDesc.left - margeX,
|
||||
rcSearch.bottom + margeY,
|
||||
rcDesc.right + ::GetSystemMetrics(SM_CXVSCROLL) + margeX,
|
||||
rcDesc.top - margeY
|
||||
};
|
||||
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
||||
generic_string pluginStr = pNativeSpeaker->getAttrNameStr(TEXT("Plugin"), "PluginAdmin", "Plugin");
|
||||
generic_string vesionStr = pNativeSpeaker->getAttrNameStr(TEXT("Version"), "PluginAdmin", "Version");
|
||||
|
||||
COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
|
||||
COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
|
||||
const COLORREF fgColor = nppParam.getCurrentDefaultFgColor();
|
||||
const COLORREF bgColor = nppParam.getCurrentDefaultBgColor();
|
||||
|
||||
_availableList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
|
||||
_availableList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
|
||||
_availableList.setViewStyleOption(LVS_EX_CHECKBOXES);
|
||||
_availableList.initView(_hInst, _hSelf);
|
||||
ListView_SetBkColor(_availableList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextBkColor(_availableList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextColor(_availableList.getViewHwnd(), fgColor);
|
||||
_availableList.reSizeView(listRect);
|
||||
|
||||
_updateList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
|
||||
_updateList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
|
||||
_updateList.setViewStyleOption(LVS_EX_CHECKBOXES);
|
||||
_updateList.initView(_hInst, _hSelf);
|
||||
ListView_SetBkColor(_updateList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextBkColor(_updateList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextColor(_updateList.getViewHwnd(), fgColor);
|
||||
_updateList.reSizeView(listRect);
|
||||
const size_t szColVer = dpiManager.scaleX(100);
|
||||
const size_t szColName = szColVer * 2;
|
||||
|
||||
_installedList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
|
||||
_installedList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
|
||||
_installedList.setViewStyleOption(LVS_EX_CHECKBOXES);
|
||||
_installedList.initView(_hInst, _hSelf);
|
||||
ListView_SetBkColor(_installedList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextBkColor(_installedList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextColor(_installedList.getViewHwnd(), fgColor);
|
||||
_installedList.reSizeView(listRect);
|
||||
auto initListView = [&](PluginViewList& list) -> void {
|
||||
list.addColumn(columnInfo(pluginStr, szColName));
|
||||
list.addColumn(columnInfo(vesionStr, szColVer));
|
||||
list.setViewStyleOption(LVS_EX_CHECKBOXES);
|
||||
list.initView(_hInst, _hSelf);
|
||||
const HWND hList = list.getViewHwnd();
|
||||
ListView_SetBkColor(hList, bgColor);
|
||||
ListView_SetTextBkColor(hList, bgColor);
|
||||
ListView_SetTextColor(hList, fgColor);
|
||||
list.reSizeView(listRect);
|
||||
};
|
||||
|
||||
_incompatibleList.addColumn(columnInfo(pluginStr, nppParam._dpiManager.scaleX(200)));
|
||||
_incompatibleList.addColumn(columnInfo(vesionStr, nppParam._dpiManager.scaleX(100)));
|
||||
_incompatibleList.initView(_hInst, _hSelf);
|
||||
ListView_SetBkColor(_incompatibleList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextBkColor(_incompatibleList.getViewHwnd(), bgColor);
|
||||
ListView_SetTextColor(_incompatibleList.getViewHwnd(), fgColor);
|
||||
_incompatibleList.reSizeView(listRect);
|
||||
|
||||
|
||||
HWND hDesc = ::GetDlgItem(_hSelf, IDC_PLUGINADM_EDIT);
|
||||
::MoveWindow(hDesc, descRect.left, descRect.top, descRect.right, descRect.bottom, TRUE);
|
||||
::InvalidateRect(hDesc, nullptr, TRUE);
|
||||
initListView(_availableList);
|
||||
initListView(_updateList);
|
||||
initListView(_installedList);
|
||||
initListView(_incompatibleList);
|
||||
|
||||
switchDialog(0);
|
||||
|
||||
|
@ -276,7 +205,7 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
|||
_repoLink.init(_hInst, _hSelf);
|
||||
_repoLink.create(::GetDlgItem(_hSelf, IDC_PLUGINLIST_ADDR), TEXT("https://github.com/notepad-plus-plus/nppPluginList"));
|
||||
|
||||
goToCenter();
|
||||
goToCenter(SWP_SHOWWINDOW | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
void PluginsAdminDlg::collectNppCurrentStatusInfos()
|
||||
|
@ -296,7 +225,7 @@ vector<PluginUpdateInfo*> PluginViewList::fromUiIndexesToPluginInfos(const std::
|
|||
std::vector<PluginUpdateInfo*> r;
|
||||
size_t nb = _ui.nbItem();
|
||||
|
||||
for (auto i : uiIndexes)
|
||||
for (const auto &i : uiIndexes)
|
||||
{
|
||||
if (i < nb)
|
||||
{
|
||||
|
@ -353,7 +282,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
|
|||
|
||||
generic_string updaterParams = opStr;
|
||||
|
||||
TCHAR nppFullPath[MAX_PATH];
|
||||
TCHAR nppFullPath[MAX_PATH]{};
|
||||
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
||||
updaterParams += TEXT("\"");
|
||||
updaterParams += nppFullPath;
|
||||
|
@ -363,7 +292,7 @@ bool PluginsAdminDlg::exitToInstallRemovePlugins(Operation op, const vector<Plug
|
|||
updaterParams += nppParameters.getPluginRootDir();
|
||||
updaterParams += TEXT("\"");
|
||||
|
||||
for (auto i : puis)
|
||||
for (const auto &i : puis)
|
||||
{
|
||||
if (op == pa_install || op == pa_update)
|
||||
{
|
||||
|
@ -458,12 +387,12 @@ bool PluginsAdminDlg::removePlugins()
|
|||
|
||||
void PluginsAdminDlg::changeTabName(LIST_TYPE index, const TCHAR *name2change)
|
||||
{
|
||||
TCITEM tie;
|
||||
TCITEM tie{};
|
||||
tie.mask = TCIF_TEXT;
|
||||
tie.pszText = (TCHAR *)name2change;
|
||||
TabCtrl_SetItem(_tab.getHSelf(), index, &tie);
|
||||
|
||||
TCHAR label[MAX_PATH];
|
||||
TCHAR label[MAX_PATH]{};
|
||||
_tab.getCurrentTitle(label, MAX_PATH);
|
||||
::SetWindowText(_hSelf, label);
|
||||
}
|
||||
|
@ -815,7 +744,7 @@ bool PluginsAdminDlg::updateList()
|
|||
|
||||
bool PluginsAdminDlg::initAvailablePluginsViewFromList()
|
||||
{
|
||||
TCHAR nppFullPathName[MAX_PATH];
|
||||
TCHAR nppFullPathName[MAX_PATH]{};
|
||||
GetModuleFileName(NULL, nppFullPathName, MAX_PATH);
|
||||
|
||||
Version nppVer;
|
||||
|
@ -844,7 +773,7 @@ bool PluginsAdminDlg::initAvailablePluginsViewFromList()
|
|||
|
||||
bool PluginsAdminDlg::initIncompatiblePluginList()
|
||||
{
|
||||
TCHAR nppFullPathName[MAX_PATH];
|
||||
TCHAR nppFullPathName[MAX_PATH]{};
|
||||
GetModuleFileName(NULL, nppFullPathName, MAX_PATH);
|
||||
|
||||
Version nppVer;
|
||||
|
@ -878,7 +807,7 @@ bool PluginsAdminDlg::loadFromPluginInfos()
|
|||
continue;
|
||||
|
||||
// user file name (without ext. to find whole info in available list
|
||||
TCHAR fnNoExt[MAX_PATH];
|
||||
TCHAR fnNoExt[MAX_PATH]{};
|
||||
wcscpy_s(fnNoExt, i._fileName.c_str());
|
||||
::PathRemoveExtension(fnNoExt);
|
||||
|
||||
|
@ -1020,7 +949,7 @@ bool PluginViewList::hideFromPluginInfoPtr(PluginUpdateInfo* pluginInfo2hide)
|
|||
|
||||
bool PluginViewList::restore(const generic_string& folderName)
|
||||
{
|
||||
for (auto i : _list)
|
||||
for (const auto &i : _list)
|
||||
{
|
||||
if (i->_folderName == folderName)
|
||||
{
|
||||
|
@ -1066,8 +995,8 @@ bool PluginsAdminDlg::checkUpdates()
|
|||
// begin insentive-case search from the second key-in character
|
||||
bool PluginsAdminDlg::searchInPlugins(bool isNextMode) const
|
||||
{
|
||||
const int maxLen = 256;
|
||||
TCHAR txt2search[maxLen];
|
||||
constexpr int maxLen = 256;
|
||||
TCHAR txt2search[maxLen]{};
|
||||
::GetDlgItemText(_hSelf, IDC_PLUGINADM_SEARCH_EDIT, txt2search, maxLen);
|
||||
if (lstrlen(txt2search) < 2)
|
||||
return false;
|
||||
|
@ -1210,35 +1139,24 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
case WM_CTLCOLOREDIT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
break;
|
||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_CTLCOLORDLG:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
break;
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
HWND hwnd = reinterpret_cast<HWND>(lParam);
|
||||
if (hwnd == ::GetDlgItem(_hSelf, IDC_PLUGINADM_EDIT))
|
||||
const int dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast<HWND>(lParam));
|
||||
if (dlgCtrlID == IDC_PLUGINADM_EDIT)
|
||||
{
|
||||
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
else
|
||||
{
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1319,13 +1237,13 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
switchDialog(indexClicked);
|
||||
}
|
||||
}
|
||||
else if (pnmh->hwndFrom == _availableList.getViewHwnd() ||
|
||||
else if (pnmh->hwndFrom == _availableList.getViewHwnd() ||
|
||||
pnmh->hwndFrom == _updateList.getViewHwnd() ||
|
||||
pnmh->hwndFrom == _installedList.getViewHwnd() ||
|
||||
pnmh->hwndFrom == _incompatibleList.getViewHwnd())
|
||||
{
|
||||
PluginViewList* pViewList;
|
||||
int buttonID;
|
||||
PluginViewList* pViewList = nullptr;
|
||||
int buttonID = 0;
|
||||
|
||||
if (pnmh->hwndFrom == _availableList.getViewHwnd())
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
PluginViewList() = default;
|
||||
~PluginViewList() {
|
||||
_ui.destroy();
|
||||
for (auto i : _list)
|
||||
for (auto& i : _list)
|
||||
{
|
||||
delete i;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
void setSelection(int index) const { _ui.setSelection(index); };
|
||||
void initView(HINSTANCE hInst, HWND parent) { _ui.init(hInst, parent); };
|
||||
void addColumn(const columnInfo & column2Add) { _ui.addColumn(column2Add); };
|
||||
void reSizeView(RECT & rc) { _ui.reSizeTo(rc); }
|
||||
void reSizeView(RECT & rc) { _ui.reSizeToWH(rc); }
|
||||
void setViewStyleOption(int32_t extraStyle) { _ui.setStyleOption(extraStyle); };
|
||||
size_t nbItem() const { return _ui.nbItem(); };
|
||||
PluginUpdateInfo* getPluginInfoFromUiIndex(size_t index) const { return reinterpret_cast<PluginUpdateInfo*>(_ui.getLParamFromIndex(static_cast<int>(index))); };
|
||||
|
@ -145,24 +145,15 @@ public :
|
|||
PluginsAdminDlg();
|
||||
~PluginsAdminDlg() = default;
|
||||
|
||||
void init(HINSTANCE hInst, HWND parent) {
|
||||
Window::init(hInst, parent);
|
||||
};
|
||||
void create(int dialogID, bool isRTL = false, bool msgDestParent = true) override;
|
||||
|
||||
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
|
||||
|
||||
void doDialog(bool isRTL = false) {
|
||||
if (!isCreated())
|
||||
void doDialog(bool isRTL = false) {
|
||||
if (!isCreated())
|
||||
{
|
||||
create(IDD_PLUGINSADMIN_DLG, isRTL);
|
||||
}
|
||||
|
||||
if (!::IsWindowVisible(_hSelf))
|
||||
{
|
||||
|
||||
}
|
||||
display();
|
||||
};
|
||||
display();
|
||||
};
|
||||
|
||||
bool initFromJson();
|
||||
|
||||
|
@ -188,7 +179,7 @@ public :
|
|||
};
|
||||
|
||||
protected:
|
||||
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||
|
||||
private :
|
||||
generic_string _updaterDir;
|
||||
|
|
|
@ -18,25 +18,21 @@
|
|||
#include "windows.h"
|
||||
#include "pluginsAdminRes.h"
|
||||
|
||||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC -1
|
||||
#endif
|
||||
|
||||
IDD_PLUGINSADMIN_DLG DIALOGEX 36, 44, 500, 300
|
||||
IDD_PLUGINSADMIN_DLG DIALOGEX 0, 0, 500, 265
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
|
||||
CAPTION "Plugins Admin"
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
RTEXT "Search: ",IDC_PLUGINADM_SEARCH_STATIC,50,38,50,8
|
||||
EDITTEXT IDC_PLUGINADM_SEARCH_EDIT,160,35,150,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Next", IDC_PLUGINADM_RESEARCH_NEXT,332,35,57,14
|
||||
PUSHBUTTON "Install", IDC_PLUGINADM_INSTALL,432,35,57,14
|
||||
PUSHBUTTON "Update", IDC_PLUGINADM_UPDATE,432,35,57,14
|
||||
PUSHBUTTON "Remove", IDC_PLUGINADM_REMOVE,432,35,57,14
|
||||
EDITTEXT IDC_PLUGINADM_EDIT,30,160,220,80,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL
|
||||
RTEXT "Plugin list version: ", IDC_PLUGINLIST_VERSION_STATIC,350,242,120,14
|
||||
RTEXT "", IDC_PLUGINLIST_VERSIONNUMBER_STATIC,467,242,22,14
|
||||
RTEXT "Plugin list repository",IDC_PLUGINLIST_ADDR,369,257,120,14
|
||||
PUSHBUTTON "Close", IDCANCEL, 225, 270, 57, 14
|
||||
RTEXT "&Search:",IDC_PLUGINADM_SEARCH_STATIC,16,20,50,8
|
||||
EDITTEXT IDC_PLUGINADM_SEARCH_EDIT,69,19,150,12,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "&Next",IDC_PLUGINADM_RESEARCH_NEXT,222,18,60,14
|
||||
PUSHBUTTON "&Install",IDC_PLUGINADM_INSTALL,432,18,60,14
|
||||
PUSHBUTTON "&Update",IDC_PLUGINADM_UPDATE,432,18,60,14
|
||||
PUSHBUTTON "&Remove",IDC_PLUGINADM_REMOVE,432,18,60,14
|
||||
EDITTEXT IDC_PLUGINADM_EDIT,8,167,484,60,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL
|
||||
RTEXT "Plugin list version:",IDC_PLUGINLIST_VERSION_STATIC,348,234,120,8
|
||||
RTEXT "",IDC_PLUGINLIST_VERSIONNUMBER_STATIC,467,234,22,8
|
||||
RTEXT "Plugin list repository",IDC_PLUGINLIST_ADDR,369,247,120,14
|
||||
PUSHBUTTON "Close",IDCANCEL,220,245,60,14
|
||||
END
|
||||
|
|
|
@ -36,12 +36,23 @@ void StaticDialog::destroy()
|
|||
::DestroyWindow(_hSelf);
|
||||
}
|
||||
|
||||
void StaticDialog::getMappedChildRect(HWND hChild, RECT& rcChild) const
|
||||
{
|
||||
::GetClientRect(hChild, &rcChild);
|
||||
::MapWindowPoints(hChild, _hSelf, reinterpret_cast<LPPOINT>(&rcChild), 2);
|
||||
}
|
||||
|
||||
void StaticDialog::getMappedChildRect(int idChild, RECT& rcChild) const
|
||||
{
|
||||
const HWND hChild = ::GetDlgItem(_hSelf, idChild);
|
||||
getMappedChildRect(hChild, rcChild);
|
||||
}
|
||||
|
||||
void StaticDialog::redrawDlgItem(const int nIDDlgItem, bool forceUpdate) const
|
||||
{
|
||||
RECT rcDlgItem{};
|
||||
const HWND hDlgItem = ::GetDlgItem(_hSelf, nIDDlgItem);
|
||||
::GetClientRect(hDlgItem, &rcDlgItem);
|
||||
::MapWindowPoints(hDlgItem, _hSelf, reinterpret_cast<LPPOINT>(&rcDlgItem), 2);
|
||||
getMappedChildRect(hDlgItem, rcDlgItem);
|
||||
::InvalidateRect(_hSelf, &rcDlgItem, TRUE);
|
||||
|
||||
if (forceUpdate)
|
||||
|
|
|
@ -43,10 +43,12 @@ public :
|
|||
|
||||
virtual void create(int dialogID, bool isRTL = false, bool msgDestParent = true);
|
||||
|
||||
virtual bool isCreated() const {
|
||||
return (_hSelf != NULL);
|
||||
virtual bool isCreated() const {
|
||||
return (_hSelf != nullptr);
|
||||
}
|
||||
|
||||
void getMappedChildRect(HWND hChild, RECT& rcChild) const;
|
||||
void getMappedChildRect(int idChild, RECT& rcChild) const;
|
||||
void redrawDlgItem(const int nIDDlgItem, bool forceUpdate = false) const;
|
||||
|
||||
void goToCenter(UINT swpFlags = SWP_SHOWWINDOW);
|
||||
|
|
Loading…
Reference in New Issue