mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
Base: Move GML documentation into subsection
That was the whole point of this endeavour :^)
This commit is contained in:
parent
f824a67b3b
commit
ad6cbc4192
54 changed files with 89 additions and 92 deletions
|
@ -1,50 +0,0 @@
|
|||
## 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:
|
||||
|
||||
```cpp
|
||||
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
|
||||
|
||||
```gml
|
||||
@Web::OutOfProcessWebView {
|
||||
name: "web_view"
|
||||
min_width: 340
|
||||
min_height: 160
|
||||
visible: false
|
||||
}
|
||||
```
|
||||
|
||||
```cpp
|
||||
// OutOfProcessWebView.cpp
|
||||
|
||||
REGISTER_WIDGET(Web, OutOfProcessWebView)
|
||||
|
||||
...
|
||||
|
||||
OutOfProcessWebView::OutOfProcessWebView()
|
||||
{
|
||||
set_should_hide_unnecessary_scrollbars(true);
|
||||
set_focus_policy(GUI::FocusPolicy::StrongFocus);
|
||||
|
||||
create_client();
|
||||
}
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [GML Define property(5)](help://man/5/GML-Define-property)
|
Loading…
Add table
Add a link
Reference in a new issue