commit 2f64e61c90730e82f31fe1b26fd12a5cb4743736
parent 8c655c2877fb278e72ab9b340444a48411047b84
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 1 Feb 2016 09:50:05 -0800
prettify ui for windows
Diffstat:
6 files changed, 48 insertions(+), 16 deletions(-)
diff --git a/src/about.cpp b/src/about.cpp
@@ -37,14 +37,20 @@ void About::onInit()
m_about = createControl<RichEdit>(IDC_ABOUT);
m_cats = createControl<ListView>(IDC_CATEGORIES, ListView::Columns{
- {AUTO_STR("Category"), 140}
+ {AUTO_STR("Category"), 200}
});
m_cats->onSelect(bind(&About::updatePackages, this));
+#ifdef _WIN32
+ const int NAME_SIZE = 330;
+#else
+ const int NAME_SIZE = 380;
+#endif
+
m_packages = createControl<ListView>(IDC_PACKAGES, ListView::Columns{
- {AUTO_STR("Name"), 350},
- {AUTO_STR("Version"), 90},
+ {AUTO_STR("Name"), NAME_SIZE},
+ {AUTO_STR("Version"), 80},
{AUTO_STR("Author"), 100},
});
@@ -55,6 +61,11 @@ void About::onInit()
});
populate();
+
+#ifdef LVSCW_AUTOSIZE_USEHEADER
+ m_cats->resizeColumn(0, LVSCW_AUTOSIZE_USEHEADER);
+ m_packages->resizeColumn(2, LVSCW_AUTOSIZE_USEHEADER);
+#endif
}
void About::onCommand(const int id)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -29,9 +29,17 @@ ListView::ListView(const Columns &columns, HWND handle)
for(const Column &col : columns)
addColumn(col);
- // For some reason FULLROWSELECT doesn't work from the resource file
- ListView_SetExtendedListViewStyleEx(handle,
- LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
+ setExStyle(LVS_EX_FULLROWSELECT, true);
+
+#ifdef LVS_EX_LABELTIP
+ // unsupported by SWELL, but always enabled on OS X anyway
+ setExStyle(LVS_EX_LABELTIP, true);
+#endif
+}
+
+void ListView::setExStyle(const int style, const bool enable)
+{
+ ListView_SetExtendedListViewStyleEx(handle(), style, enable ? style : 0);
}
void ListView::addColumn(const Column &col)
@@ -77,6 +85,11 @@ void ListView::removeRow(const int index)
ListView_DeleteItem(handle(), index);
}
+void ListView::resizeColumn(const int index, const int width)
+{
+ ListView_SetColumnWidth(handle(), index, width);
+}
+
ListView::Row ListView::getRow(const int rowIndex) const
{
Row row(m_columnSize);
diff --git a/src/listview.hpp b/src/listview.hpp
@@ -40,6 +40,7 @@ public:
Row getRow(const int index) const;
void replaceRow(const int index, const Row &);
void removeRow(const int index);
+ void resizeColumn(const int index, const int width);
void clear();
bool hasSelection() const;
@@ -53,6 +54,7 @@ protected:
void onNotify(LPNMHDR, LPARAM) override;
private:
+ void setExStyle(int style, bool enable);
void addColumn(const Column &);
int m_columnSize;
diff --git a/src/manager.cpp b/src/manager.cpp
@@ -125,6 +125,10 @@ void Manager::refresh()
if(!m_uninstall.count(remote))
m_list->addRow(makeRow(remote));
}
+
+#ifdef LVSCW_AUTOSIZE_USEHEADER
+ m_list->resizeColumn(2, LVSCW_AUTOSIZE_USEHEADER);
+#endif
}
void Manager::setRemoteEnabled(const bool enabled)
diff --git a/src/resource.rc b/src/resource.rc
@@ -38,24 +38,24 @@ BEGIN
PUSHBUTTON "Cancel", IDCANCEL, 284, 160, 40, 14
END
-IDD_ABOUT_DIALOG DIALOGEX 0, 0, 440, 250
+IDD_ABOUT_DIALOG DIALOGEX 0, 0, 460, 270
STYLE DIALOG_STYLE
FONT DIALOG_FONT
BEGIN
- CONTROL "", IDC_TABS, WC_TABCONTROL, 0, 0, 2, 440, 223
+ CONTROL "", IDC_TABS, WC_TABCONTROL, 0, 0, 2, 460, 243
#ifdef _WIN32
CONTROL "", IDC_ABOUT, MSFTEDIT_CLASS, WS_VSCROLL | ES_MULTILINE |
- ES_READONLY | NOT WS_TABSTOP, 10, 20, 420, 200
+ ES_READONLY | NOT WS_TABSTOP, 10, 20, 440, 220
#else
- EDITTEXT IDC_ABOUT, 10, 20, 420, 200,
+ EDITTEXT IDC_ABOUT, 10, 20, 440, 220,
WS_VSCROLL | ES_MULTILINE | ES_READONLY | NOT WS_TABSTOP
#endif
CONTROL "", IDC_CATEGORIES, WC_LISTVIEW, LVS_REPORT | LVS_SINGLESEL |
- LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 20, 86, 200
+ LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 20, 96, 220
CONTROL "", IDC_PACKAGES, WC_LISTVIEW, LVS_REPORT | LVS_SINGLESEL |
- LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 100, 20, 330, 200
- PUSHBUTTON "Website", IDC_WEBSITE, 5, 230, 45, 14
- PUSHBUTTON "Donate...", IDC_DONATE, 54, 230, 45, 14
- PUSHBUTTON "Enable this repository!", IDC_ENABLE, 285, 230, 100, 14
- DEFPUSHBUTTON "Close", IDOK, 389, 230, 45, 14
+ LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 110, 20, 340, 220
+ PUSHBUTTON "Website", IDC_WEBSITE, 5, 250, 45, 14
+ PUSHBUTTON "Donate...", IDC_DONATE, 54, 250, 45, 14
+ PUSHBUTTON "Enable this repository!", IDC_ENABLE, 305, 250, 100, 14
+ DEFPUSHBUTTON "Close", IDOK, 409, 250, 45, 14
END
diff --git a/src/richedit.cpp b/src/richedit.cpp
@@ -40,6 +40,8 @@ RichEdit::RichEdit(HWND handle)
#ifdef _WIN32
SendMessage(handle, EM_AUTOURLDETECT, true, 0);
SendMessage(handle, EM_SETEVENTMASK, 0, ENM_LINK);
+ SendMessage(handle, EM_SETEDITSTYLE,
+ SES_HYPERLINKTOOLTIPS, SES_HYPERLINKTOOLTIPS);
#endif
}