diff options
author | darkvater <darkvater@openttd.org> | 2004-12-15 23:33:04 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-12-15 23:33:04 +0000 |
commit | 83981e40b594af221abf78eab41aa41182003b52 (patch) | |
tree | 74df7f1875fe162b316df2d10c6bb505e11cea71 /window.c | |
parent | ec94450aef385beb279e5b158389767611112f40 (diff) | |
download | openttd-83981e40b594af221abf78eab41aa41182003b52.tar.xz |
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
-To use the feature add WDF_STICKY_BUTTON to the widget description and update all widget-ID's since sticky button will be widget 2.
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -61,6 +61,14 @@ void DispatchLeftClickEvent(Window *w, int x, int y) { } } } + + if (w->desc_flags & WDF_STICKY_BUTTON) { + if (e.click.widget == 2) { + w->click_state ^= (1 << e.click.widget); + w->flags4 ^= WF_STICKY; + InvalidateWidget(w, e.click.widget); + } + } } else { w->wndproc(w, &e); } @@ -296,7 +304,8 @@ restart:; assert(w < _last_window); if (w->window_class != WC_MAIN_WINDOW && w->window_class != WC_MAIN_TOOLBAR && - w->window_class != WC_STATUS_BAR && w->window_class != WC_NEWS_WINDOW) { + w->window_class != WC_STATUS_BAR && w->window_class != WC_NEWS_WINDOW && + !(w->flags4 & WF_STICKY) ) { DeleteWindow(w); goto restart; @@ -1324,7 +1333,8 @@ void DeleteNonVitalWindows() w->window_class != WC_MAIN_TOOLBAR && w->window_class != WC_STATUS_BAR && w->window_class != WC_TOOLBAR_MENU && - w->window_class != WC_TOOLTIPS) { + w->window_class != WC_TOOLTIPS && + (w->flags4 & WF_STICKY) == 0) { // do not delete windows which are 'pinned' DeleteWindow(w); w = _windows; } else { |