Changeset 55

Show
Ignore:
Timestamp:
05/16/07 16:40:23 (2 years ago)
Author:
lindquist
Message:

fixed some gtk layout problems and an incorrect gcallback prototype.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/bughunt/minwin/window.d

    r54 r55  
    486486                req.height = 0; 
    487487            } 
     488            if (menubar) { 
     489                GtkRequisition r2; 
     490                gtk_widget_size_request(cast(GtkWidget*)menubar.peer,&r2); 
     491                req.height += r2.height; 
     492            } 
    488493            version(LOG)log.writefln("done gtkRequest for toplevel window"); 
    489494        } 
     
    499504            childLayoutDirty = false; 
    500505            version(LOG)log.writefln("done gtkAllocate for toplevel window"); 
     506        } 
     507 
     508        void getLayoutBounds(inout Rect r) { 
     509            GtkWidget* w = cast(GtkWidget*)content; 
     510            r = toRect(w.allocation); 
     511            if (menubar) { 
     512                GtkRequisition req; 
     513                gtk_widget_size_request(cast(GtkWidget*)menubar.peer,&req); 
     514                r.height = r.height - req.height; 
     515            } 
    501516        } 
    502517 
     
    692707                    cast(GCallback)&mw_destroy_callback, 
    693708                    cast(gpointer)this, 
    694                     null,GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0); 
     709                    null,cast(GConnectFlags)0);//null,GConnectFlags.G_CONNECT_AFTER); 
    695710            g_signal_connect_data(peer,"delete-event", 
    696711                    cast(GCallback)&mw_close_callback, 
    697712                    cast(gpointer)this, 
    698                     null,GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0); 
     713                    null,cast(GConnectFlags)0); 
    699714            g_signal_connect_data(peer,"configure-event", 
    700715                    cast(GCallback)&mw_notify_callback, 
    701716                    cast(gpointer)this, 
    702                     null,GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0); 
     717                    null,cast(GConnectFlags)0); 
    703718            setWindowPeer(this,peer,OWNS_PEER); 
    704719            WindowList[this] = this; // prevent garbage collection 
     
    736751            gtk_widget_realize(wcontent); 
    737752            gtk_widget_show(wcontent); 
     753            gtk_widget_realize(cast(GtkWidget*)peer); 
     754            gtk_widget_show(cast(GtkWidget*)peer); 
    738755        } 
    739756 
     
    821838    } 
    822839 
    823     extern (C) void mw_notify_callback(GtkWidget* w, GdkEvent* ev, gpointer ud) { 
     840    extern (C) gboolean mw_notify_callback(GtkWidget* w, GdkEvent* ev, gpointer ud) { 
    824841        Window win = cast(Window) ud; 
    825842        if (win && ev.type == GdkEventType.GDK_CONFIGURE) { 
     
    828845            } 
    829846        } 
     847        return false; 
    830848    } 
    831849 
  • branches/bughunt/samples/notepad.d

    r40 r55  
    88 
    99import minwin.all; 
     10import std.stdio; 
     11version(LOG) import minwin.logging; 
    1012 
    1113extern(C) 
    1214int MinWinMain(Application* app) { 
    13     Window win = new Window("MinWin Notepad"); 
     15    auto win = new Window("MinWin Notepad"); 
    1416    win.quitOnDestroy = true; 
    1517 
    16     auto layout = new FlowLayout; 
    17     layout.sideStretch = true; 
    18     win.layoutMgr = layout; 
    19  
    20     MenuBar menubar = new MenuBar(win); 
    21     Menu menu = new Menu(menubar, "File"); 
    2218    enum File { 
    2319        Open, 
     
    2521        Quit 
    2622    } 
     23    auto menubar = new MenuBar(win); 
     24    auto menu = new Menu(menubar, "File"); 
    2725    menu.add("Open file", File.Open); 
    2826    menu.add("Save file", File.Save); 
    2927    menu.add("Quit", File.Quit); 
    3028 
    31     MultiLineText text = new MultiLineText(win); 
    32     text.userPreferredSize(win.width, win.height); 
     29    auto tab = new TableLayout([1.0],[1.0]); 
     30    win.layoutMgr = tab; 
     31    auto text = new MultiLineText(win); 
    3332 
    3433    win.commandDelegate ~= (Component c, int cmd) { 
     
    4847    }; 
    4948 
    50     win.windowDelegate ~= (Component c, WindowEvent* e) { 
    51         text.userPreferredSize(c.width,c.height); 
    52         win.childLayoutDirty = true; 
    53     }; 
    54  
    5549    win.pack(); 
    56     win.visible = true; 
    5750    return app.enterEventLoop(); 
    5851} 
    5952 
    6053void openFile(Window win, MultiLineText text) { 
    61  
    6254} 
    6355