mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-03 17:58:49 +00:00
This is a bundle of changes to the "new" GML documentation that I just noticed two hours ago. - Fix a bunch of typos, wording and style - Rework layout object documentation (they're not widgets!) - Document most of the common properties - Finish (as for now) GML syntax documentation - Extend GML usage explanation - Add symlink "GML" so that man gml works - Add a categorized GML page list to the introduction man page - Cross-link much more Much of the editing of existing docs is clearing up incorrect or imprecise statements. Note that because of massive changes in some places, git won't recognize renames as such.
1.1 KiB
1.1 KiB
Name
Library or Application Defined Widgets
Description
Some applications and libraries find it useful to define their own widgets.
This is done using REGISTER_WIDGET()
, just as in LibGUI. The syntax of the macro is as follows:
REGISTER_WIDGET(namespace, class_name)
This means that every registered widget has to be placed in a namespace. For applications that usually do not need their own namespace, a common approach is to use the application name as the namespace for these registered widgets.
Note that registered widgets need to be constructible without any arguments.
Examples
@Web::OutOfProcessWebView {
name: "web_view"
min_width: 340
min_height: 160
visible: false
}
// OutOfProcessWebView.cpp
REGISTER_WIDGET(Web, OutOfProcessWebView)
...
OutOfProcessWebView::OutOfProcessWebView()
{
set_should_hide_unnecessary_scrollbars(true);
set_focus_policy(GUI::FocusPolicy::StrongFocus);
create_client();
}
...