Previously, I had implemented the hint text ("Search)" and image (the magnifying glass)
as a custom text box definition. This caused some problems, though. Since the string was
hard-coded as part of a WFL formula, it couldn't be translated (see #2709 and #2732). It
also wasn't expandable to any other usecase.
Instead, I've added two new hint_text= and hint_image= keys to [text_box], wrapped the
"Search" text and magnifying image path in a helper macro, and refactored the default
definition to display the hint text and image when appropriate.
This also fixes a minor issue where selected text wouldn't remain highlighted when the
box wasn't focused when using the filter definition (it did with the default one).
This should fix the untranslatable "Search" text issue mentioned in both issues above.
The new string is in the wesnoth-lib textdomain.
This reverts commit 556331ac3f.
Since the keys aren't working, the implementation shouldn't be in the
Git repository. Otherwise some poor soul will attempt to use them and
face additional work afterwards.
This is meant to be a cleaner replacement to the [size_lock] widget. Both keys are optional,
in which case the layout engine will assume dynamic sizing for that dimension. Dynamic sizing
will also occur if either the fixed with or height evaluates to 0 or less.
The menu_button is now only a drop-down menu that supports a single selection.
A new multimenu_button widget supports a drop-down menu with multiple selections.
The new multimenu_button widget displays its current selection while not open.
although stacked_widget supports similar functionality this is currently
not easily doable from the lua gui2 api. In particular
1) stacked_widget cannot add pages dynamically
2) multi_page can only contain one type of widget.
3) a stacked_widget inside a multi_page is ineffective since it
generates many unused widgets
4) a multi_page inside a stacked_widget is just unhandy to use
For rectangles, color_t::null_color() needs to be specified as the default since typed_formula
utilizes the default type ctor if no default value is provided. In this case, color_t's default
ctor returns opaque white, which doesn't mesh well with GUI2's drawing.
Other shapes don't get this default value, since color is essentially mandatory for them, whereas
in rectangles either fill_color or border_color may be omitted.
It was causing problems being enabled for all labels (ie, some labels being shrunken when it wasn't desirable),
and it didn't make much sense for all widgets anyway.
This adds a new can_shrink key to widgets that allows the 'no label' codepath of styled_widget::request_reduce_width to be called.
In this case, it allows labels to shrink without forcing window scrollbars.
The purpose of this change is ability to create more dialogs which present
a list of add-ons, such as a GUI2 version of the "Install Dependencies"
dialog.
This change is still highly incomplete. First of all, I disabled inline
install buttons and ability to sort the add-on list. In addition, a lot of
functionality that belongs in the add-on list widget is still in the GUI2
add-on manager instead. It is also notable that the widget relies on
several linked groups being defined in the window.
I plan to finish the transition to the add-on list widget, and address the
problems in the previous paragraph, in the future. The linked group issue
is going to require a lot of work in particular: I plan to either make
linked groups grid-specific instead of window-specific (like they are now)
or allow widgets to inject linked groups to the containing window. Either
way, I'm going to change the operation of GUI2 fairly deeply.
The color attribute specifically doesn't support formulas. Adding
support for formulas to it would present us with the issue that commas
are already part of the formula language, so we'd need to update all
existing instances accordingly. So, instead, there's this short hack
used for a very particular piece of functionality coming in the next
commit.
This also adds the necessary changes to said widget to allow single-unit stats display.
It still needs to be expanded somewhat. Right now it contains the minimum required for
the attack dialog.
This adds a new combobox widget to gui2. Like the gui1 combobox widget
this is more or less only a button that prompts a list dialog below the
button when you click on it.
This commit adds the c++ code to add tristate buttons: toggle_buttons and
toggle_panels can now have an arbitrary number of states instead of just 2
(selected and not selected). The number of states is determined by the number
of [state] tags in the widgets definition.
This doesn't add tristate definitions yet, but the plan is to use tristate
buttons later for the headers of sortable lists (No-Sort, Sort-Up, Sort-Down
buttons)
TODO: figure out whether to remove the parameter from tcontrols constructor.
This commit permits link_color to be specified in any label defn,
at the same place that link_aware is specified. It will be passed
through to tcanvas and finally font::ttext in a similar manner as
link awareness, and used for the color parameter in any link
formatting. We choose a default value of #ffff00 everywhere,
matching the definition currently in the help browser for cross-
references.