mirror of https://github.com/adamdruppe/arsd.git
tons of tab widget fixes
This commit is contained in:
parent
7e4938690a
commit
029a3df5fe
77
minigui.d
77
minigui.d
|
|
@ -1299,7 +1299,6 @@ class Widget : ReflectableProperties {
|
||||||
auto so = showing_;
|
auto so = showing_;
|
||||||
showing_ = s;
|
showing_ = s;
|
||||||
if(s != so) {
|
if(s != so) {
|
||||||
|
|
||||||
version(win32_widgets)
|
version(win32_widgets)
|
||||||
if(hwnd)
|
if(hwnd)
|
||||||
ShowWindow(hwnd, s ? SW_SHOW : SW_HIDE);
|
ShowWindow(hwnd, s ? SW_SHOW : SW_HIDE);
|
||||||
|
|
@ -1311,6 +1310,8 @@ class Widget : ReflectableProperties {
|
||||||
|
|
||||||
foreach(child; children)
|
foreach(child; children)
|
||||||
child.showing(s, false);
|
child.showing(s, false);
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Convenience method for `showing = true`
|
/// Convenience method for `showing = true`
|
||||||
|
|
@ -1354,6 +1355,16 @@ class Widget : ReflectableProperties {
|
||||||
this.emit!FocusInEvent();
|
this.emit!FocusInEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/+
|
||||||
|
/++
|
||||||
|
Unfocuses the widget. This may reset
|
||||||
|
+/
|
||||||
|
@scriptable
|
||||||
|
void blur() {
|
||||||
|
|
||||||
|
}
|
||||||
|
+/
|
||||||
|
|
||||||
|
|
||||||
/++
|
/++
|
||||||
This is called when the widget is added to a window. It gives you a chance to set up event hooks.
|
This is called when the widget is added to a window. It gives you a chance to set up event hooks.
|
||||||
|
|
@ -1522,12 +1533,22 @@ class Widget : ReflectableProperties {
|
||||||
if(hidden)
|
if(hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
painter.originX = lox + x;
|
int paintX = x;
|
||||||
painter.originY = loy + y;
|
int paintY = y;
|
||||||
|
if(this.useNativeDrawing()) {
|
||||||
|
paintX = 0;
|
||||||
|
paintY = 0;
|
||||||
|
lox = 0;
|
||||||
|
loy = 0;
|
||||||
|
containment = Rectangle(0, 0, int.max, int.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.originX = lox + paintX;
|
||||||
|
painter.originY = loy + paintY;
|
||||||
|
|
||||||
bool actuallyPainted = false;
|
bool actuallyPainted = false;
|
||||||
|
|
||||||
const clip = containment.intersectionOf(Rectangle(Point(lox + x, loy + y), Size(width, height)));
|
const clip = containment.intersectionOf(Rectangle(Point(lox + paintX, loy + paintY), Size(width, height)));
|
||||||
if(clip == Rectangle.init) {
|
if(clip == Rectangle.init) {
|
||||||
//import std.stdio; writeln(this, " clipped out");
|
//import std.stdio; writeln(this, " clipped out");
|
||||||
return;
|
return;
|
||||||
|
|
@ -3837,6 +3858,7 @@ class OpenGlWidget : NestedChildWindowWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
override void paint(WidgetPainter painter) {
|
override void paint(WidgetPainter painter) {
|
||||||
|
glViewport(0, 0, this.width, this.height);
|
||||||
win.redrawOpenGlSceneNow();
|
win.redrawOpenGlSceneNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4149,8 +4171,6 @@ class ScrollableWidget : Widget {
|
||||||
SetScrollInfo(hwnd, SB_HORZ, &info, true);
|
SetScrollInfo(hwnd, SB_HORZ, &info, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Scrolling
|
Scrolling
|
||||||
------------
|
------------
|
||||||
|
|
@ -4783,6 +4803,15 @@ private class InternalScrollableContainerWidget : Widget {
|
||||||
|
|
||||||
|
|
||||||
override void recomputeChildLayout() {
|
override void recomputeChildLayout() {
|
||||||
|
// The stupid thing needs to calculate if a scroll bar is needed...
|
||||||
|
recomputeChildLayoutHelper();
|
||||||
|
// then running it again will position things correctly if the bar is NOT needed
|
||||||
|
recomputeChildLayoutHelper();
|
||||||
|
|
||||||
|
// this sucks but meh it barely works
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recomputeChildLayoutHelper() {
|
||||||
if(sw is null) return;
|
if(sw is null) return;
|
||||||
|
|
||||||
bool both = sw.showingVerticalScroll && sw.showingHorizontalScroll;
|
bool both = sw.showingVerticalScroll && sw.showingHorizontalScroll;
|
||||||
|
|
@ -5960,6 +5989,7 @@ class TabWidget : Widget {
|
||||||
|
|
||||||
TabCtrl_AdjustRect(hwnd, false, &rect);
|
TabCtrl_AdjustRect(hwnd, false, &rect);
|
||||||
foreach(child; children) {
|
foreach(child; children) {
|
||||||
|
if(!child.showing) continue;
|
||||||
child.x = rect.left - left;
|
child.x = rect.left - left;
|
||||||
child.y = rect.top - top;
|
child.y = rect.top - top;
|
||||||
child.width = rect.right - rect.left;
|
child.width = rect.right - rect.left;
|
||||||
|
|
@ -5969,6 +5999,7 @@ class TabWidget : Widget {
|
||||||
} else version(custom_widgets) {
|
} else version(custom_widgets) {
|
||||||
this.registerMovement();
|
this.registerMovement();
|
||||||
foreach(child; children) {
|
foreach(child; children) {
|
||||||
|
if(!child.showing) continue;
|
||||||
child.x = 2;
|
child.x = 2;
|
||||||
child.y = tabBarHeight + 2; // for the border
|
child.y = tabBarHeight + 2; // for the border
|
||||||
child.width = width - 4; // for the border
|
child.width = width - 4; // for the border
|
||||||
|
|
@ -6067,18 +6098,25 @@ class TabWidget : Widget {
|
||||||
|
|
||||||
private void showOnly(int item) {
|
private void showOnly(int item) {
|
||||||
foreach(idx, child; children) {
|
foreach(idx, child; children) {
|
||||||
child.hide();
|
child.showing(false, false); // batch the recalculates for the end
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(idx, child; children) {
|
foreach(idx, child; children) {
|
||||||
if(idx == item) {
|
if(idx == item) {
|
||||||
child.show();
|
child.showing(true, false);
|
||||||
|
if(parentWindow) {
|
||||||
|
auto f = parentWindow.getFirstFocusable(child);
|
||||||
|
if(f)
|
||||||
|
f.focus();
|
||||||
|
}
|
||||||
recomputeChildLayout();
|
recomputeChildLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version(win32_widgets) {
|
version(win32_widgets) {
|
||||||
InvalidateRect(parentWindow.hwnd, null, true);
|
InvalidateRect(hwnd, null, true);
|
||||||
|
} else version(custom_widgets) {
|
||||||
|
this.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6282,6 +6320,27 @@ private wstring Win32Class(wstring name)() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/+
|
||||||
|
version(win32_widgets)
|
||||||
|
extern(Windows)
|
||||||
|
private
|
||||||
|
LRESULT CustomDrawWindowProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) nothrow {
|
||||||
|
switch(iMessage) {
|
||||||
|
case WM_PAINT:
|
||||||
|
if(auto te = hWnd in Widget.nativeMapping) {
|
||||||
|
try {
|
||||||
|
//te.redraw();
|
||||||
|
import std.stdio; writeln(te, " drawing");
|
||||||
|
} catch(Exception) {}
|
||||||
|
}
|
||||||
|
return DefWindowProc(hWnd, iMessage, wParam, lParam);
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, iMessage, wParam, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+/
|
||||||
|
|
||||||
|
|
||||||
/++
|
/++
|
||||||
A widget specifically designed to hold other widgets.
|
A widget specifically designed to hold other widgets.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue