aboutsummaryrefslogtreecommitdiff
path: root/editor/plugins/style_box_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-05 16:44:50 +0100
committerRémi Verschelde2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /editor/plugins/style_box_editor_plugin.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadgodot-5dbf180.tar.gz
godot-5dbf180.tar.zst
godot-5dbf180.zip
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'editor/plugins/style_box_editor_plugin.cpp')
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp44
1 files changed, 18 insertions, 26 deletions
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index 396ebd005..093f25e2b 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -28,16 +28,14 @@
/*************************************************************************/
#include "style_box_editor_plugin.h"
-
-void StyleBoxEditor::edit(const Ref<StyleBox>& p_stylebox) {
+void StyleBoxEditor::edit(const Ref<StyleBox> &p_stylebox) {
if (stylebox.is_valid())
- stylebox->disconnect("changed",this,"_sb_changed");
- stylebox=p_stylebox;
+ stylebox->disconnect("changed", this, "_sb_changed");
+ stylebox = p_stylebox;
if (p_stylebox.is_valid()) {
- preview->add_style_override("panel",stylebox);
- stylebox->connect("changed",this,"_sb_changed");
-
+ preview->add_style_override("panel", stylebox);
+ stylebox->connect("changed", this, "_sb_changed");
}
}
@@ -48,7 +46,7 @@ void StyleBoxEditor::_sb_changed() {
void StyleBoxEditor::_bind_methods() {
- ClassDB::bind_method("_sb_changed",&StyleBoxEditor::_sb_changed);
+ ClassDB::bind_method("_sb_changed", &StyleBoxEditor::_sb_changed);
//ClassDB::bind_method("_import",&StyleBoxEditor::_import);
//ClassDB::bind_method("_import_accept",&StyleBoxEditor::_import_accept);
//ClassDB::bind_method("_preview_text_changed",&StyleBoxEditor::_preview_text_changed);
@@ -56,39 +54,36 @@ void StyleBoxEditor::_bind_methods() {
StyleBoxEditor::StyleBoxEditor() {
- panel = memnew( Panel );
+ panel = memnew(Panel);
add_child(panel);
panel->set_area_as_parent_rect();
- Label *l = memnew( Label );
+ Label *l = memnew(Label);
l->set_text(TTR("StyleBox Preview:"));
- l->set_pos(Point2(5,5));
+ l->set_pos(Point2(5, 5));
panel->add_child(l);
-
- preview = memnew( Panel );
+ preview = memnew(Panel);
panel->add_child(preview);
- preview->set_pos(Point2(50,50));
- preview->set_size(Size2(200,100));
-
-
+ preview->set_pos(Point2(50, 50));
+ preview->set_size(Size2(200, 100));
}
void StyleBoxEditorPlugin::edit(Object *p_node) {
if (p_node && p_node->cast_to<StyleBox>()) {
- stylebox_editor->edit( p_node->cast_to<StyleBox>() );
+ stylebox_editor->edit(p_node->cast_to<StyleBox>());
stylebox_editor->show();
} else
stylebox_editor->hide();
}
-bool StyleBoxEditorPlugin::handles(Object *p_node) const{
+bool StyleBoxEditorPlugin::handles(Object *p_node) const {
return p_node->is_class("StyleBox");
}
-void StyleBoxEditorPlugin::make_visible(bool p_visible){
+void StyleBoxEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
@@ -103,13 +98,10 @@ void StyleBoxEditorPlugin::make_visible(bool p_visible){
StyleBoxEditorPlugin::StyleBoxEditorPlugin(EditorNode *p_node) {
- stylebox_editor = memnew( StyleBoxEditor );
- stylebox_editor->set_custom_minimum_size(Size2(0,250));
+ stylebox_editor = memnew(StyleBoxEditor);
+ stylebox_editor->set_custom_minimum_size(Size2(0, 250));
//p_node->get_viewport()->add_child(stylebox_editor);
- button = p_node->add_bottom_panel_item("StyleBox",stylebox_editor);
+ button = p_node->add_bottom_panel_item("StyleBox", stylebox_editor);
button->hide();
-
-
}
-