// djbob: lists added
- auto comboMain = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listMainTextures))));
+ auto comboMain = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(listMainTextures)));
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
hbox.pack_start( comboMain, FALSE, FALSE, 0 );
comboMain.show();
vbox.pack_start( hbox, FALSE, FALSE, 0 );
hbox.show();
- auto comboTrim = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(listTrimTextures))));
+ auto comboTrim = ui::ComboBox(GTK_COMBO_BOX(gtk_combo_box_new_with_model_and_entry(listTrimTextures)));
gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(comboMain), 0);
hbox.pack_start( comboTrim, FALSE, FALSE, 0 );
comboTrim.show();
ui::ListStore list = ui::ListStore::from(gtk_tree_view_get_model( view ));
GtkTreeIter iter;
- gboolean valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( list ), &iter );
+ gboolean valid = gtk_tree_model_get_iter_first(list, &iter );
while ( valid )
{
gchar* data;
- gtk_tree_model_get( GTK_TREE_MODEL( list ), &iter, 0, &data, -1 );
+ gtk_tree_model_get(list, &iter, 0, &data, -1 );
globalOutputStream() << data << "\n";
ignore.insert( std::string( data ) );
g_free( data );
- valid = gtk_tree_model_iter_next( GTK_TREE_MODEL( list ), &iter );
+ valid = gtk_tree_model_iter_next(list, &iter );
}
for ( std::set<std::string>::iterator it( ignore.begin() ); it != ignore.end(); ++it )
// list store
ui::ListStore ignorelist = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
- gtk_tree_view_set_model( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), GTK_TREE_MODEL( ignorelist ) );
+ gtk_tree_view_set_model( GTK_TREE_VIEW( lookup_widget( wnd, "t_materialist" ) ), ignorelist );
ignorelist.unref();
gtk_widget_show_all( wnd );
gtk_editable_set_editable(GTK_EDITABLE(this), value);
}
+ IMPL(TreeModel, GTK_TREE_MODEL);
+
IMPL(Widget, GTK_WIDGET);
Widget::Widget(ui::New_t) : Widget(nullptr)
gtk_list_store_append(this, nullptr);
}
+ IMPL(TreeStore, GTK_TREE_STORE);
+
// IMPL(TreePath, GTK_TREE_PATH);
TreePath::TreePath(ui::New_t) : TreePath(gtk_tree_path_new())
struct _GtkTreeModel;
struct _GtkTreePath;
struct _GtkTreeSelection;
+struct _GtkTreeStore;
struct _GtkTreeView;
struct _GtkTreeViewColumn;
struct _GtkVBox;
void append();
);
+ WRAP(TreeStore, Object, _GtkTreeStore, (ITreeModel),
+ ,
+ );
+
WRAP(TreeSelection, Object, _GtkTreeSelection, (),
,
);
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
GtkTreeIter iter;
- gtk_tree_model_get_iter( GTK_TREE_MODEL( projectList->m_store ), &iter, path );
+ gtk_tree_model_get_iter(projectList->m_store, &iter, path );
Project::iterator i = Project_find( project, gtk_tree_path_get_indices( path )[0] );
if ( i != project.end() ) {
ASSERT_MESSAGE( gtk_tree_path_get_depth( path ) == 1, "invalid path length" );
GtkTreeIter iter;
- gtk_tree_model_get_iter( GTK_TREE_MODEL( store ), &iter, path );
+ gtk_tree_model_get_iter(store, &iter, path );
Build::iterator i = Build_find( build, gtk_tree_path_get_indices( path )[0] );
if ( i != build.end() ) {
{
auto store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
- ui::Widget view = ui::TreeView( ui::TreeModel(GTK_TREE_MODEL( store ) ));
+ ui::Widget view = ui::TreeView( ui::TreeModel( store ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
auto renderer = ui::CellRendererText(ui::New);
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
- ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ ui::Widget view = ui::TreeView(ui::TreeModel( store ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
auto renderer = ui::CellRendererText(ui::New);
GValue val;
memset( &val, 0, sizeof( val ) );
- gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &iter, 0, &val );
+ gtk_tree_model_get_value(model, &iter, 0, &val );
const char *commandName = g_value_get_string( &val );;
// clear the ACTUAL accelerator too!
// 7. find the name of the accelerator
GValue val;
memset( &val, 0, sizeof( val ) );
- gtk_tree_model_get_value( GTK_TREE_MODEL( dialog.m_model ), &dialog.m_command_iter, 0, &val );
+ gtk_tree_model_get_value(dialog.m_model, &dialog.m_command_iter, 0, &val );
const char *commandName = g_value_get_string( &val );;
Shortcuts::iterator thisShortcutIterator = g_shortcuts.find( commandName );
if ( thisShortcutIterator == g_shortcuts.end() ) {
accelerator = accelerator_null();
// empty the cell of the key binds dialog
GtkTreeIter i;
- if ( gtk_tree_model_get_iter_first( GTK_TREE_MODEL( model ), &i ) ) {
+ if ( gtk_tree_model_get_iter_first(model, &i ) ) {
for (;; )
{
GValue val;
memset( &val, 0, sizeof( val ) );
- gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &i, 0, &val );
+ gtk_tree_model_get_value(model, &i, 0, &val );
const char *thisName = g_value_get_string( &val );;
if ( !strcmp( thisName, name ) ) {
gtk_list_store_set( ui::ListStore::from( model ), &i, 1, "", -1 );
}
g_value_unset( &val );
- if ( !gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), &i ) ) {
+ if ( !gtk_tree_model_iter_next(model, &i ) ) {
break;
}
}
GtkTreeIter row;
GValue val;
if(!model) {g_error("Unable to get model from cell renderer");}
- gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &row, path_string);
+ gtk_tree_model_get_iter_from_string(model, &row, path_string);
- gtk_tree_model_get_value(GTK_TREE_MODEL(model), &row, 0, &val);
+ gtk_tree_model_get_value(model, &row, 0, &val);
const char *name = g_value_get_string(&val);
Shortcuts::iterator i = g_shortcuts.find(name);
if(i != g_shortcuts.end())
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT ));
- auto view = ui::TreeView(ui::TreeModel(GTK_TREE_MODEL(store)));
+ auto view = ui::TreeView(ui::TreeModel(store));
dialog.m_list = view;
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
}
void EntityClassList_selectEntityClass( EntityClass* eclass ){
- GtkTreeModel* model = GTK_TREE_MODEL( g_entlist_store );
+ GtkTreeModel* model = g_entlist_store;
GtkTreeIter iter;
for ( gboolean good = gtk_tree_model_get_iter_first( model, &iter ); good != FALSE; good = gtk_tree_model_iter_next( model, &iter ) )
{
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
- auto view = ui::TreeView( ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ auto view = ui::TreeView( ui::TreeModel(store ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( view, FALSE );
view.connect( "button_press_event", G_CALLBACK( EntityClassList_button_press ), 0 );
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ));
- ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ ui::Widget view = ui::TreeView(ui::TreeModel(store ));
gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), FALSE );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
ui::Window m_window;
GtkTreeView* m_tree_view;
-GraphTreeModel* m_tree_model;
+ui::TreeModel m_tree_model{ui::null};
bool m_selection_disabled;
EntityList() :
return FALSE;
}
-void EntityList_UpdateSelection( GtkTreeModel* model, GtkTreeView* view ){
+void EntityList_UpdateSelection( ui::TreeModel model, GtkTreeView* view ){
EntityList_DisconnectSignals( view );
gtk_tree_model_foreach( model, treemodel_update_selection, view );
EntityList_ConnectSignals( view );
{
case EntityList::eInsertRemove:
case EntityList::eSelection:
- EntityList_UpdateSelection( GTK_TREE_MODEL( getEntityList().m_tree_model ), getEntityList().m_tree_view );
+ EntityList_UpdateSelection( getEntityList().m_tree_model, getEntityList().m_tree_view );
default:
break;
}
extern GraphTreeModel* scene_graph_get_tree_model();
void AttachEntityTreeModel(){
- getEntityList().m_tree_model = scene_graph_get_tree_model();
+ getEntityList().m_tree_model = ui::TreeModel::from(scene_graph_get_tree_model());
- gtk_tree_view_set_model( getEntityList().m_tree_view, GTK_TREE_MODEL( getEntityList().m_tree_model ) );
+ gtk_tree_view_set_model( getEntityList().m_tree_view, getEntityList().m_tree_model );
}
void DetachEntityTreeModel(){
- getEntityList().m_tree_model = 0;
+ getEntityList().m_tree_model = ui::TreeModel(ui::null);
gtk_tree_view_set_model( getEntityList().m_tree_view, 0 );
}
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 1, G_TYPE_STRING ));
- ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ ui::Widget view = ui::TreeView(ui::TreeModel(store ));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
{
ui::ListStore store = ui::ListStore(gtk_list_store_new( 2, G_TYPE_STRING, G_TYPE_STRING ));
- ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ ui::Widget view = ui::TreeView(ui::TreeModel(store ));
gtk_tree_view_set_headers_clickable( GTK_TREE_VIEW( view ), TRUE );
{
return ui::VBox::from(gtk_bin_get_child(page));
}
-GtkTreeIter PreferenceTree_appendPage( GtkTreeStore* store, GtkTreeIter* parent, const char* name, ui::Widget page ){
+GtkTreeIter PreferenceTree_appendPage( ui::TreeStore store, GtkTreeIter* parent, const char* name, ui::Widget page ){
GtkTreeIter group;
gtk_tree_store_append( store, &group, parent );
gtk_tree_store_set( store, &group, 0, name, 1, page, -1 );
{
Dialog& m_dialog;
ui::Widget m_notebook;
-GtkTreeStore* m_store;
+ui::TreeStore m_store;
GtkTreeIter m_group;
public:
-PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, GtkTreeStore* store, GtkTreeIter group ) :
+PreferenceTreeGroup( Dialog& dialog, ui::Widget notebook, ui::TreeStore store, GtkTreeIter group ) :
m_dialog( dialog ),
m_notebook( notebook ),
m_store( store ),
{
- auto store = gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER );
+ auto store = ui::TreeStore(gtk_tree_store_new( 2, G_TYPE_STRING, G_TYPE_POINTER ));
- ui::Widget view = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( store ) ));
+ auto view = ui::TreeView(ui::TreeModel(store));
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
{
auto completion = ui::EntryCompletion(gtk_entry_completion_new());
gtk_entry_set_completion(entry, completion);
- gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(m_store));
+ gtk_entry_completion_set_model(completion, m_store);
gtk_entry_completion_set_text_column(completion, 0);
}
storeAvailable.clear();
- bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( storeAssigned ), &iterAssigned ) != 0;
+ bool row = gtk_tree_model_get_iter_first(storeAssigned, &iterAssigned ) != 0;
if ( !row ) { // does the shader have tags assigned?
for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll )
{
while ( row ) // available tags = all tags - assigned tags
{
- gtk_tree_model_get( GTK_TREE_MODEL( storeAssigned ), &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
+ gtk_tree_model_get(storeAssigned, &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
for ( iterAll = allTags.begin(); iterAll != allTags.end(); ++iterAll )
{
}
else
{
- row = gtk_tree_model_iter_next( GTK_TREE_MODEL( storeAssigned ), &iterAssigned ) != 0;
+ row = gtk_tree_model_iter_next(storeAssigned, &iterAssigned ) != 0;
if ( row ) {
- gtk_tree_model_get( GTK_TREE_MODEL( storeAssigned ), &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
+ gtk_tree_model_get(storeAssigned, &iterAssigned, TAG_COLUMN, &tag_assigned, -1 );
}
}
}
}
}
-void TextureGroups_constructTreeModel( TextureGroups groups, GtkTreeStore* store ){
+void TextureGroups_constructTreeModel( TextureGroups groups, ui::TreeStore store ){
// put the information from the old textures menu into a treeview
GtkTreeIter iter, child;
void TextureBrowser_constructTreeStore(){
TextureGroups groups = TextureGroups_constructTreeView();
- GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
+ auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING ));
TextureGroups_constructTreeModel( groups, store );
- std::set<CopiedString>::iterator iter;
-
- GtkTreeModel* model = GTK_TREE_MODEL( store );
- gtk_tree_view_set_model( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), model );
+ gtk_tree_view_set_model(GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTree ), store);
g_object_unref( G_OBJECT( store ) );
}
void TextureBrowser_constructTreeStoreTags(){
TextureGroups groups;
- GtkTreeStore* store = gtk_tree_store_new( 1, G_TYPE_STRING );
- GtkTreeModel* model = GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list );
+ auto store = ui::TreeStore(gtk_tree_store_new( 1, G_TYPE_STRING ));
+ GtkTreeModel* model = g_TextureBrowser.m_all_tags_list;
gtk_tree_view_set_model( GTK_TREE_VIEW( g_TextureBrowser.m_treeViewTags ), model );
if ( path ) {
GtkTreeIter iter;
- if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ), &iter, path ) ) {
- gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ), &iter, TAG_COLUMN, &tag_assigned, -1 );
+ if ( gtk_tree_model_get_iter(g_TextureBrowser.m_available_store, &iter, path ) ) {
+ gtk_tree_model_get(g_TextureBrowser.m_available_store, &iter, TAG_COLUMN, &tag_assigned, -1 );
if ( !TagBuilder.CheckShaderTag( g_TextureBrowser.shader.c_str() ) ) {
// create a custom shader/texture entry
IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() );
if ( path ) {
GtkTreeIter iter;
- if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ), &iter, path ) ) {
- gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ), &iter, TAG_COLUMN, &tag, -1 );
+ if ( gtk_tree_model_get_iter(g_TextureBrowser.m_assigned_store, &iter, path ) ) {
+ gtk_tree_model_get(g_TextureBrowser.m_assigned_store, &iter, TAG_COLUMN, &tag, -1 );
TagBuilder.DeleteShaderTag( g_TextureBrowser.shader.c_str(), tag );
gtk_list_store_remove( g_TextureBrowser.m_assigned_store, &iter );
}
if ( path ) {
GtkTreeIter iter;
- if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iter, path ) ) {
- gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iter, TAG_COLUMN, &tag, -1 );
+ if ( gtk_tree_model_get_iter(g_TextureBrowser.m_all_tags_list, &iter, path ) ) {
+ gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iter, TAG_COLUMN, &tag, -1 );
strcat( buffer, tag );
strcat( tags_searched, tag );
auto renderer = ui::CellRendererText(ui::New);
- g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_assigned_store ) ));
+ g_TextureBrowser.m_assigned_tree = ui::TreeView(ui::TreeModel(g_TextureBrowser.m_assigned_store ));
g_TextureBrowser.m_assigned_store.unref();
g_TextureBrowser.m_assigned_tree.connect( "row-activated", (GCallback) TextureBrowser_removeTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_assigned_tree ), FALSE );
auto renderer = ui::CellRendererText(ui::New);
- g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel( GTK_TREE_MODEL( g_TextureBrowser.m_available_store ) ));
+ g_TextureBrowser.m_available_tree = ui::TreeView(ui::TreeModel(g_TextureBrowser.m_available_store ));
g_TextureBrowser.m_available_store.unref();
g_TextureBrowser.m_available_tree.connect( "row-activated", (GCallback) TextureBrowser_assignTags, NULL );
gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( g_TextureBrowser.m_available_tree ), FALSE );
gchar* rowTag;
gchar* oldTag = (char*)selected->data;
- bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList ) != 0;
+ bool row = gtk_tree_model_get_iter_first(g_TextureBrowser.m_all_tags_list, &iterList ) != 0;
while ( row )
{
- gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList, TAG_COLUMN, &rowTag, -1 );
+ gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iterList, TAG_COLUMN, &rowTag, -1 );
if ( strcmp( rowTag, oldTag ) == 0 ) {
gtk_list_store_set( g_TextureBrowser.m_all_tags_list, &iterList, TAG_COLUMN, newTag.c_str(), -1 );
}
- row = gtk_tree_model_iter_next( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterList ) != 0;
+ row = gtk_tree_model_iter_next(g_TextureBrowser.m_all_tags_list, &iterList ) != 0;
}
TagBuilder.RenameShaderTag( oldTag, newTag.c_str() );
gchar* tagSelected = (char*)selected->data;
- bool row = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected ) != 0;
+ bool row = gtk_tree_model_get_iter_first(g_TextureBrowser.m_all_tags_list, &iterSelected ) != 0;
while ( row )
{
- gtk_tree_model_get( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected, TAG_COLUMN, &rowTag, -1 );
+ gtk_tree_model_get(g_TextureBrowser.m_all_tags_list, &iterSelected, TAG_COLUMN, &rowTag, -1 );
if ( strcmp( rowTag, tagSelected ) == 0 ) {
gtk_list_store_remove( g_TextureBrowser.m_all_tags_list, &iterSelected );
break;
}
- row = gtk_tree_model_iter_next( GTK_TREE_MODEL( g_TextureBrowser.m_all_tags_list ), &iterSelected ) != 0;
+ row = gtk_tree_model_iter_next(g_TextureBrowser.m_all_tags_list, &iterSelected ) != 0;
}
TagBuilder.DeleteTag( tagSelected );
typedef GtkTreeStore GraphTreeModel;
-GtkTreeStore* graph_tree_model_new( graph_type* graph ){
+ui::TreeStore graph_tree_model_new( graph_type* graph ){
return gtk_tree_store_new( 2, G_TYPE_POINTER, G_TYPE_POINTER );
}
bool graph_tree_model_subtree_find_node( GraphTreeModel* model, GtkTreeIter* parent, const scene::Node& node, GtkTreeIter* iter ){
- for ( gboolean success = gtk_tree_model_iter_children( GTK_TREE_MODEL( model ), iter, parent );
+ for ( gboolean success = gtk_tree_model_iter_children( model, iter, parent );
success != FALSE;
- success = gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), iter ) )
+ success = gtk_tree_model_iter_next( model, iter ) )
{
scene::Node* current;
- gtk_tree_model_get_pointer( GTK_TREE_MODEL( model ), iter, 0, ¤t );
+ gtk_tree_model_get_pointer( model, iter, 0, ¤t );
if ( current == node ) {
return true;
}
static gboolean graph_tree_model_drag_data_delete( GtkTreeDragSource *drag_source, GtkTreePath *path ){
GtkTreeIter iter;
- if ( gtk_tree_model_get_iter( GTK_TREE_MODEL( drag_source ), &iter, path ) ) {
+ if ( gtk_tree_model_get_iter( drag_source, &iter, path ) ) {
graph_type::iterator i = graph_iterator_read_tree_iter( &iter );
Path_deleteTop( ( *i ).first );
return TRUE;
}
static gboolean graph_tree_model_drag_data_get( GtkTreeDragSource *drag_source, GtkTreePath *path, GtkSelectionData *selection_data ){
- if ( gtk_tree_set_row_drag_data( selection_data, GTK_TREE_MODEL( drag_source ), path ) ) {
+ if ( gtk_tree_set_row_drag_data( selection_data, drag_source, path ) ) {
return TRUE;
}
else
}
static gboolean graph_tree_model_drag_data_received( GtkTreeDragDest *drag_dest, GtkTreePath *dest, GtkSelectionData *selection_data ){
- GtkTreeModel *tree_model = GTK_TREE_MODEL( drag_dest );
+ GtkTreeModel *tree_model = drag_dest;
GtkTreeModel *src_model = 0;
GtkTreePath *src_path = 0;
GtkTreePath *src_path = 0;
if ( gtk_tree_get_row_drag_data( selection_data, &src_model, &src_path ) != FALSE ) {
/* can only drag to ourselves */
- if ( src_model == GTK_TREE_MODEL( drag_dest ) ) {
+ if ( src_model == drag_dest ) {
/* Can't drop into ourself. */
if ( !gtk_tree_path_is_ancestor( src_path, dest_path ) ) {
/* Can't drop if dest_path's parent doesn't exist */
gtk_tree_path_up( tmp );
GtkTreeIter iter;
- retval = gtk_tree_model_get_iter( GTK_TREE_MODEL( drag_dest ), &iter, tmp );
+ retval = gtk_tree_model_get_iter( drag_dest, &iter, tmp );
gtk_tree_path_free( tmp );
}
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( GTK_TREE_MODEL( model ), &iter );
+ GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter );
gint depth = gtk_tree_path_get_depth( tree_path );
gint* indices = gtk_tree_path_get_indices( tree_path );
- gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter );
+ gtk_tree_model_row_inserted( model, tree_path, &iter );
gtk_tree_path_free( tree_path );
}
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( GTK_TREE_MODEL( model ), &iter );
+ GtkTreePath* tree_path = graph_tree_model_get_path( model, &iter );
- gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path );
+ gtk_tree_model_row_deleted( model, tree_path );
gtk_tree_path_free( tree_path );
}
GObjectClass parent_class;
};
-#define GRAPH_TREE_MODEL( p ) ( reinterpret_cast<GraphTreeModel*>( p ) )
-
static GtkTreeModelFlags graph_tree_model_get_flags( GtkTreeModel* tree_model ){
return GTK_TREE_MODEL_ITERS_PERSIST;
}
return G_TYPE_POINTER;
}
-static gboolean graph_tree_model_get_iter( GtkTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){
+static gboolean graph_tree_model_get_iter( GraphTreeModel* tree_model, GtkTreeIter* iter, GtkTreePath* path ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
gint* indices = gtk_tree_path_get_indices( path );
gint depth = gtk_tree_path_get_depth( path );
g_return_val_if_fail( depth > 0, FALSE );
- GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
+ GraphTreeNode *graph = tree_model->m_graph;
if ( graph->empty() ) {
return FALSE;
for ( gint i = 0; i < depth; i++ )
{
- if ( !gtk_tree_model_iter_nth_child( tree_model, iter, parent, indices[i] ) ) {
+ if ( !gtk_tree_model_iter_nth_child( GTK_TREE_MODEL(tree_model), iter, parent, indices[i] ) ) {
return FALSE;
}
tmp = *iter;
return TRUE;
}
-static GtkTreePath* graph_tree_model_get_path( GtkTreeModel* tree_model, GtkTreeIter* iter ){
+static GtkTreePath* graph_tree_model_get_path( GraphTreeModel* tree_model, GtkTreeIter* iter ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- GraphTreeNode* graph = GRAPH_TREE_MODEL( tree_model )->m_graph;
+ GraphTreeNode* graph = tree_model->m_graph;
GtkTreePath* path = ui::TreePath(ui::New);
return TRUE;
}
-static gboolean graph_tree_model_iter_children( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){
+static gboolean graph_tree_model_iter_children( GraphTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+ GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
if ( !node.empty() ) {
graph_iterator_write_tree_iter( node.begin(), iter );
return TRUE;
return !node.empty();
}
-static gint graph_tree_model_iter_n_children( GtkTreeModel *tree_model, GtkTreeIter *parent ){
+static gint graph_tree_model_iter_n_children( GraphTreeModel *tree_model, GtkTreeIter *parent ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+ GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
return static_cast<gint>( node.size() );
}
-static gboolean graph_tree_model_iter_nth_child( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){
+static gboolean graph_tree_model_iter_nth_child( GraphTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *parent, gint n ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
- GraphTreeNode& node = ( parent == 0 ) ? *GRAPH_TREE_MODEL( tree_model )->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
+ GraphTreeNode& node = ( parent == 0 ) ? *tree_model->m_graph : *( *graph_iterator_read_tree_iter( parent ) ).second;
if ( static_cast<std::size_t>( n ) < node.size() ) {
GraphTreeNode::iterator i = node.begin();
std::advance( i, n );
return FALSE;
}
-static gboolean graph_tree_model_iter_parent( GtkTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child ){
+static gboolean graph_tree_model_iter_parent( GraphTreeModel *tree_model, GtkTreeIter *iter, GtkTreeIter *child ){
ASSERT_MESSAGE( tree_model != 0, "RUNTIME ERROR" );
GraphTreeNode& node = *( *graph_iterator_read_tree_iter( child ) ).second;
- if ( node.m_parent != GRAPH_TREE_MODEL( tree_model )->m_graph ) {
+ if ( node.m_parent != tree_model->m_graph ) {
GraphTreeNode& parentParent = *node.m_parent->m_parent;
for ( GraphTreeNode::iterator i = parentParent.begin(); i != parentParent.end(); ++i )
{
}
static void graph_tree_model_finalize( GObject* object ){
- GraphTreeModel* graph_tree_model = GRAPH_TREE_MODEL( object );
+ auto graph_tree_model = reinterpret_cast<GraphTreeModel*>(object);
delete graph_tree_model->m_graph;
iface->get_flags = graph_tree_model_get_flags;
iface->get_n_columns = graph_tree_model_get_n_columns;
iface->get_column_type = graph_tree_model_get_column_type;
- iface->get_iter = graph_tree_model_get_iter;
- iface->get_path = graph_tree_model_get_path;
+ iface->get_iter = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreePath *)>(graph_tree_model_get_iter);
+ iface->get_path = reinterpret_cast<GtkTreePath *(*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_get_path);
iface->get_value = graph_tree_model_get_value;
iface->iter_next = graph_tree_model_iter_next;
- iface->iter_children = graph_tree_model_iter_children;
+ iface->iter_children = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_children);
iface->iter_has_child = graph_tree_model_iter_has_child;
- iface->iter_n_children = graph_tree_model_iter_n_children;
- iface->iter_nth_child = graph_tree_model_iter_nth_child;
- iface->iter_parent = graph_tree_model_iter_parent;
+ iface->iter_n_children = reinterpret_cast<gint (*)(GtkTreeModel *, GtkTreeIter *)>(graph_tree_model_iter_n_children);
+ iface->iter_nth_child = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gint)>(graph_tree_model_iter_nth_child);
+ iface->iter_parent = reinterpret_cast<gboolean (*)(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *)>(graph_tree_model_iter_parent);
}
GType graph_tree_model_get_type( void ){
}
GraphTreeModel* graph_tree_model_new(){
- GraphTreeModel* graph_tree_model = GRAPH_TREE_MODEL( g_object_new( graph_tree_model_get_type(), 0 ) );
+ auto graph_tree_model = reinterpret_cast<GraphTreeModel*>(g_object_new( graph_tree_model_get_type(), 0 ));
return graph_tree_model;
}
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( GTK_TREE_MODEL( model ), &iter );
+ GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_changed( GTK_TREE_MODEL( model ), tree_path, &iter );
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( GTK_TREE_MODEL( model ), &iter );
+ GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_inserted( GTK_TREE_MODEL( model ), tree_path, &iter );
GtkTreeIter iter;
graph_iterator_write_tree_iter( i, &iter );
- GtkTreePath* tree_path = graph_tree_model_get_path( GTK_TREE_MODEL( model ), &iter );
+ GtkTreePath* tree_path = graph_tree_model_get_path(model, &iter );
gtk_tree_model_row_deleted( GTK_TREE_MODEL( model ), tree_path );
rootpath.pop();
rootpath.pop();
- GtkTreeModel* model = GTK_TREE_MODEL( graph_tree_model_new( &graph ) );
+ GtkTreeModel* model = graph_tree_model_new( &graph );
{
gint n_columns = gtk_tree_model_get_n_columns( model );