1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include "stdafx.h"
#include "Separator.h"
#include "Container.h"
namespace gui {
HSeparator::HSeparator() {}
HSeparator::HSeparator(Point pos, Float width) {
this->pos(Rect(pos, Size(width)));
}
#ifdef GUI_WIN32
void HSeparator::pos(Rect pos) {
// + 2 is from what Explorer uses. We do DPI scaling after this, so it should be fine.
Window::pos(Rect(pos.p0.x, pos.p0.y, pos.p1.x, pos.p0.y + 2));
}
bool HSeparator::create(ContainerBase *parent, nat id) {
return createEx(WC_STATIC, childFlags | SS_ETCHEDHORZ, 0, parent->handle().hwnd(), id);
}
#endif
#ifdef GUI_GTK
void HSeparator::pos(Rect pos) {
Window::pos(pos);
}
bool HSeparator::create(ContainerBase *parent, nat id) {
initWidget(parent, gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
return false;
}
#endif
VSeparator::VSeparator() {}
VSeparator::VSeparator(Point pos, Float width) {
this->pos(Rect(pos, Size(width)));
}
#ifdef GUI_WIN32
void VSeparator::pos(Rect pos) {
// + 2 is from what Explorer uses. We do DPI scaling after this, so it should be fine.
Window::pos(Rect(pos.p0.x, pos.p0.y, pos.p1.x + 2, pos.p1.y));
}
bool VSeparator::create(ContainerBase *parent, nat id) {
return createEx(WC_STATIC, childFlags | SS_ETCHEDVERT, 0, parent->handle().hwnd(), id);
}
#endif
#ifdef GUI_GTK
void VSeparator::pos(Rect pos) {
Window::pos(pos);
}
bool VSeparator::create(ContainerBase *parent, nat id) {
initWidget(parent, gtk_separator_new(GTK_ORIENTATION_VERTICAL));
return true;
}
#endif
}
|