2023-12-07 15:53:49 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
#include <LibIPC/Forward.h>
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2024-04-03 19:19:08 +02:00
|
|
|
#include <LibWeb/HTML/HTMLOptionElement.h>
|
2023-12-07 15:53:49 +01:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2024-04-03 19:19:08 +02:00
|
|
|
struct SelectItemOption {
|
|
|
|
u32 id { 0 };
|
|
|
|
bool selected { false };
|
2024-04-03 19:20:15 +02:00
|
|
|
bool disabled { false };
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<HTMLOptionElement> option_element {};
|
2024-11-11 14:22:44 +04:00
|
|
|
String label {};
|
|
|
|
String value {};
|
2023-12-07 15:53:49 +01:00
|
|
|
};
|
|
|
|
|
2024-04-03 19:19:08 +02:00
|
|
|
struct SelectItemOptionGroup {
|
|
|
|
String label = {};
|
|
|
|
Vector<SelectItemOption> items = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SelectItemSeparator { };
|
|
|
|
|
|
|
|
using SelectItem = Variant<SelectItemOption, SelectItemOptionGroup, SelectItemSeparator>;
|
|
|
|
|
2023-12-07 15:53:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemOption const&);
|
2024-04-03 19:19:08 +02:00
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<Web::HTML::SelectItemOption> decode(Decoder&);
|
2024-04-03 19:19:08 +02:00
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemOptionGroup const&);
|
2024-04-03 19:19:08 +02:00
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<Web::HTML::SelectItemOptionGroup> decode(Decoder&);
|
2024-04-03 19:19:08 +02:00
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SelectItemSeparator const&);
|
2023-12-07 15:53:49 +01:00
|
|
|
|
|
|
|
template<>
|
2025-07-19 19:35:33 -07:00
|
|
|
WEB_API ErrorOr<Web::HTML::SelectItemSeparator> decode(Decoder&);
|
2023-12-07 15:53:49 +01:00
|
|
|
|
|
|
|
}
|