Skip to content

layout.gadget, window.class: labels, sizing, geometry, WA_ tags - #1853

Open
terminills wants to merge 13 commits into
aros-development-team:masterfrom
terminills:reaction-3-layout-window
Open

terminills wants to merge 13 commits into
aros-development-team:masterfrom
terminills:reaction-3-layout-window

Conversation

@terminills

@terminills terminills commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Depends on #1851 and #1852 (their commits are included; review the last six).

  • layout: CHILD_Label drawn in a label column; gadget children redrawn after a nested group erases its area; the group frame no longer fills a recessed (IDS_SELECTED) group with FILLPEN
  • window.class opens at the layout's size when none is given; the program's WA_ tags and WA_IDCMP are passed to the window (window gadgets only by default when the program names none)
  • relative gadget geometry (GFLG_RELRIGHT/RELBOTTOM/RELWIDTH/RELHEIGHT) resolved when the classes render, via a shared helper

Built for pc-x86_64 and pc-i386; QEMU (x86_64): the ClassAct layout/page/glyph/listbrowser examples lay out and draw as on AmigaOS.

The class headers name Class but did not include intuition/classes.h, so
a program including only <proto/chooser.h> (or the stubs below) failed to
compile; every class cdef now includes it.

chooser, clicktab, layout, listbrowser, radiobutton and speedbar declare
the varargs forms of their tag-list functions - AllocListBrowserNode(),
SetChooserNodeAttrs(), AllocSpeedButtonNode() and the rest - as their
AmigaOS clib headers do; the stubs are in libreaction.a.
libreaction.a gains what reaction.lib offers programs on AmigaOS:
ChooserLabels(A), ClickTabs(A), RadioButtons(A), BrowserNodes(A) and their
Free* functions build and free label lists through the classes' own
allocators; LBAddNode(A), LBEditNode(A) and LBRemNode() wrap the
listbrowser methods. Prototypes in <clib/reaction_lib_protos.h>.

The varargs forms of the class tag-list functions (19, declared in the
class headers) are implemented here as well.

ClassAct 2's example sources compiled against these: 17 of 30 build,
from 6; the rest use SAS/C register syntax or ClassAct-only tags.
Forty-one files defined DEBUG 1 and logged every method call to the
debug output.
reaction_labels.c and reaction_varargs.c include the protos of chooser,
clicktab, layout, listbrowser, radiobutton and speedbar, which are
generated by those classes. In a fresh build tree the link library could
be compiled first and failed with proto/chooser.h missing.
Clicking the chooser cycled to the next entry like a cycle gadget. It now
opens its list under the gadget: the entry under the pointer is
highlighted, releasing on an entry picks it, a plain click on the gadget
leaves the list open for the next click, and a click elsewhere or the
menu button closes it. Separators and disabled entries are drawn and
cannot be picked.

CHOOSER_LabelArray builds the class's own label list from a
NULL-terminated string array (it was accepted and ignored), freed when
replaced or on dispose; an open list is closed on dispose.

ShowChooser() opens the list at a position in the window and
HideChooser() closes it, completing the chooser.gadget function table
(version 45.3).
The list's hit-test read the screen's mouse position, which is not kept
current while the gadget holds the input; it now uses the event's own
coordinates, relative to the gadget. Pressing on the chooser, dragging
to an entry and releasing picks it (QEMU: ClassAct's chooserexample,
1200 -> 2400).

GM_DOMAIN reports the chooser's size - widest label plus the arrow box,
one text line high - so layouts no longer have to guess it.
A raised frame like a button, the entry centred left of the glyph box,
and the double chevron of a pop-up chooser (the down arrow stays for
CHOOSER_DropDown). Pop-up is the default mode, as in ReAction; the class
defaulted to drop-down.

Compared with ClassAct 2's own screenshots (NewYork's display
preferences) in QEMU with ClassAct's chooser example.
CHILD_Label was stored and never placed or drawn. In a vertical group the
labels now share a column left of the children, right-aligned against
them and centred on each child's height; in a horizontal group each label
sits in front of its own child. Both count in the group's minimum size,
and a label is drawn disabled when its gadget is.
Without WA_Width/WA_Height the window opened at 400x300 and the layout
spread its children over the extra room; ReAction opens it at the
layout's minimum, which is what the programs are written for.
A gadget placed by the program with GA_RelRight/RelBottom/RelWidth/
RelHeight drew nothing: every class read LeftEdge/TopEdge/Width/Height
as absolute values. reaction_box.h resolves them against the gadget's
domain the way intuition does (gadgets.c GetGadgetLeft and friends), and
the render methods of button, checkbox, chooser, clicktab, fuelgauge,
getfile, getfont, getscreenmode, listbrowser, palette, slider, space,
speedbar and textfield use it.

QEMU: ClassAct's ListBrowserExample (relative width and height) shows its
three titled columns and rows; the window was empty.
A nested group erases its area on GM_RENDER, which can run after
intuition has drawn the gadgets in it (they are in the window's list),
leaving holes where those gadgets were. Draw them again after the erase.
The group fills its own area before drawing the frame, and bevel.image
fills a selected bevel with FILLPEN: a group recessed with
LAYOUT_BevelState IDS_SELECTED came out solid blue. The frame now only
draws its edges.
The window was opened with a fixed set of tags: the program's WA_IDCMP
(MOUSEBUTTONS, INTUITICKS...) never reached it, and every window got a
close, depth, size and drag gadget whatever was asked. The WA_ tags
listed by the window_cl autodoc are now kept and passed on after the
class's own, WA_IDCMP is added to the flags the class needs (and to an
open window with ModifyIDCMP), and the default gadgets are only added
when the program names none of them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant