Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
scorninpc committed Jun 12, 2019
2 parents 73aa4ce + 3139e8e commit c84ec7d
Show file tree
Hide file tree
Showing 10 changed files with 357 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ _GObject
│ │ │ │ ├── *GtkActionBar
│ │ │ │ ├── GtkAlignment
│ │ │ │ ├── #GtkComboBox
│ │ │ │ │ ├── GtkAppChooserButton
│ │ │ │ │ ╰── GtkComboBoxText
│ │ │ │ │ ├── #GtkAppChooserButton
│ │ │ │ │ ╰── *GtkComboBoxText
│ │ │ │ ├── *GtkFrame
│ │ │ │ │ ╰── *GtkAspectFrame
│ │ │ │ ├── #GtkButton
Expand Down
33 changes: 33 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,37 @@ extern "C"
gtkcombobox.method<&GtkComboBox_::add_attribute>("add_attribute");


// GtkComboBoxText
Php::Class<GtkComboBoxText_> gtkcomboboxtext("GtkComboBoxText");
gtkcomboboxtext.extends(gtkcombobox);
gtkcomboboxtext.method<&GtkComboBoxText_::__construct>("__construct");
gtkcomboboxtext.method<&GtkComboBoxText_::new_with_entry>("new_with_entry");
gtkcomboboxtext.method<&GtkComboBoxText_::append>("append");
gtkcomboboxtext.method<&GtkComboBoxText_::prepend>("prepend");
gtkcomboboxtext.method<&GtkComboBoxText_::insert>("insert");
gtkcomboboxtext.method<&GtkComboBoxText_::append_text>("append_text");
gtkcomboboxtext.method<&GtkComboBoxText_::prepend_text>("prepend_text");
gtkcomboboxtext.method<&GtkComboBoxText_::insert_text>("insert_text");
gtkcomboboxtext.method<&GtkComboBoxText_::remove>("remove");
gtkcomboboxtext.method<&GtkComboBoxText_::remove_all>("remove_all");
gtkcomboboxtext.method<&GtkComboBoxText_::get_active_text>("get_active_text");


