Skip to content

Commit

Permalink
Remember collapsed state of object behaviors configuration panels (#5641
Browse files Browse the repository at this point in the history
)
  • Loading branch information
AlexandreSi authored Sep 7, 2023
1 parent 128657c commit 18211d1
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 175 deletions.
22 changes: 17 additions & 5 deletions Core/GDCore/Project/BehaviorConfigurationContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ namespace gd {
*/
class GD_CORE_API BehaviorConfigurationContainer {
public:

BehaviorConfigurationContainer(){};
BehaviorConfigurationContainer(const gd::String& name_, const gd::String& type_)
: name(name_), type(type_){};
BehaviorConfigurationContainer() : folded(false){};
BehaviorConfigurationContainer(const gd::String& name_,
const gd::String& type_)
: name(name_), type(type_), folded(false){};
virtual ~BehaviorConfigurationContainer();
virtual BehaviorConfigurationContainer* Clone() const { return new BehaviorConfigurationContainer(*this); }

Expand All @@ -61,7 +61,7 @@ class GD_CORE_API BehaviorConfigurationContainer {
/**
* \brief Called when the IDE wants to know about the custom properties of the
* behavior.
*
*
* \return a std::map with properties names as key.
* \see gd::PropertyDescriptor
*/
Expand Down Expand Up @@ -104,6 +104,17 @@ class GD_CORE_API BehaviorConfigurationContainer {
const gd::SerializerElement& GetContent() const { return content; };
gd::SerializerElement& GetContent() { return content; };

/**
* \brief Set if the behavior configuration panel should be folded in the UI.
*/
void SetFolded(bool fold = true) { folded = fold; }

/**
* \brief True if the behavior configuration panel should be folded in the UI.
*/
bool IsFolded() const { return folded; }


protected:
/**
* \brief Called when the IDE wants to know about the custom properties of the
Expand Down Expand Up @@ -148,6 +159,7 @@ class GD_CORE_API BehaviorConfigurationContainer {
///< in the form "ExtensionName::BehaviorTypeName"

gd::SerializerElement content; // Storage for the behavior properties
bool folded;
};

} // namespace gd
Expand Down
3 changes: 3 additions & 0 deletions GDevelop.js/Bindings/Bindings.idl
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ interface Behavior {
void SerializeTo([Ref] SerializerElement element);
void UnserializeFrom([Const, Ref] SerializerElement element);

boolean IsFolded();
void SetFolded(boolean folded);

boolean IsDefaultBehavior();
};

Expand Down
2 changes: 2 additions & 0 deletions GDevelop.js/types/gdbehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ declare class gdBehavior {
initializeContent(): void;
serializeTo(element: gdSerializerElement): void;
unserializeFrom(element: gdSerializerElement): void;
isFolded(): boolean;
setFolded(folded: boolean): void;
isDefaultBehavior(): boolean;
delete(): void;
ptr: number;
Expand Down
Loading

0 comments on commit 18211d1

Please sign in to comment.