limboai/editor/action_banner.h

63 lines
1.5 KiB
C
Raw Normal View History

/**
* action_banner.h
* =============================================================================
2024-03-21 20:38:57 +00:00
* Copyright 2021-2024 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 */
#ifdef TOOLS_ENABLED
#ifndef ACTION_BANNER_H
#define ACTION_BANNER_H
2024-01-07 12:36:59 +00:00
#ifdef LIMBOAI_MODULE
#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"
#include "scene/gui/texture_rect.h"
2024-01-13 16:10:42 +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-13 16:10:42 +00:00
#endif // LIMBOAI_GDEXTENSION
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 add_spacer();
void close();
ActionBanner();
};
2024-01-13 16:10:42 +00:00
#endif // ACTION_BANNER_H
2024-01-13 16:10:42 +00:00
#endif // TOOLS_ENABLED