Commit graph

65 commits

Author SHA1 Message Date
Charles Dang
db5abb7e63 GUI2/Text Box: refactored hint text interface
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.
2018-03-26 12:11:34 +11:00
Charles Dang
2b9c7b1abd GUI2/Canvas: allow formula values for [text] font_size= 2018-03-26 12:03:46 +11:00
Charles Dang
ec03dfcd08 Updated GUI2 schema for f4a1abdb9b 2018-02-14 14:48:30 +11:00
Charles Dang
7d647a6d3d Update GUI2 schema for 6bd9740 2018-02-14 09:18:31 +11:00
Jyrki Vesterinen
506ee85d2d Revert "GUI2: implemented fixed_width and fixed_height keys for all widgets"
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.
2017-11-15 19:04:47 +02:00
Charles Dang
556331ac3f GUI2: implemented fixed_width and fixed_height keys for all widgets
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.
2017-11-11 23:11:24 +11:00
Charles Dang
0b5ef105c9 GUI2: allowed window maximum_width/height keys to be validated as formulas
[ci skip]
2017-07-26 22:13:13 +11:00
Charles Dang
4f50559af9 GUI2 WML: consistent styling, don't use strings for bools 2017-04-16 17:19:03 +11:00
Celtic Minstrel
1793133a59 Fix menu_button widget trying to be two things at the same time.
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.
2017-04-16 00:08:50 -04:00
gfgtdf
75c21815f6 allow multi_page to contain differnt types of pages
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
2017-04-12 15:14:58 +02:00
Celtic Minstrel
898f9ea0c7 GUI2 Canvas: Add tile_center resize mode 2017-04-11 01:05:51 -04:00
Charles Dang
61aa601a6f GUI2/Canvas: converted other shapes to use formulas for their color handling
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.
2017-04-10 00:02:49 +11:00
Charles Dang
8ed11e7506 GUI2/Canvas: removed [line] alpha= key in favor of evaluating color as a formula 2017-04-09 22:04:11 +11:00
Charles Dang
10f867bd7e GUI2/Canvas: evaluate text color as formula 2017-04-09 21:37:15 +11:00
Celtic Minstrel
2dbdc7ec66 GUI2 Canvas: Enable drawing filled circles 2017-04-08 18:04:07 -04:00
Celtic Minstrel
76dcfcb32f GUI2 Canvas: Implement rounded rectangle shape
Currently it's outline only.
2017-04-08 08:30:00 -04:00
Charles Dang
c8ac77da42 GUI2/Canvas: implement WFL action context
Right now this is only for the image shape, but it can be expanded later.
2017-04-06 09:04:21 +11:00
Charles Dang
3648db32cf Updated GUI2 schema for 1a231c7 2017-03-24 20:28:33 +11:00
Charles Dang
adb5ef90ad Demote can_shrink key from global widget scope to label-only
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.
2017-03-17 06:21:13 +11:00
Charles Dang
22eebc6983 GUI2: allow labels to shrink to avoid scrollbars
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.
2017-02-25 07:52:00 +11:00
Jyrki Vesterinen
6f94a8ffed Allow composite widgets to inject linked groups 2017-01-28 17:59:36 +02:00
Jyrki Vesterinen
dc71d9d671 WIP: make the add-on list a widget
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.
2017-01-21 22:57:51 +02:00
Jyrki Vesterinen
8f40462116 Size lock widget, the WML part 2016-11-15 22:41:48 +02:00
Charles Dang
1964d71023 Updated GUI2 schema for fb6c85e70b 2016-10-18 00:59:22 +11:00
Ignacio R. Morelle
b3cf75196c gui2/canvas: Allow overriding color alpha in [line] with a formula
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.
2016-10-12 02:00:42 -03:00
Charles Dang
1f1855300d GUI2/Stacked Widget: removed [stack] wrapper around [layer] and use the latter directly
All dialog WML changes in this commit consist of removing [stack] tags and reducing subsequent subtag indent
by one layer.
2016-10-10 18:55:52 +11:00
Charles Dang
2dd8cfdbdc GUI2: added flag to enable markup from WML 2016-09-20 02:06:16 +11:00
Charles Dang
20831bf853 Updated schema for 4e21ae709e 2016-09-11 22:35:43 +11:00
Charles Dang
b07810608a Renamed the mp_chatbox widget simply "chatbox" 2016-09-09 08:25:04 +11:00
Charles Dang
765f0bfc6a Moved chatbox code to its own file and updates schema 2016-09-09 07:47:02 +11:00
Celtic Minstrel
d99bea9651 Allow [list_data] to be used for listbox toggle-panels 2016-08-29 01:05:02 -04:00
Celtic Minstrel
82153b1da8 Implement new grid_listbox widget 2016-08-29 01:05:02 -04:00
Celtic Minstrel
943c1bdd57 Support has_minimum/has_maximum in horizontal listboxes 2016-08-29 01:05:02 -04:00
Celtic Minstrel
4e6787639a GUI2 schema: fixup indentation 2016-08-23 18:50:55 -04:00
Celtic Minstrel
396f5dfc4c Rename combobox -> menu_button 2016-08-22 19:37:14 -04:00
Celtic Minstrel
f5acf47a19 Rename indention -> indentation 2016-08-20 02:52:11 -04:00
Charles Dang
245a7cc3d5 Updated schema for 119e095ccd 2016-08-18 17:33:28 +11:00
Charles Dang
156ac4cf93 Revert "timage: allowed use of width/height keys for specific image size"
This reverts commit 05340bb81f.
2016-08-15 14:30:49 +11:00
Charles Dang
05340bb81f timage: allowed use of width/height keys for specific image size 2016-08-15 00:02:48 +11:00
Charles Dang
6080cfb969 Switch unit_preview_pane image_facing key to image_mods 2016-08-01 08:14:19 +11:00
Charles Dang
639548a108 Made Attack dialog use a unit_preview_pane widget
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.
2016-08-01 02:17:03 +11:00
Celtic Minstrel
a6fbabead2 GUI2: Add wrap key to [scroll_label] 2016-03-24 17:49:04 -04:00
Charles Dang
0584118c7e Updated GUI2 schema for unit preview pane 2016-03-10 22:39:11 +11:00
gfgtdf
1efd5c750e Update schema.cfg 2016-03-07 23:16:28 +01:00
Charles Dang
fb0285c27f ttext_box: added support for defining a maximum input length 2016-03-01 02:05:15 +11:00
gfgtdf
4739413502 comboboxes for gui2
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.
2016-01-20 17:44:13 +01:00
Charles Dang
523d14d261 Fixed spelling of 'focused' in data 2015-12-04 18:56:05 +11:00
gfgtdf
1359e6a885 tristate buttons for gui2
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.
2015-08-07 13:00:49 +02:00
Ignacio R. Morelle
20602f12b9 gui2: Add support for selecting widget and canvas [text] font family
This instruct ttext to use a font family other than the default sans
serif.
2015-05-30 20:30:06 -03:00
Chris Beck
5f3dbe1d98 add link_color property of label defn, passed to font::ttext
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.
2014-10-18 21:02:28 -04:00