mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:45:08 +00:00
LibGUI: Implement save_to(JsonObject&) for GWindow and GWidget
This commit is contained in:
parent
c2213449c0
commit
3792c91059
4 changed files with 45 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "GEventLoop.h"
|
||||
#include "GWindow.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GLayout.h>
|
||||
|
@ -585,3 +586,18 @@ void GWidget::set_forecolor(const StringView& color_string)
|
|||
return;
|
||||
set_foreground_color(color.value());
|
||||
}
|
||||
|
||||
void GWidget::save_to(AK::JsonObject& json)
|
||||
{
|
||||
json.set("relative_rect", relative_rect().to_string());
|
||||
json.set("fill_with_background_color", fill_with_background_color());
|
||||
json.set("tooltip", tooltip());
|
||||
json.set("visible", is_visible());
|
||||
json.set("focused", is_focused());
|
||||
json.set("enabled", is_enabled());
|
||||
json.set("background_color", background_color().to_string());
|
||||
json.set("foreground_color", foreground_color().to_string());
|
||||
json.set("preferred_size", preferred_size().to_string());
|
||||
json.set("size_policy", String::format("[%s,%s]", to_string(horizontal_size_policy()), to_string(vertical_size_policy())));
|
||||
CObject::save_to(json);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue