diff --git a/main.cpp b/main.cpp index 563e2e5..9e484b9 100644 --- a/main.cpp +++ b/main.cpp @@ -305,6 +305,7 @@ extern "C" gtkwidget.method<&GtkWidget_::set_margin_bottom>("set_margin_bottom"); gtkwidget.method<&GtkWidget_::get_margin_bottom>("get_margin_bottom"); gtkwidget.method<&GtkWidget_::set_size_request>("set_size_request"); + gtkwidget.method<&GtkWidget_::get_size_request>("get_size_request"); // GtkContainer @@ -433,6 +434,7 @@ extern "C" gtkwindow.method<&GtkWindow_::set_titlebar>("set_titlebar"); gtkwindow.method<&GtkWindow_::get_titlebar>("get_titlebar"); gtkwindow.method<&GtkWindow_::set_interactive_debugging>("set_interactive_debugging"); + gtkwindow.method<&GtkWindow_::get_size>("get_size"); // GtkDialog @@ -587,6 +589,12 @@ extern "C" gtktreeview.method<&GtkTreeView_::set_model>("set_model"); gtktreeview.method<&GtkTreeView_::get_selection>("get_selection"); gtktreeview.method<&GtkTreeView_::get_model>("get_model"); + gtktreeview.method<&GtkTreeView_::expand_row>("expand_row"); + gtktreeview.method<&GtkTreeView_::set_level_indentation>("set_level_indentation"); + gtktreeview.method<&GtkTreeView_::set_show_expanders>("set_show_expanders"); + gtktreeview.method<&GtkTreeView_::set_enable_tree_lines>("set_enable_tree_lines"); + gtktreeview.method<&GtkTreeView_::row_expanded>("row_expanded"); + gtktreeview.method<&GtkTreeView_::collapse_row>("collapse_row"); // GtkTreeViewColumn diff --git a/src/GtkTreeView.cpp b/src/GtkTreeView.cpp index d1a614d..942bfc5 100644 --- a/src/GtkTreeView.cpp +++ b/src/GtkTreeView.cpp @@ -78,4 +78,65 @@ Php::Value GtkTreeView_::get_selection() GtkTreeSelection_ *return_parsed = new GtkTreeSelection_(); return_parsed->set_instance((gpointer *)ret); return Php::Object("GtkTreeSelection", return_parsed); -} \ No newline at end of file +} + + +Php::Value GtkTreeView_::expand_row(Php::Parameters ¶meters) +{ + std::string param_path = parameters[0]; + GtkTreePath *path = gtk_tree_path_new_from_string(param_path.c_str()); + + bool open_all = false; + if(parameters.size() > 1) { + open_all = (bool)parameters[1]; + } + + // + bool ret = gtk_tree_view_expand_row(GTK_TREE_VIEW(instance), path, open_all); + + return ret; +} + +Php::Value GtkTreeView_::row_expanded(Php::Parameters ¶meters) +{ + std::string param_path = parameters[0]; + GtkTreePath *path = gtk_tree_path_new_from_string(param_path.c_str()); + + // + bool ret = gtk_tree_view_row_expanded(GTK_TREE_VIEW(instance), path); + + return ret; +} + +Php::Value GtkTreeView_::collapse_row(Php::Parameters ¶meters) +{ + std::string param_path = parameters[0]; + GtkTreePath *path = gtk_tree_path_new_from_string(param_path.c_str()); + + // + bool ret = gtk_tree_view_collapse_row(GTK_TREE_VIEW(instance), path); + + return ret; +} + + +void GtkTreeView_::set_level_indentation(Php::Parameters ¶meters) +{ + gint indentation = (int)parameters[0]; + + gtk_tree_view_set_level_indentation(GTK_TREE_VIEW(instance), indentation); +} + +void GtkTreeView_::set_show_expanders(Php::Parameters ¶meters) +{ + bool enabled = (bool)parameters[0]; + + gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(instance), enabled); +} + +void GtkTreeView_::set_enable_tree_lines(Php::Parameters ¶meters) +{ + bool enabled = (bool)parameters[0]; + + gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(instance), enabled); +} diff --git a/src/GtkTreeView.h b/src/GtkTreeView.h index 7a3717a..574d4cb 100644 --- a/src/GtkTreeView.h +++ b/src/GtkTreeView.h @@ -49,6 +49,14 @@ Php::Value get_model(); Php::Value get_selection(); + + Php::Value expand_row(Php::Parameters ¶meters); + void set_level_indentation(Php::Parameters ¶meters); + void set_show_expanders(Php::Parameters ¶meters); + void set_enable_tree_lines(Php::Parameters ¶meters); + + Php::Value row_expanded(Php::Parameters ¶meters); + Php::Value collapse_row(Php::Parameters ¶meters); }; #endif \ No newline at end of file diff --git a/src/GtkWidget.cpp b/src/GtkWidget.cpp index 685206a..c12ab5f 100644 --- a/src/GtkWidget.cpp +++ b/src/GtkWidget.cpp @@ -527,4 +527,23 @@ void GtkWidget_::set_size_request(Php::Parameters ¶meters) // Set default size gtk_widget_set_size_request(GTK_WIDGET(instance), width, height); +} + +Php::Value GtkWidget_::get_size_request(Php::Parameters ¶meters) +{ + // Verify sizes + int width = -1; + int height = -1; + + // Set default size + gtk_widget_get_size_request(GTK_WIDGET(instance), &width, &height); + + // Cria o retorno + Php::Value arr; + arr["width"] = width; + arr["height"] = height; + arr[0] = width; + arr[1] = height; + + return arr; } \ No newline at end of file diff --git a/src/GtkWidget.h b/src/GtkWidget.h index 905956f..e8bd742 100644 --- a/src/GtkWidget.h +++ b/src/GtkWidget.h @@ -401,6 +401,7 @@ Php::Value get_margin_bottom(); void set_size_request(Php::Parameters ¶meters); + Php::Value get_size_request(Php::Parameters ¶meters); }; #endif \ No newline at end of file diff --git a/src/GtkWindow.cpp b/src/GtkWindow.cpp index 0dee0c4..89669d3 100644 --- a/src/GtkWindow.cpp +++ b/src/GtkWindow.cpp @@ -75,6 +75,23 @@ Php::Value GtkWindow_::get_default_size() return arr; } +Php::Value GtkWindow_::get_size() +{ + // Verify sizes + int width = -1; + int height = -1; + + // Set default size + gtk_window_get_size(GTK_WINDOW(instance), &width, &height); + + // Cria o retorno + Php::Value arr; + arr[0] = arr["width"] = width; + arr[1] = arr["height"] = height; + + return arr; +} + /** * Sets whether the user can resize a window. */ diff --git a/src/GtkWindow.h b/src/GtkWindow.h index 0a6f8bd..711c85c 100644 --- a/src/GtkWindow.h +++ b/src/GtkWindow.h @@ -570,6 +570,8 @@ * https://developer.gnome.org/gtk3/stable/GtkWindow.html#gtk-window-set-interactive-debugging */ void set_interactive_debugging(Php::Parameters ¶meters); + + Php::Value get_size(); }; #endif \ No newline at end of file