Subclassing widgets



Hello,

I am writing my first program with gtkmm and have a question about subclassing widgets. 

I have classed my main window as is done in the examples in the book provided with the documentation.  The program essentially stores data in a Sqlite3 database and upon opening a specific database, reads in the data and presents it in the main window.  The database name, connection and functions associated with accessing the database are in a separate database class, and the main window has a single database object associated with it.  The main window has a toolbar, with buttons to inititate creating a new database and opening an existing database (as well as other actions).  When the open button is clicked (for example), a FileChooserDialog is created, the user chooses a file, the name of the file is fed to the database object associated with the main window, the database is opened and the data presented.  So currently (schematic, not code):

open_button_clicked > file_chooser_dialog > file_chosen > filename string (passed by function call to the)> database object > database opened > TreeList populated

In order to create more compartmentalized code I would like to subclass the toolbar and its associated toolbutton widgets.  What I cannot conceive of is how to pass the filename, which would be part of the toolbar object and contained within it, to the database object, which is a member of the main window.  How would one pass/send the filename chosen _out_ of the toolbar object and up to the main window object where the database object has access to it?

Thanks, Jason


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]