Changeset 147

Show
Ignore:
Timestamp:
04/21/06 01:42:58 (3 years ago)
Author:
Ant
Message:

bug fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demos/gtk/OtherTests.d

    r145 r147  
    2727private import gtk.Duit; 
    2828private import std.stdio; 
     29private import gtk.Image; 
    2930 
    3031private import gdk.typedefs; 
     
    5354        }); 
    5455         
     56        button.addOnPressed(&mousePressed); 
     57        //addOnButtonPress(&mousePressed); 
     58         
    5559        box.add(button); 
    5660        byeLabel = new Label("Bye-bye World"); 
     
    6468         
    6569        timeout = new Timeout(1000, &changeLabel); 
     70    } 
     71     
     72    void mousePressed(Button widget) 
     73    { 
     74        writefln("mousePressed"); 
     75        return false; 
    6676    } 
    6777     
  • trunk/demos/gtk/SpawnTests.d

    r145 r147  
    5151        showAll(); 
    5252    } 
    53      
     53 
    5454    private void setupWindow() 
    5555    { 
    5656        Box main = new VBox(false, 2); 
    57          
     57 
    5858        viewInput = new TextView(); 
    5959        viewOutput = new TextView(); 
    6060        viewError = new TextView(); 
    61          
     61 
    6262        main.packStart(new ScrolledWindow(viewInput), false, false, 2); 
    6363        Button button = new Button("exec", &execInput); 
     
    6565        main.packStart(new ScrolledWindow(viewOutput), true, true, 2); 
    6666        main.packStart(new ScrolledWindow(viewError), false, false, 2); 
    67      
     67 
    6868        setBorderWidth(7); 
    6969        add(main); 
     
    9696    private bool exec(Spawn spawn) 
    9797    { 
     98         
     99        viewOutput.getBuffer().setText(""); 
     100        viewError.getBuffer().setText(""); 
     101         
    98102        int result = spawn.execAsyncWithPipes(); 
    99103     
  • trunk/src/glib/Spawn.d

    r145 r147  
    7272    char[][] argv; 
    7373    char[][] envp; 
    74     GSpawnFlags flags
     74    GSpawnFlags flags = SpawnFlags.SEARCH_PATH
    7575    GSpawnChildSetupFunc childSetup; 
    7676    void* userData; 
     
    169169    { 
    170170        int result = g_spawn_async_with_pipes( 
    171         Str.toStringz(workingDirectory), 
    172         Str.toStringzArray(argv), 
    173         Str.toStringzArray(envp), 
    174         flags, 
    175         childSetup, 
    176         userData, 
    177         &childPid, 
    178         &stdIn, 
    179         &stdOut, 
    180         &stdErr, 
    181         &error 
     171           Str.toStringz(workingDirectory), 
     172           Str.toStringzArray(argv), 
     173           Str.toStringzArray(envp), 
     174           flags, 
     175           childSetup, 
     176           userData, 
     177           &childPid, 
     178           &stdIn, 
     179           &stdOut, 
     180           &stdErr, 
     181           &error 
    182182        ); 
    183183         
  • trunk/src/glib/Str.d

    r145 r147  
    141141        foreach (char[] p; args) 
    142142        { 
    143             argv[argc++] = cast(char*)p
     143            argv[argc++] = cast(char*)(p~'\0')
    144144        } 
    145145        argv[argc] = null; 
  • trunk/src/gtk/Button.d

    r145 r147  
    172172        { 
    173173            this(); 
     174            removeAll(); 
    174175            Image image = new Image(stockID,currentIconSize); 
    175176            add(image); 
  • trunk/src/gtk/MenuToolButton.d

    r145 r147  
    6262private import gtk.Widget; 
    6363private import gtk.Tooltips; 
     64private import gtk.Menu; 
    6465 
    6566/** 
     
    150151     * Since 2.6 
    151152     */ 
    152     public static ToolItem newMenuToolButton(Widget iconWidget, char[] label) 
     153    public this(Widget iconWidget, char[] label) 
    153154    { 
    154155        // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget,  const gchar *label); 
    155         return new ToolItem( gtk_menu_tool_button_new((iconWidget is null) ? null : iconWidget.getWidgetStruct(), Str.toStringz(label)) ); 
     156        this( cast(GtkMenuToolButton*)gtk_menu_tool_button_new( 
     157            (iconWidget is null) ? null : iconWidget.getWidgetStruct(),  
     158            Str.toStringz(label)) 
     159        ); 
    156160    } 
    157161     
     
    166170     * Since 2.6 
    167171     */ 
    168     public static ToolItem newFromStock(char[] stockId) 
     172    public this(StockID stockId) 
    169173    { 
    170174        // GtkToolItem* gtk_menu_tool_button_new_from_stock  (const gchar *stock_id); 
    171         return new ToolItem( gtk_menu_tool_button_new_from_stock(Str.toStringz(stockId)) ); 
    172     } 
    173      
     175        this(  
     176            cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock( 
     177            Str.toStringz(StockDesc[stockId])) 
     178        ); 
     179    } 
     180 
    174181    /** 
    175182     * Sets the GtkMenu that is popped up when the user clicks on the arrow. 
     
    195202     * Since 2.6 
    196203     */ 
    197     public Widget getMenu() 
     204    public Menu getMenu() 
    198205    { 
    199206        // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button); 
    200         return new Widget( gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 
    201     } 
     207        return new Menu( cast(GtkMenu*)gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 
     208    } 
     209     
    202210     
    203211    /** 
     
    239247        gtk_menu_tool_button_set_arrow_tooltip(gtkMenuToolButton, (tooltips is null) ? null : tooltips.getTooltipsStruct(), Str.toStringz(tipText), Str.toStringz(tipPrivate)); 
    240248    } 
     249     
     250    /** 
     251     * Sets the toolTip for the arrow 
     252     * Params: 
     253     *      tipText =    
     254     *      tipPrivate =     
     255     */ 
     256    public void setArrowTooltip(char[] tipText, char[] tipPrivate) 
     257    { 
     258        Tooltips tooltips = new Tooltips(); 
     259        gtk_menu_tool_button_set_arrow_tooltip( 
     260            gtkMenuToolButton,  
     261            (tooltips is null) ? null : tooltips.getTooltipsStruct(),  
     262            Str.toStringz(tipText),  
     263            Str.toStringz(tipPrivate) 
     264            ); 
     265    } 
    241266} 
  • trunk/src/gtk/TextView.d

    r145 r147  
    149149    } 
    150150     
     151private import glib.Str; 
    151152    /** 
    152153     * Simply appends some text to this view 
     
    158159        TextBuffer buf = getBuffer(); 
    159160        TextIter iter = new TextIter(); 
     161        buf = getBuffer(); 
    160162        buf.getEndIter(iter); 
    161163        buf.insert(iter, text); 
  • trunk/src/gtk/Widget.d

    r145 r147  
    9999module gtk.Widget; 
    100100 
     101private import std.stdio; 
     102 
    101103private import gtk.typedefs; 
    102104 
     
    321323    { 
    322324        bit consumed = false; 
    323          
    324325        foreach ( gboolean delegate(GdkEventButton*, Widget) dlg ; widget.onButtonPressListeners ) 
    325326        { 
     
    329330        return consumed; 
    330331    } 
     332     
     333    static int p=0; 
    331334     
    332335    gboolean delegate(GdkEventButton*, Widget)[] onButtonReleaseListeners; 
    333336    void addOnButtonRelease(gboolean delegate(GdkEventButton*, Widget) dlg) 
    334337    { 
    335         if ( !("button-release-event" in connectedSignals) ) 
     338        if ( p++ < 1 ) 
     339        { 
     340             
     341        //if ( !("button-release-event" in connectedSignals) ) 
    336342        { 
    337343            addEvents(GdkEventMask.GDK_BUTTON_RELEASE_MASK); 
     
    346352        } 
    347353        onButtonReleaseListeners ~= dlg; 
     354        } 
    348355    } 
    349356    extern(C) static void callBackButtonRelease(GtkWidget* widgetStruct, GdkEventButton* event, Widget widget) 
    350357    { 
    351358        bit consumed = false; 
    352          
     359 
    353360        foreach ( gboolean delegate(GdkEventButton*, Widget) dlg ; widget.onButtonReleaseListeners ) 
    354361        { 
  • trunk/wrap/APILookupGLib.txt

    r145 r147  
    405405        foreach (char[] p; args) 
    406406        { 
    407             argv[argc++] = cast(char*)p
     407            argv[argc++] = cast(char*)(p~'\0')
    408408        } 
    409409        argv[argc] = null; 
     
    637637    char[][] argv; 
    638638    char[][] envp; 
    639     GSpawnFlags flags
     639    GSpawnFlags flags = SpawnFlags.SEARCH_PATH
    640640    GSpawnChildSetupFunc childSetup;  
    641641    void* userData; 
  • trunk/wrap/APILookupGtk.txt

    r145 r147  
    40014001import: gtk.Tooltips 
    40024002structWrap: GtkTooltips* Tooltips 
     4003import: gtk.Menu 
     4004 
     4005 
     4006nocode: gtk_menu_tool_button_new 
     4007nocode: gtk_menu_tool_button_new_from_stock 
     4008nocode: gtk_menu_tool_button_get_menu 
     4009 
     4010code: start 
     4011    /** 
     4012     * Creates a new GtkMenuToolButton using icon_widget as icon and 
     4013     * label as label. 
     4014     * icon_widget: 
     4015     *  a widget that will be used as icon widget, or NULL 
     4016     * label: 
     4017     *  a string that will be used as label, or NULL 
     4018     * Returns: 
     4019     *  the new GtkMenuToolButton 
     4020     * Since 2.6 
     4021     */ 
     4022    public this(Widget iconWidget, char[] label) 
     4023    { 
     4024        // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget,  const gchar *label); 
     4025        this( cast(GtkMenuToolButton*)gtk_menu_tool_button_new( 
     4026            (iconWidget is null) ? null : iconWidget.getWidgetStruct(),  
     4027            Str.toStringz(label)) 
     4028        ); 
     4029    } 
     4030     
     4031    /** 
     4032     * Creates a new GtkMenuToolButton. 
     4033     * The new GtkMenuToolButton will contain an icon and label from 
     4034     * the stock item indicated by stock_id. 
     4035     * stock_id: 
     4036     *  the name of a stock item 
     4037     * Returns: 
     4038     *  the new GtkMenuToolButton 
     4039     * Since 2.6 
     4040     */ 
     4041    public this(StockID stockId) 
     4042    { 
     4043        // GtkToolItem* gtk_menu_tool_button_new_from_stock  (const gchar *stock_id); 
     4044        this(  
     4045            cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock( 
     4046            Str.toStringz(StockDesc[stockId])) 
     4047        ); 
     4048    } 
     4049 
     4050    /** 
     4051     * Gets the GtkMenu associated with GtkMenuToolButton. 
     4052     * button: 
     4053     *  a GtkMenuToolButton 
     4054     * Returns: 
     4055     *  the GtkMenu associated with GtkMenuToolButton 
     4056     * Since 2.6 
     4057     */ 
     4058    public Menu getMenu() 
     4059    { 
     4060        // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button); 
     4061        return new Menu( cast(GtkMenu*)gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 
     4062    } 
     4063     
     4064    /** 
     4065     * Sets the toolTip for the arrow 
     4066     * Params: 
     4067     *      tipText =    
     4068     *      tipPrivate =     
     4069     */ 
     4070    public void setArrowTooltip(char[] tipText, char[] tipPrivate) 
     4071    { 
     4072        Tooltips tooltips = new Tooltips(); 
     4073        gtk_menu_tool_button_set_arrow_tooltip( 
     4074            gtkMenuToolButton,  
     4075            (tooltips is null) ? null : tooltips.getTooltipsStruct(),  
     4076            Str.toStringz(tipText),  
     4077            Str.toStringz(tipPrivate) 
     4078            ); 
     4079    } 
     4080 
     4081code: end 
     4082 
    40034083outFile: MenuToolButton 
    40044084