Update to v095r01 release (open beta).

byuu says:

Changelog:
- added MSU1 resume support
- updated sfc/dsp, sfc/controller to match my coding style
- fixed hiro/Windows Button and ListView::CheckButton in Windows Classic
  mode
This commit is contained in:
Tim Allen
2015-10-10 13:16:12 +11:00
parent b0e862613b
commit 8476a12deb
35 changed files with 1013 additions and 991 deletions

View File

@@ -5,7 +5,7 @@ static const unsigned WindowsXP = 0x0501;
static const unsigned WindowsVista = 0x0600;
static const unsigned Windows7 = 0x0601;
static auto Button_CustomDraw(HWND, PAINTSTRUCT&, unsigned, const Font&, const Image&, Orientation, const string&) -> void;
static auto Button_CustomDraw(HWND, PAINTSTRUCT&, bool, bool, bool, unsigned, const Font&, const Image&, Orientation, const string&) -> void;
static auto OsVersion() -> unsigned {
OSVERSIONINFO versionInfo{0};

View File

@@ -9,12 +9,7 @@ static auto Button_paintProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
PAINTSTRUCT ps;
BeginPaint(hwnd, &ps);
auto state = Button_GetState(hwnd);
Button_CustomDraw(hwnd, ps,
(state & BST_PUSHED || checked) ? PBS_PRESSED
: (state & BST_HOT) ? PBS_HOT
: bordered ? (enabled ? PBS_NORMAL : PBS_DISABLED)
: 0, font, image, orientation, text
);
Button_CustomDraw(hwnd, ps, bordered, checked, enabled, state, font, image, orientation, text);
EndPaint(hwnd, &ps);
}
return DefWindowProc(hwnd, msg, wparam, lparam);
@@ -113,7 +108,7 @@ auto pButton::_setState() -> void {
}
//this function is designed to be used with Button, CheckButton, and RadioButton
auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, unsigned state, const Font& font, const Image& image, Orientation orientation, const string& text) -> void {
auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, bool bordered, bool checked, bool enabled, unsigned state, const Font& font, const Image& image, Orientation orientation, const string& text) -> void {
RECT rc;
GetClientRect(hwnd, &rc);
Geometry geometry{rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top}, imageGeometry, textGeometry;
@@ -138,23 +133,29 @@ auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, unsigned state, const Font& f
break;
}
HDC hdcSource = CreateCompatibleDC(ps.hdc);
DrawThemeParentBackground(hwnd, ps.hdc, &rc);
if(state) {
if(auto theme = OpenThemeData(hwnd, L"BUTTON")) {
DrawThemeBackground(theme, ps.hdc, BP_PUSHBUTTON, state, &rc, &ps.rcPaint);
CloseThemeData(theme);
}
if(auto theme = OpenThemeData(hwnd, L"BUTTON")) {
DrawThemeParentBackground(hwnd, ps.hdc, &rc);
unsigned flags = 0;
if(state & BST_PUSHED || checked) flags = PBS_PRESSED;
else if(state & BST_HOT) flags = PBS_HOT;
else if(bordered) flags = enabled ? PBS_NORMAL : PBS_DISABLED;
if(bordered || flags) DrawThemeBackground(theme, ps.hdc, BP_PUSHBUTTON, flags, &rc, &ps.rcPaint);
CloseThemeData(theme);
} else {
//Windows Classic
FillRect(ps.hdc, &rc, GetSysColorBrush(COLOR_3DFACE));
unsigned flags = (state & BST_PUSHED || checked) ? DFCS_PUSHED : 0;
if(bordered || flags) DrawFrameControl(ps.hdc, &rc, DFC_BUTTON, DFCS_BUTTONPUSH | flags | (enabled ? 0 : DFCS_INACTIVE));
}
if(GetFocus() == hwnd) {
signed offset = state ? 4 : 1;
RECT rcFocus{rc.left + offset, rc.top + offset, rc.right - offset, rc.bottom - offset};
if(!state || state == PBS_NORMAL) DrawFocusRect(ps.hdc, &rcFocus);
if(!(state & BST_PUSHED) && !(state & BST_HOT)) DrawFocusRect(ps.hdc, &rcFocus);
}
if(image) {
HDC hdcSource = CreateCompatibleDC(ps.hdc);
auto bitmap = CreateBitmap(image);
SelectBitmap(hdcSource, bitmap);
BLENDFUNCTION blend{AC_SRC_OVER, 0, (BYTE)(IsWindowEnabled(hwnd) ? 255 : 128), AC_SRC_ALPHA};
@@ -163,6 +164,7 @@ auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, unsigned state, const Font& f
hdcSource, 0, 0, image.width(), image.height(), blend
);
DeleteObject(bitmap);
DeleteDC(hdcSource);
}
if(text) {
@@ -175,8 +177,6 @@ auto Button_CustomDraw(HWND hwnd, PAINTSTRUCT& ps, unsigned state, const Font& f
DrawText(ps.hdc, wText, -1, &rcText, DT_NOPREFIX | DT_END_ELLIPSIS);
DeleteObject(hFont);
}
DeleteDC(hdcSource);
}
}

View File

@@ -131,12 +131,6 @@ auto pListView::setGeometry(Geometry geometry) -> void {
}
}
/*auto pListView::setHeaderVisible(bool visible) -> void {
auto style = GetWindowLong(hwnd, GWL_STYLE);
!visible ? style |= LVS_NOCOLUMNHEADER : style &=~ LVS_NOCOLUMNHEADER;
SetWindowLong(hwnd, GWL_STYLE, style);
}*/
auto pListView::onActivate(LPARAM lparam) -> void {
auto nmlistview = (LPNMLISTVIEW)lparam;
if(ListView_GetSelectedCount(hwnd) == 0) return;
@@ -213,6 +207,11 @@ auto pListView::onCustomDraw(LPARAM lparam) -> LRESULT {
RECT rd{rc.left + center, rc.top + center, rc.left + center + size.cx, rc.top + center + size.cy};
DrawThemeBackground(htheme, hdc, BP_CHECKBOX, state, &rd, nullptr);
CloseThemeData(htheme);
} else {
//Windows Classic
rc.left += 2;
RECT rd{rc.left, rc.top, rc.left + iconSize, rc.top + iconSize};
DrawFrameControl(hdc, &rd, DFC_BUTTON, DFCS_BUTTONCHECK | (cell->state.checked ? DFCS_CHECKED : 0));
}
rc.left += iconSize + 2;
} else {