Changeset 531

Show
Ignore:
Timestamp:
07/13/08 16:33:46 (2 months ago)
Author:
Mike Wey
Message:

Make the ImageMenuItem? Constructor accept the StockID enum

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/gobject/ObjectG.d

    r530 r531  
    180180     *  data = a pointer 
    181181     */ 
    182     public: void objectGSetDataFull(string key, gpointer data) 
     182    public void objectGSetDataFull(string key, gpointer data) 
    183183    { 
    184184        //writefln("setData objectG=%X data=%X type %s",gObject,data,key); 
  • trunk/src/gtk/ImageMenuItem.d

    r530 r531  
    4444 *  - gtk_image_menu_item_new_with_label 
    4545 *  - gtk_image_menu_item_new_with_mnemonic 
     46 *  - gtk_image_menu_item_new_from_stock 
    4647 * omit signals: 
    4748 * imports: 
     
    143144     
    144145    /** 
    145      */ 
    146      
    147     /** 
    148      * Sets the image of image_menu_item to the given widget. 
    149      * Note that it depends on the show-menu-images setting whether 
    150      * the image will be displayed or not. 
    151      * Params: 
    152      * image =  a widget to set as the image for the menu item. 
    153      */ 
    154     public void setImage(Widget image) 
    155     { 
    156         // void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,  GtkWidget *image); 
    157         gtk_image_menu_item_set_image(gtkImageMenuItem, (image is null) ? null : image.getWidgetStruct()); 
    158     } 
    159      
    160     /** 
    161      * Gets the widget that is currently set as the image of image_menu_item. 
    162      * See gtk_image_menu_item_set_image(). 
    163      * Returns: the widget set as image of image_menu_item. 
    164      */ 
    165     public Widget getImage() 
    166     { 
    167         // GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item); 
    168         auto p = gtk_image_menu_item_get_image(gtkImageMenuItem); 
    169         if(p is null) 
    170         { 
    171             return null; 
    172         } 
    173         return new Widget(cast(GtkWidget*) p); 
    174     } 
    175      
    176     /** 
    177      * Creates a new GtkImageMenuItem with an empty label. 
    178      */ 
    179     public this () 
    180     { 
    181         // GtkWidget* gtk_image_menu_item_new (void); 
    182         auto p = gtk_image_menu_item_new(); 
    183         if(p is null) 
    184         { 
    185             throw new Exception("Construction failure."); 
    186         } 
    187         this(cast(GtkImageMenuItem*) p); 
    188     } 
    189      
    190     /** 
    191146     * Creates a new GtkImageMenuItem containing the image and text from a 
    192147     * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK 
     
    198153     * gtk_accel_map_add_entry() to register it. 
    199154     * Params: 
    200      * stockId =  the name of the stock item. 
     155     * StockID = the name of the stock item 
    201156     * accelGroup =  the GtkAccelGroup to add the menu items accelerator to, 
    202157     *  or NULL. 
    203158     */ 
    204     public this (string stockId, AccelGroup accelGroup) 
     159    public this (StockID stockID, AccelGroup accelGroup) 
    205160    { 
    206161        // GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,  GtkAccelGroup *accel_group); 
    207         auto p = gtk_image_menu_item_new_from_stock(Str.toStringz(stockId), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 
     162        auto p = gtk_image_menu_item_new_from_stock(Str.toStringz(StockDesc[stockID]), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 
    208163        if(p is null) 
    209164        { 
     
    212167        this(cast(GtkImageMenuItem*) p); 
    213168    } 
     169     
     170    /** 
     171     */ 
     172     
     173    /** 
     174     * Sets the image of image_menu_item to the given widget. 
     175     * Note that it depends on the show-menu-images setting whether 
     176     * the image will be displayed or not. 
     177     * Params: 
     178     * image =  a widget to set as the image for the menu item. 
     179     */ 
     180    public void setImage(Widget image) 
     181    { 
     182        // void gtk_image_menu_item_set_image (GtkImageMenuItem *image_menu_item,  GtkWidget *image); 
     183        gtk_image_menu_item_set_image(gtkImageMenuItem, (image is null) ? null : image.getWidgetStruct()); 
     184    } 
     185     
     186    /** 
     187     * Gets the widget that is currently set as the image of image_menu_item. 
     188     * See gtk_image_menu_item_set_image(). 
     189     * Returns: the widget set as image of image_menu_item. 
     190     */ 
     191    public Widget getImage() 
     192    { 
     193        // GtkWidget* gtk_image_menu_item_get_image (GtkImageMenuItem *image_menu_item); 
     194        auto p = gtk_image_menu_item_get_image(gtkImageMenuItem); 
     195        if(p is null) 
     196        { 
     197            return null; 
     198        } 
     199        return new Widget(cast(GtkWidget*) p); 
     200    } 
     201     
     202    /** 
     203     * Creates a new GtkImageMenuItem with an empty label. 
     204     */ 
     205    public this () 
     206    { 
     207        // GtkWidget* gtk_image_menu_item_new (void); 
     208        auto p = gtk_image_menu_item_new(); 
     209        if(p is null) 
     210        { 
     211            throw new Exception("Construction failure."); 
     212        } 
     213        this(cast(GtkImageMenuItem*) p); 
     214    } 
    214215} 
  • trunk/wrap/APILookupGtk.txt

    r525 r531  
    43034303nocode: gtk_image_menu_item_new_with_label 
    43044304nocode: gtk_image_menu_item_new_with_mnemonic 
     4305nocode: gtk_image_menu_item_new_from_stock 
    43054306 
    43064307code: start 
     
    43274328            this(cast(GtkImageMenuItem*)gtk_image_menu_item_new_with_label(Str.toStringz(label)) ); 
    43284329        } 
     4330    } 
     4331 
     4332    /** 
     4333     * Creates a new GtkImageMenuItem containing the image and text from a 
     4334     * stock item. Some stock ids have preprocessor macros like GTK_STOCK_OK 
     4335     * and GTK_STOCK_APPLY. 
     4336     * If you want this menu item to have changeable accelerators, then pass in 
     4337     * NULL for accel_group. Next call gtk_menu_item_set_accel_path() with an 
     4338     * appropriate path for the menu item, use gtk_stock_lookup() to look up the 
     4339     * standard accelerator for the stock item, and if one is found, call 
     4340     * gtk_accel_map_add_entry() to register it. 
     4341     * Params: 
     4342     * StockID = the name of the stock item 
     4343     * accelGroup =  the GtkAccelGroup to add the menu items accelerator to, 
     4344     *  or NULL. 
     4345     */ 
     4346    public this (StockID stockID, AccelGroup accelGroup) 
     4347    { 
     4348        // GtkWidget* gtk_image_menu_item_new_from_stock (const gchar *stock_id,  GtkAccelGroup *accel_group); 
     4349        auto p = gtk_image_menu_item_new_from_stock(Str.toStringz(StockDesc[stockID]), (accelGroup is null) ? null : accelGroup.getAccelGroupStruct()); 
     4350        if(p is null) 
     4351        { 
     4352            throw new Exception("Construction failure."); 
     4353        } 
     4354        this(cast(GtkImageMenuItem*) p); 
    43294355    } 
    43304356code: end