Add titlebar windows everywhere and make them selectable even in disappearing windows
This commit is contained in:
@@ -167,8 +167,13 @@ void Update(Event event) {
|
||||
Window *window = &Windows[it];
|
||||
{
|
||||
if (window->invisible_when_inactive) {
|
||||
if (IsActive(window)) SetVisibility(window, true);
|
||||
else SetVisibility(window, false);
|
||||
bool title_bar_is_active = ActiveWindow.id == window->title_bar_window.id;
|
||||
bool is_active = IsActive(window);
|
||||
if (is_active || title_bar_is_active) {
|
||||
SetVisibility(window, true);
|
||||
} else {
|
||||
SetVisibility(window, false);
|
||||
}
|
||||
}
|
||||
if (!window->visible) continue;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,9 @@ void InitWindows(View *null_view) {
|
||||
window->active_view = view->id;
|
||||
window->z = 2;
|
||||
SetActiveView(window, view->id);
|
||||
Window *titlebar = CreateInfobar(window);
|
||||
titlebar->z = 2;
|
||||
SetVisibility(window, false);
|
||||
DebugWindowID = window->id;
|
||||
}
|
||||
|
||||
@@ -214,6 +217,9 @@ void InitWindows(View *null_view) {
|
||||
b->no_history = true;
|
||||
View *v = CreateView(b->id);
|
||||
SetActiveView(w, v->id);
|
||||
Window *infobar = CreateInfobar(w);
|
||||
infobar->z = 2;
|
||||
SetVisibility(w, false);
|
||||
|
||||
PopupWindowID = w->id;
|
||||
}
|
||||
@@ -246,12 +252,14 @@ void LayoutWindows() {
|
||||
{
|
||||
Window *window = GetWindow(SearchWindowID);
|
||||
if (window->visible) {
|
||||
Rect2I rect = CutBottom(&screen_rect, FontLineSpacing);
|
||||
window->total_rect = rect;
|
||||
Rect2I rect = CutBottom(&screen_rect, FontLineSpacing);
|
||||
window->total_rect = rect;
|
||||
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
title_bar_window->total_rect = CutLeft(&window->total_rect, (Int)(FontCharSpacing * 14));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
window->document_rect = window->total_rect;
|
||||
|
||||
window->document_rect = window->total_rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,11 +281,9 @@ void LayoutWindows() {
|
||||
Window *window = ⁢
|
||||
if (!window->visible || window->absolute_position || window->is_title_bar) continue;
|
||||
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
if (title_bar_window) {
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
}
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
|
||||
window->document_rect = window->total_rect;
|
||||
if (window->draw_scrollbar) window->scrollbar_rect = CutRight(&window->document_rect, (Int)ScrollBarSize);
|
||||
@@ -293,7 +299,12 @@ void LayoutWindows() {
|
||||
Rect2 b = CutBottom(&a, 0.4f * size.y);
|
||||
Rect2 c = Shrink(b, 20);
|
||||
|
||||
window->total_rect = ToRect2I(c);
|
||||
window->total_rect = ToRect2I(c);
|
||||
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
|
||||
window->document_rect = window->total_rect;
|
||||
}
|
||||
|
||||
@@ -307,14 +318,13 @@ void LayoutWindows() {
|
||||
CutRight(&screen_rect, size.x * 0.2f);
|
||||
Rect2 r = CutTop(&screen_rect, FontLineSpacing * 30.f);
|
||||
|
||||
window->total_rect = ToRect2I(r);
|
||||
window->document_rect = window->total_rect;
|
||||
window->total_rect = ToRect2I(r);
|
||||
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
if (title_bar_window) {
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
}
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
|
||||
window->document_rect = window->total_rect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,7 +337,12 @@ void LayoutWindows() {
|
||||
Rect2 b = CutBottom(&a, 0.15f * size.y);
|
||||
Rect2 c = Shrink(b, 20);
|
||||
|
||||
window->total_rect = ToRect2I(c);
|
||||
window->total_rect = ToRect2I(c);
|
||||
|
||||
Window *title_bar_window = GetWindow(window->title_bar_window);
|
||||
title_bar_window->total_rect = CutBottom(&window->total_rect, GetTitleBarSize(title_bar_window));
|
||||
title_bar_window->document_rect = title_bar_window->total_rect;
|
||||
|
||||
window->document_rect = window->total_rect;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user