// GtkAppChooserButton
Php::Class<GtkAppChooserButton_> gtkappchooserbutton("GtkAppChooserButton");
gtkappchooserbutton.extends(gtkcombobox);
gtkappchooserbutton.method<&GtkAppChooserButton_::__construct>("__construct");
gtkappchooserbutton.method<&GtkAppChooserButton_::append_custom_item>("append_custom_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::append_separator>("append_separator");
gtkappchooserbutton.method<&GtkAppChooserButton_::set_active_custom_item>("set_active_custom_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::get_show_default_item>("get_show_default_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::set_show_default_item>("set_show_default_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::get_show_dialog_item>("get_show_dialog_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::set_show_dialog_item>("set_show_dialog_item");
gtkappchooserbutton.method<&GtkAppChooserButton_::get_heading>("get_heading");
gtkappchooserbutton.method<&GtkAppChooserButton_::set_heading>("set_heading");


// GtkBuilder
Php::Class<GtkBuilder_> gtkbuilder("GtkBuilder");
gtkbuilder.extends(gobject);
Expand Down Expand Up @@ -2413,6 +2444,8 @@ extern "C"

extension.add(std::move(gtksensitivitytype));
extension.add(std::move(gtkcombobox));
extension.add(std::move(gtkcomboboxtext));
extension.add(std::move(gtkappchooserbutton));

extension.add(std::move(gtkbuilder));

Expand Down
3 changes: 3 additions & 0 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@

#include "src/GtkSensitivityType.h"
#include "src/GtkComboBox.h"
#include "src/GtkComboBoxText.h"
#include "src/GtkAppChooserButton.h"

#include "src/GtkBuilder.h"

Expand Down Expand Up @@ -184,6 +186,7 @@
#include "src/GtkCalendarDisplayOptions.h"
#include "src/GtkCalendar.h"



GValue phpgtk_get_gvalue(Php::Value phpgtk_value, GType type_column);

Expand Down
97 changes: 97 additions & 0 deletions src/GtkAppChooserButton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

#include "GtkAppChooserButton.h"

/**
* Constructor
*/
GtkAppChooserButton_::GtkAppChooserButton_() = default;

/**
* Destructor
*/
GtkAppChooserButton_::~GtkAppChooserButton_() = default;

void GtkAppChooserButton_::__construct(Php::Parameters &parameters)
{
std::string s_content_type = parameters[0];
gchar *content_type = (gchar *)s_content_type.c_str();

instance = (gpointer *)gtk_app_chooser_button_new (content_type);
}

void GtkAppChooserButton_::append_custom_item(Php::Parameters &parameters)
{
// std::string s_name = parameters[0];
// gchar *name = (gchar *)s_name.c_str();

// std::string s_label = parameters[1];
// gchar *label = (gchar *)s_label.c_str();


// gtk_app_chooser_button_append_custom_item (GTK_APP_CHOOSER_BUTTON(instance), name, label, icon);

throw Php::Exception("GtkAppChooserButton_::append_custom_item not implemented");

}

void GtkAppChooserButton_::append_separator()
{
gtk_app_chooser_button_append_separator (GTK_APP_CHOOSER_BUTTON(instance));

}

void GtkAppChooserButton_::set_active_custom_item(Php::Parameters &parameters)
{
std::string s_name = parameters[0];
gchar *name = (gchar *)s_name.c_str();

gtk_app_chooser_button_set_active_custom_item (GTK_APP_CHOOSER_BUTTON(instance), name);

}

Php::Value GtkAppChooserButton_::get_show_default_item()
{
gboolean ret = gtk_app_chooser_button_get_show_default_item (GTK_APP_CHOOSER_BUTTON(instance));

return ret;
}

void GtkAppChooserButton_::set_show_default_item(Php::Parameters &parameters)
{
gboolean setting = (gboolean)parameters[0];

gtk_app_chooser_button_set_show_default_item (GTK_APP_CHOOSER_BUTTON(instance), setting);

}

Php::Value GtkAppChooserButton_::get_show_dialog_item()
{
gboolean ret = gtk_app_chooser_button_get_show_dialog_item (GTK_APP_CHOOSER_BUTTON(instance));

return ret;
}

void GtkAppChooserButton_::set_show_dialog_item(Php::Parameters &parameters)
{
gboolean setting = (gboolean)parameters[0];

gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON(instance), setting);

}

Php::Value GtkAppChooserButton_::get_heading()
{
std::string ret = gtk_app_chooser_button_get_heading (GTK_APP_CHOOSER_BUTTON(instance));

return ret;
}

void GtkAppChooserButton_::set_heading(Php::Parameters &parameters)
{
std::string s_heading = parameters[0];
gchar *heading = (gchar *)s_heading.c_str();

gtk_app_chooser_button_set_heading (GTK_APP_CHOOSER_BUTTON(instance), heading);

}

49 changes: 49 additions & 0 deletions src/GtkAppChooserButton.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

#ifndef _PHPGTK_GTKAPPCHOOSERBUTTON_H_
#define _PHPGTK_GTKAPPCHOOSERBUTTON_H_

#include <phpcpp.h>
#include <gtk/gtk.h>

#include "GtkComboBox.h"

/**
* GtkAppChooserButton_
*
* https://developer.gnome.org/gtk3/stable/GtkAppChooserButton.html
*/
class GtkAppChooserButton_ : public GtkComboBox_
{
/**
* Publics
*/
public:

/**
* C++ constructor and destructor
*/
GtkAppChooserButton_();
~GtkAppChooserButton_();

void __construct(Php::Parameters &parameters);

void append_custom_item(Php::Parameters &parameters);

void append_separator();

void set_active_custom_item(Php::Parameters &parameters);

Php::Value get_show_default_item();

void set_show_default_item(Php::Parameters &parameters);

Php::Value get_show_dialog_item();

void set_show_dialog_item(Php::Parameters &parameters);

Php::Value get_heading();

void set_heading(Php::Parameters &parameters);
};

#endif
116 changes: 116 additions & 0 deletions src/GtkComboBoxText.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

#include "GtkComboBoxText.h"

/**
* Constructor
*/
GtkComboBoxText_::GtkComboBoxText_() = default;

/**
* Destructor
*/
GtkComboBoxText_::~GtkComboBoxText_() = default;

void GtkComboBoxText_::__construct()
{
instance = (gpointer *)gtk_combo_box_text_new ();

}

Php::Value GtkComboBoxText_::new_with_entry()
{
GtkWidget *ret = gtk_combo_box_text_new_with_entry ();

GtkComboBoxText_ *return_parsed = new GtkComboBoxText_();
return_parsed->set_instance((gpointer *)ret);
return Php::Object("GtkComboBoxText", return_parsed);
}

void GtkComboBoxText_::append(Php::Parameters &parameters)
{
std::string s_id = parameters[0];
gchar *id = (gchar *)s_id.c_str();

std::string s_text = parameters[1];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT(instance), id, text);

}

void GtkComboBoxText_::prepend(Php::Parameters &parameters)
{
std::string s_id = parameters[0];
gchar *id = (gchar *)s_id.c_str();

std::string s_text = parameters[1];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_prepend (GTK_COMBO_BOX_TEXT(instance), id, text);

}

void GtkComboBoxText_::insert(Php::Parameters &parameters)
{
gint position = (gint)parameters[0];

std::string s_id = parameters[1];
gchar *id = (gchar *)s_id.c_str();

std::string s_text = parameters[2];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_insert (GTK_COMBO_BOX_TEXT(instance), position, id, text);

}

void GtkComboBoxText_::append_text(Php::Parameters &parameters)
{
std::string s_text = parameters[0];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(instance), text);

}

