mirror of https://github.com/buggins/dlangui.git
fix styles
This commit is contained in:
parent
df1d104133
commit
27d2f64735
|
@ -54,7 +54,7 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
hlayout.addChild((new TextWidget()).text("in horizontal layout"));
|
hlayout.addChild((new TextWidget()).text("in horizontal layout"));
|
||||||
hlayout.addChild((new ImageWidget()).drawableId("exit").padding(Rect(5,5,5,5)).alignment(Align.Center));
|
hlayout.addChild((new ImageWidget()).drawableId("exit").padding(Rect(5,5,5,5)).alignment(Align.Center));
|
||||||
//hlayout.addChild((new Button()).text(">>")); //.textColor(0x40FF4000)
|
//hlayout.addChild((new Button()).text(">>")); //.textColor(0x40FF4000)
|
||||||
//hlayout.backgroundColor = 0x8080C0;
|
hlayout.backgroundColor = 0x8080C0;
|
||||||
layout.addChild(hlayout);
|
layout.addChild(hlayout);
|
||||||
|
|
||||||
LinearLayout vlayout = new VerticalLayout();
|
LinearLayout vlayout = new VerticalLayout();
|
||||||
|
|
|
@ -9,7 +9,10 @@ private import dlangui.graphics.gldrawbuf;
|
||||||
class Window {
|
class Window {
|
||||||
protected int _dx;
|
protected int _dx;
|
||||||
protected int _dy;
|
protected int _dy;
|
||||||
|
protected uint _backgroundColor;
|
||||||
protected Widget _mainWidget;
|
protected Widget _mainWidget;
|
||||||
|
@property uint backgroundColor() { return _backgroundColor; }
|
||||||
|
@property void backgroundColor(uint color) { _backgroundColor = color; }
|
||||||
@property int width() { return _dx; }
|
@property int width() { return _dx; }
|
||||||
@property int height() { return _dy; }
|
@property int height() { return _dy; }
|
||||||
@property Widget mainWidget() { return _mainWidget; }
|
@property Widget mainWidget() { return _mainWidget; }
|
||||||
|
@ -36,6 +39,10 @@ class Window {
|
||||||
|
|
||||||
long lastDrawTs;
|
long lastDrawTs;
|
||||||
|
|
||||||
|
this() {
|
||||||
|
_backgroundColor = 0xFFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
private void animate(Widget root, long interval) {
|
private void animate(Widget root, long interval) {
|
||||||
if (root.visibility != Visibility.Visible)
|
if (root.visibility != Visibility.Visible)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -218,7 +218,11 @@ class Win32Window : Window {
|
||||||
wglMakeCurrent(hdc, _hGLRC);
|
wglMakeCurrent(hdc, _hGLRC);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glViewport(0, 0, _dx, _dy);
|
glViewport(0, 0, _dx, _dy);
|
||||||
glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
|
float a = 1.0f;
|
||||||
|
float r = ((_backgroundColor >> 16) & 255) / 255.0f;
|
||||||
|
float g = ((_backgroundColor >> 8) & 255) / 255.0f;
|
||||||
|
float b = ((_backgroundColor >> 0) & 255) / 255.0f;
|
||||||
|
glClearColor(r, g, b, a);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
GLDrawBuf buf = new GLDrawBuf(_dx, _dy, false);
|
GLDrawBuf buf = new GLDrawBuf(_dx, _dy, false);
|
||||||
|
@ -296,7 +300,7 @@ class Win32Window : Window {
|
||||||
scope(exit) EndPaint(_hwnd, &ps);
|
scope(exit) EndPaint(_hwnd, &ps);
|
||||||
|
|
||||||
Win32ColorDrawBuf buf = getDrawBuf();
|
Win32ColorDrawBuf buf = getDrawBuf();
|
||||||
buf.fill(0x808080);
|
buf.fill(_backgroundColor);
|
||||||
onDraw(buf);
|
onDraw(buf);
|
||||||
buf.drawTo(hdc, 0, 0);
|
buf.drawTo(hdc, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -318,10 +322,8 @@ class Win32Window : Window {
|
||||||
protected ButtonDetails _mbutton;
|
protected ButtonDetails _mbutton;
|
||||||
protected ButtonDetails _rbutton;
|
protected ButtonDetails _rbutton;
|
||||||
|
|
||||||
|
private bool _mouseTracking;
|
||||||
|
private bool onMouse(uint message, uint flags, short x, short y) {
|
||||||
bool _mouseTracking;
|
|
||||||
bool onMouse(uint message, uint flags, short x, short y) {
|
|
||||||
Log.d("Win32 Mouse Message ", message, " flags=", flags, " x=", x, " y=", y);
|
Log.d("Win32 Mouse Message ", message, " flags=", flags, " x=", x, " y=", y);
|
||||||
MouseButton button = MouseButton.None;
|
MouseButton button = MouseButton.None;
|
||||||
MouseAction action = MouseAction.ButtonDown;
|
MouseAction action = MouseAction.ButtonDown;
|
||||||
|
@ -437,7 +439,7 @@ class Win32Platform : Platform {
|
||||||
wndclass.hInstance = _hInstance;
|
wndclass.hInstance = _hInstance;
|
||||||
wndclass.hIcon = LoadIcon(null, IDI_APPLICATION);
|
wndclass.hIcon = LoadIcon(null, IDI_APPLICATION);
|
||||||
wndclass.hCursor = LoadCursor(null, IDC_ARROW);
|
wndclass.hCursor = LoadCursor(null, IDC_ARROW);
|
||||||
wndclass.hbrBackground = null; //cast(HBRUSH)GetStockObject(WHITE_BRUSH);
|
wndclass.hbrBackground = cast(HBRUSH)GetStockObject(WHITE_BRUSH);
|
||||||
wndclass.lpszMenuName = null;
|
wndclass.lpszMenuName = null;
|
||||||
wndclass.lpszClassName = toUTF16z(WIN_CLASS_NAME);
|
wndclass.lpszClassName = toUTF16z(WIN_CLASS_NAME);
|
||||||
|
|
||||||
|
|
|
@ -433,7 +433,7 @@ class Theme : Style {
|
||||||
this(string id) {
|
this(string id) {
|
||||||
super(this, id);
|
super(this, id);
|
||||||
_parentStyle = null;
|
_parentStyle = null;
|
||||||
_backgroundColor = 0xE0E0E0; // light gray
|
_backgroundColor = 0xFFFFFFFF; // transparent
|
||||||
_textColor = 0x000000; // black
|
_textColor = 0x000000; // black
|
||||||
_align = Align.TopLeft;
|
_align = Align.TopLeft;
|
||||||
_fontSize = 24; // TODO: from settings or screen properties / DPI
|
_fontSize = 24; // TODO: from settings or screen properties / DPI
|
||||||
|
|
Loading…
Reference in New Issue