diff options
author | belugas <belugas@openttd.org> | 2006-10-03 20:16:20 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2006-10-03 20:16:20 +0000 |
commit | 17eb65050b29b84e1a5b452d302c1a40931764cb (patch) | |
tree | 22b881cad1fc846e1fe14182d37c8f6e6261f820 /misc_gui.c | |
parent | bdaab39e648891f3e86a290ade9b02fe4d215f45 (diff) | |
download | openttd-17eb65050b29b84e1a5b452d302c1a40931764cb.tar.xz |
(svn r6631) -Codechange: Use accessors for click_state.
Another step toward merging XTDwidget.
The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'misc_gui.c')
-rw-r--r-- | misc_gui.c | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/misc_gui.c b/misc_gui.c index 10f53f701..047866eab 100644 --- a/misc_gui.c +++ b/misc_gui.c @@ -355,7 +355,7 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) break; case 16: /* place trees randomly over the landscape*/ - w->click_state |= 1 << 16; + LowerWindowWidget(w, 16); w->flags4 |= 5 << WF_TIMEOUT_SHL; SndPlayFx(SND_15_BEEP); PlaceTreesRandomly(); @@ -381,12 +381,11 @@ static void BuildTreesWndProc(Window *w, WindowEvent *e) break; case WE_TIMEOUT: - UnclickSomeWindowButtons(w, 1<<16); + RaiseWindowWidget(w, 16); break; case WE_ABORT_PLACE_OBJ: - w->click_state = 0; - SetWindowDirty(w); + RaiseWindowButtons(w); break; } } @@ -734,25 +733,6 @@ void CheckRedrawStationCoverage(const Window *w) } } - -void UnclickSomeWindowButtons(Window *w, uint32 mask) -{ - uint32 x = w->click_state & mask; - uint i = 0; - - w->click_state ^= x; - do { - if (x & 1) InvalidateWidget(w, i); - } while (i++, x >>= 1); -} - - -void UnclickWindowButtons(Window *w) -{ - UnclickSomeWindowButtons(w, (uint32)-1); -} - - void SetVScrollCount(Window *w, int num) { w->vscroll.count = num; @@ -1086,7 +1066,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WP(w, querystr_d).orig = _orig_str_buf; } - w->click_state = 1 << 5; + LowerWindowWidget(w, 5); WP(w, querystr_d).caption = caption; WP(w, querystr_d).wnd_class = window_class; WP(w, querystr_d).wnd_num = window_number; @@ -1154,7 +1134,7 @@ void ShowQuery(StringID caption, StringID message, void (*ok_cancel_callback)(bo w = AllocateWindowDesc(&_query_desc); - w->click_state = 1 << 5; + LowerWindowWidget(w, 5); WP(w, query_d).caption = caption; WP(w, query_d).message = message; WP(w, query_d).wnd_class = window_class; @@ -1460,7 +1440,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) } break; case WE_TIMEOUT: - if (HASBIT(w->click_state, 11)) { /* Delete button clicked */ + if (IsWindowWidgetLowered(w, 11)) { /* Delete button clicked */ if (!FiosDelete(OTTD2FS(WP(w,querystr_d).text.buf))) { ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0); } else { @@ -1471,7 +1451,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) UpdateTextBufferSize(&WP(w, querystr_d).text); SetWindowDirty(w); - } else if (HASBIT(w->click_state, 12)) { /* Save button clicked */ + } else if (IsWindowWidgetLowered(w, 12)) { /* Save button clicked */ _switch_mode = SM_SAVE; FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name)); @@ -1575,7 +1555,7 @@ void ShowSaveLoadDialog(int mode) w->resize.step_width = 2; w->resize.step_height = 10; w->resize.height = w->height - 14 * 10; // Minimum of 10 items - SETBIT(w->click_state, 7); + LowerWindowWidget(w, 7); WP(w,querystr_d).text.caret = false; WP(w,querystr_d).text.maxlength = lengthof(_edit_str_buf); WP(w,querystr_d).text.maxwidth = 240; |