2023-08-22 10:20:09 +00:00
|
|
|
/**
|
|
|
|
* action_banner.h
|
|
|
|
* =============================================================================
|
|
|
|
* Copyright 2021-2023 Serhii Snitsaruk
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
|
|
|
/* action_banner.h */
|
|
|
|
|
2024-01-11 10:22:02 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
|
2023-08-22 10:20:09 +00:00
|
|
|
#ifndef ACTION_BANNER_H
|
|
|
|
#define ACTION_BANNER_H
|
|
|
|
|
2024-01-07 12:36:59 +00:00
|
|
|
#ifdef LIMBOAI_MODULE
|
2023-08-22 10:20:09 +00:00
|
|
|
#include "scene/gui/box_container.h"
|
|
|
|
#include "scene/gui/label.h"
|
2024-01-07 12:36:59 +00:00
|
|
|
#include "scene/gui/margin_container.h"
|
2023-08-22 10:20:09 +00:00
|
|
|
#include "scene/gui/texture_rect.h"
|
2024-01-09 12:34:24 +00:00
|
|
|
#endif // ! LIMBOAI_MODULE
|
2024-01-07 12:36:59 +00:00
|
|
|
|
|
|
|
#ifdef LIMBOAI_GDEXTENSION
|
|
|
|
#include <godot_cpp/classes/h_box_container.hpp>
|
|
|
|
#include <godot_cpp/classes/label.hpp>
|
|
|
|
#include <godot_cpp/classes/margin_container.hpp>
|
|
|
|
#include <godot_cpp/classes/texture_rect.hpp>
|
|
|
|
|
|
|
|
using namespace godot;
|
2024-01-09 12:34:24 +00:00
|
|
|
#endif // ! LIMBOAI_GDEXTENSION
|
2023-08-22 10:20:09 +00:00
|
|
|
|
|
|
|
class ActionBanner : public MarginContainer {
|
|
|
|
GDCLASS(ActionBanner, MarginContainer);
|
|
|
|
|
|
|
|
private:
|
|
|
|
TextureRect *icon;
|
|
|
|
Label *message;
|
|
|
|
HBoxContainer *hbox;
|
|
|
|
|
|
|
|
void _execute_action(const Callable &p_action, bool p_auto_close);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void set_text(const String &p_text);
|
|
|
|
String get_text() const;
|
|
|
|
|
|
|
|
void add_action(const String &p_name, const Callable &p_action, bool p_auto_close = false);
|
|
|
|
|
|
|
|
void close();
|
|
|
|
|
|
|
|
ActionBanner();
|
|
|
|
};
|
|
|
|
|
2024-01-11 10:22:02 +00:00
|
|
|
#endif // ! ACTION_BANNER
|
|
|
|
|
|
|
|
#endif // ! TOOLS_ENABLED
|