void GtkComboBoxText_::prepend_text(Php::Parameters &parameters)
{
std::string s_text = parameters[0];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT(instance), text);

}

void GtkComboBoxText_::insert_text(Php::Parameters &parameters)
{
gint position = (gint)parameters[0];

std::string s_text = parameters[1];
gchar *text = (gchar *)s_text.c_str();

gtk_combo_box_text_insert_text (GTK_COMBO_BOX_TEXT(instance), position, text);

}

void GtkComboBoxText_::remove(Php::Parameters &parameters)
{
gint position = (gint)parameters[0];

gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT(instance), position);

}

void GtkComboBoxText_::remove_all()
{
gtk_combo_box_text_remove_all (GTK_COMBO_BOX_TEXT(instance));

}

Php::Value GtkComboBoxText_::get_active_text()
{
std::string ret = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(instance));

return ret;
}

52 changes: 52 additions & 0 deletions src/GtkComboBoxText.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

#ifndef _PHPGTK_GTKCOMBOBOXTEXT_H_
#define _PHPGTK_GTKCOMBOBOXTEXT_H_

#include <phpcpp.h>
#include <gtk/gtk.h>

#include "GtkComboBox.h"
#include "GtkWidget.h"

/**
* GtkComboBoxText_
*
* https://developer.gnome.org/gtk3/stable/GtkComboBoxText.html
*/
class GtkComboBoxText_ : public GtkComboBox_
{
/**
* Publics
*/
public:

/**
* C++ constructor and destructor
*/
GtkComboBoxText_();
~GtkComboBoxText_();

void __construct();

static Php::Value new_with_entry();

void append(Php::Parameters &parameters);

void prepend(Php::Parameters &parameters);

void insert(Php::Parameters &parameters);

void append_text(Php::Parameters &parameters);

void prepend_text(Php::Parameters &parameters);

void insert_text(Php::Parameters &parameters);

void remove(Php::Parameters &parameters);

void remove_all();

Php::Value get_active_text();
};

#endif
Loading

0 comments on commit c84ec7d

Please sign in to comment.