This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ModelColumns : public Gtk::TreeModel::ColumnRecord | |
| { | |
| public: | |
| ModelColumns() | |
| { | |
| add(columnId); | |
| add(columnName); | |
| add(icon); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DerivedWMain::DerivedWMain(BaseObjectType* cobject, const Glib::RefPtr& refGlade) : | |
| Gtk::Window(cobject), | |
| refXmlGlade(refGlade) | |
| { | |
| ... | |
| refTreeStore = Gtk::TreeStore::create( modelColumns ); | |
| gtkTreeViewConfigList->set_model( refTreeStore ); | |
| gtkTreeViewConfigList->append_column( "Icon", modelColumns.icon ); | |
| gtkTreeViewConfigList->append_column( "ID", modelColumns.columnId ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Gtk::TreeModel::Row row = *( refTreeStore->append() ); | |
| row[ modelColumns.icon ] = Gdk::Pixbuf::create_from_file("/path/to/the/image/file.ext", 50, 50, true); | |
| row[ modelColumns.columnId ] = 1; | |
| row[ modelColumns.columnName ] = "Test"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void DerivedWMain::gtkButtonClear_Click() | |
| { | |
| refTreeStore->clear(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void DerivedWMain::gtkButtonDelete_Click() | |
| { | |
| //~ Check selected row | |
| if ( const Gtk::TreeModel::iterator iter = refTreeSelection->get_selected() ) | |
| { | |
| refTreeStore->erase(iter); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'yaml' | |
| def show_usage | |
| puts "Usage: #{$0} YML-FILE-PATH [DESTINATION]" | |
| puts | |
| end | |
| def isNumeric(s) | |
| begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ClassA | |
| { | |
| public: | |
| typedef boost::signals2::signal<void(User*)> signalUserCreated; | |
| typedef signalUserCreated::slot_type signalUserCreatedType; | |
| ... | |
| private: | |
| static signalUserCreated user_created; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| boost::signals2::connection ClassA::connect(const signalUserCreatedType &slot) | |
| { | |
| std::cout << "ClassA::connect" << std::endl; | |
| return user_created.connect(slot); | |
| } | |
| ClassA::signalUserCreated ClassA::user_created; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ClassA class_a; | |
| ClassB class_b; | |
| class_a.connect(boost::bind(&ClassB::on_new_user, &class_b, _1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void ClassA::create_new_user(std::string name, int age) | |
| { | |
| std::cout << "ClassA::create_new_user" << std::endl; | |
| // Instanciate a new User | |
| User new_user(name, age); | |
| // Pass a reference of this user to all subscribed objects | |
| user_created(&new_user); | |
| } |