From a56249274870f240a8de3900aecb997d86942a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=28=C2=B4=E3=83=BB=CF=89=E3=83=BB=EF=BD=80=29?= Date: Tue, 4 May 2021 15:14:57 +0900 Subject: [PATCH] ADD: Sort order switching button --- gui/components/gui_button.cc | 23 +++++++++++++++++++++++ gui/components/gui_button.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/gui/components/gui_button.cc b/gui/components/gui_button.cc index ef6961c7d0..3fca91f642 100644 --- a/gui/components/gui_button.cc +++ b/gui/components/gui_button.cc @@ -125,6 +125,10 @@ void button_t::set_typ(enum type t) img = IMG_EMPTY; break; + case sortarrow: + set_size( scr_size(max(D_BUTTON_HEIGHT, LINESPACE), max(D_BUTTON_HEIGHT, LINESPACE)) ); + break; + default: break; } @@ -196,6 +200,9 @@ scr_size button_t::get_min_size() const return size; } + case sortarrow: + return scr_size( max(D_BUTTON_HEIGHT, LINESPACE), max(D_BUTTON_HEIGHT, LINESPACE) ); + default: return gui_component_t::get_min_size(); } @@ -381,6 +388,21 @@ void button_t::draw(scr_coord offset) } break; + case sortarrow: + { + display_img_stretch(gui_theme_t::button_tiles[0], area); + display_fillbox_wh_clip_rgb(area.x+size.w/2, area.y+2, 1, size.h-4, SYSCOL_BUTTON_TEXT, false); + if (pressed) { + display_fillbox_wh_clip_rgb(area.x+size.w/2-1, area.y+3, 3, 1, SYSCOL_BUTTON_TEXT, false); + display_fillbox_wh_clip_rgb(area.x+size.w/2-2, area.y+4, 5, 1, SYSCOL_BUTTON_TEXT, false); + } + else { + display_fillbox_wh_clip_rgb(area.x+size.w/2-1, area.y+size.h-4, 3, 1, SYSCOL_BUTTON_TEXT, false); + display_fillbox_wh_clip_rgb(area.x+size.w/2-2, area.y+size.h-5, 5, 1, SYSCOL_BUTTON_TEXT, false); + } + } + break; + case square: // checkbox with text { display_img_aligned( gui_theme_t::check_button_img[ get_state_offset() ], area, ALIGN_CENTER_V, true ); @@ -448,6 +470,7 @@ void button_t::update_focusability() // those cannot receive focus ... case imagebox: + case sortarrow: case arrowleft: case repeatarrowleft: case arrowright: diff --git a/gui/components/gui_button.h b/gui/components/gui_button.h index 573344e530..27d3ec74d3 100644 --- a/gui/components/gui_button.h +++ b/gui/components/gui_button.h @@ -41,6 +41,7 @@ class button_t : box, roundbox, imagebox, + sortarrow, arrowleft, arrowright, arrowup, @@ -55,6 +56,7 @@ class button_t : box_state = box | state, roundbox_state = roundbox | state, imagebox_state = imagebox | state, + sortarrow_state = sortarrow | state, arrowright_state = arrowright | state, arrowup_state = arrowup | state, arrowdown_state = arrowdown | state, @@ -62,6 +64,7 @@ class button_t : square_automatic = square_state | automatic, box_state_automatic = box_state | automatic, imagebox_automatic = imagebox | automatic, + sortarrow_automatic = sortarrow | automatic, posbutton_automatic = posbutton | automatic, flexible = 1 << 9