UIControls can be disabled, added blacklist to TextBox control

This commit is contained in:
Maruno17
2023-11-29 23:39:10 +00:00
parent 973b93a524
commit 5553218507
13 changed files with 116 additions and 69 deletions

View File

@@ -81,10 +81,16 @@ class UIControls::DropdownList < UIControls::BaseControl
def refresh
@dropdown_menu&.refresh
super
# Draw disabled colour
if disabled?
self.bitmap.fill_rect(@button_rect.x, @button_rect.y,
@button_rect.width, @button_rect.height,
DISABLED_COLOR)
end
# Draw button outline
self.bitmap.outline_rect(@button_rect.x, @button_rect.y,
@button_rect.width, @button_rect.height,
Color.black)
self.bitmap.font.color)
# Draw value
draw_text(self.bitmap, @button_rect.x + TEXT_BOX_PADDING, TEXT_OFFSET_Y, @options[@value] || "???")
# Draw down arrow
@@ -95,7 +101,7 @@ class UIControls::DropdownList < UIControls::BaseControl
6.times do |i|
self.bitmap.fill_rect(arrow_area_x + (arrow_area_width / 2) - 5 + i,
@button_rect.y + (arrow_area_width / 2) - 1 + i,
11 - (2 * i), 1, Color.black)
11 - (2 * i), 1, (disabled?) ? DISABLED_COLOR_DARK : self.bitmap.font.color)
end
end