#include <image_create.h>
Inheritance diagram for GDKImageCreateRepository:


Public Member Functions | |
| GDKImageCreateRepository () | |
| Constructor for the image creator repository. | |
| ~GDKImageCreateRepository () | |
| Destructor for the image repository - clears all the registered creators. | |
| void | Register (GDKImageCreate *creator) |
| Register an image creator creator. | |
| void | Initialise (GtkOptionMenu *menu, GtkBin *container) |
| Initialise the option menu with the current list of registered creators. | |
| GDKImageCreate * | Get () const |
| Get the currently selected image creator creator. | |
| void | SelectionChange () |
| Handle attach/detach widgets on last selected/selected items. | |
Private Attributes | |
| vector< GDKImageCreate * > | creators |
| GDKImageCreate * | selected_creator |
| GtkOptionMenu * | menu |
| GtkBin * | container |
Creators are currently registered in the repositories constructor and added to the OptionMenu provided via the Initialise function.
Additional creators can be registered before an Initialise call (using the Register method), and Initialise can be called many times if necessary.
Definition at line 134 of file image_create.h.
|
|
Constructor for the image creator repository. Registers an instance of each known creator for later GUI exposure via the Initialise method. Definition at line 726 of file image_create.cc. References Register(). 00726 : selected_creator( NULL ), menu( NULL ), container( NULL ) 00727 { 00728 // Register an instance of each object 00729 Register( new ImageCreateColourRange() ); 00730 Register( new ImageCreateColour() ); 00731 Register( new ImageCreateFromFile() ); 00732 Register( new ImageCreateGradiate() ); 00733 Register( new ImageCreateNoise() ); 00734 }
|
|
|
Destructor for the image repository - clears all the registered creators.
Definition at line 739 of file image_create.cc. References creators. 00740 {
00741 // Remove the creators in the repository
00742 for ( unsigned int index = 0; index < creators.size(); index ++ )
00743 delete creators[ index ];
00744 }
|
|
|
Get the currently selected image creator creator.
Definition at line 783 of file image_create.cc. References creators, and menu. Referenced by PageMagick::GetImageCreate(), and SelectionChange(). 00784 {
00785 GtkMenu * creatorMenu = GTK_MENU( gtk_option_menu_get_menu( menu ) );
00786 GtkWidget *active_item = gtk_menu_get_active( creatorMenu );
00787 return creators[ g_list_index( GTK_MENU_SHELL( creatorMenu ) ->children, active_item ) ];
00788 }
|
|
||||||||||||
|
Initialise the option menu with the current list of registered creators.
Definition at line 758 of file image_create.cc. References creators, on_optionmenu_selected(), and SelectionChange(). Referenced by PageMagick::PageMagick(). 00759 {
00760 // Store these for future reference
00761 this->menu = menu;
00762 this->container = container;
00763
00764 // Add the creators to the menu
00765 GtkMenu *menu_new = GTK_MENU( gtk_menu_new( ) );
00766 for ( unsigned int index = 0; index < creators.size(); index ++ )
00767 {
00768 GtkWidget *item = gtk_menu_item_new_with_label( creators[ index ] ->GetDescription( ) );
00769 gtk_widget_show( item );
00770 gtk_menu_append( menu_new, item );
00771 g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( on_optionmenu_selected ), this );
00772 }
00773 gtk_menu_set_active( menu_new, 0 );
00774 gtk_option_menu_set_menu( menu, GTK_WIDGET( menu_new ) );
00775
00776 // Register the selected items widgets
00777 SelectionChange();
00778 }
|
|
|
Register an image creator creator.
Definition at line 749 of file image_create.cc. References creators, and ImageCreate::GetDescription(). Referenced by GDKImageCreateRepository(), and PluginImageCreateRepository::InstallPlugins(). 00750 {
00751 std::cerr << ">>> Image Create: " << creator->GetDescription( ) << std::endl;
00752 creators.push_back( creator );
00753 }
|
|
|
Handle attach/detach widgets on last selected/selected items.
Definition at line 793 of file image_create.cc. References GDKImageCreate::AttachWidgets(), common, container, GDKImageCreate::DetachWidgets(), Get(), KinoCommon::getPageMagick(), and selected_creator. Referenced by Initialise(). 00794 {
00795 // Detach the selected creators widgets
00796 if ( selected_creator != NULL )
00797 selected_creator->DetachWidgets( container );
00798
00799 // Get the new selection
00800 selected_creator = Get();
00801
00802 // Attach the new creators widgets
00803 if ( selected_creator != NULL )
00804 selected_creator->AttachWidgets( container );
00805
00806 // Inform the main page of the change
00807 if ( common != NULL && common->getPageMagick( ) != NULL )
00808 common->getPageMagick( ) ->RefreshStatus( );
00809 }
|
|
|
Definition at line 140 of file image_create.h. Referenced by SelectionChange(). |
|
|
Definition at line 137 of file image_create.h. Referenced by Get(), Initialise(), Register(), and ~GDKImageCreateRepository(). |
|
|
Definition at line 139 of file image_create.h. Referenced by Get(). |
|
|
Definition at line 138 of file image_create.h. Referenced by SelectionChange(). |
1.4.2