bsnes/hiro/windows/widget/frame.cpp
Tim Allen 0b923489dd Update to 20160106 OS X Preview for Developers release.
byuu says:

New update. Most of the work today went into eliminating hiro::Image
from all objects in all ports, replacing with nall::image. That took an
eternity.

Changelog:
- fixed crashing bug when loading games [thanks endrift!!]
- toggling "show status bar" option adjusts window geometry (not
  supposed to recenter the window, though)
- button sizes improved; icon-only button icons no longer being cut off
2016-01-07 19:17:15 +11:00

61 lines
1.4 KiB
C++

#if defined(Hiro_Frame)
namespace hiro {
auto pFrame::construct() -> void {
hwnd = CreateWindow(L"BUTTON", L"",
WS_CHILD | BS_GROUPBOX,
0, 0, 0, 0, _parentHandle(), nullptr, GetModuleHandle(0), 0);
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&reference);
pWidget::_setState();
setText(state().text);
}
auto pFrame::destruct() -> void {
DestroyWindow(hwnd);
}
auto pFrame::append(sLayout layout) -> void {
}
auto pFrame::remove(sLayout layout) -> void {
}
auto pFrame::setEnabled(bool enabled) -> void {
if(auto layout = state().layout) layout->setEnabled(layout->enabled());
pWidget::setEnabled(enabled);
}
auto pFrame::setGeometry(Geometry geometry) -> void {
bool empty = !state().text;
auto size = pFont::size(hfont, state().text);
pWidget::setGeometry({
geometry.x(),
geometry.y() - (empty ? size.height() >> 1 : 0),
geometry.width(),
geometry.height() + (empty ? size.height() >> 1 : 0)
});
if(auto layout = state().layout) {
if(empty) size.setHeight(1);
layout->setGeometry({
geometry.x() + 1,
geometry.y() + size.height(),
geometry.width() - 2,
geometry.height() - (size.height() + 2)
});
}
}
auto pFrame::setText(const string& text) -> void {
SetWindowText(hwnd, utf16_t(text));
}
auto pFrame::setVisible(bool visible) -> void {
if(auto layout = state().layout) layout->setVisible(layout->visible());
pWidget::setVisible(visible);
}
}
#endif