Changeset 55
- Timestamp:
- 05/16/07 16:40:23 (2 years ago)
- Files:
-
- branches/bughunt/minwin/window.d (modified) (6 diffs)
- branches/bughunt/samples/notepad.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/bughunt/minwin/window.d
r54 r55 486 486 req.height = 0; 487 487 } 488 if (menubar) { 489 GtkRequisition r2; 490 gtk_widget_size_request(cast(GtkWidget*)menubar.peer,&r2); 491 req.height += r2.height; 492 } 488 493 version(LOG)log.writefln("done gtkRequest for toplevel window"); 489 494 } … … 499 504 childLayoutDirty = false; 500 505 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 } 501 516 } 502 517 … … 692 707 cast(GCallback)&mw_destroy_callback, 693 708 cast(gpointer)this, 694 null, GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0);709 null,cast(GConnectFlags)0);//null,GConnectFlags.G_CONNECT_AFTER); 695 710 g_signal_connect_data(peer,"delete-event", 696 711 cast(GCallback)&mw_close_callback, 697 712 cast(gpointer)this, 698 null, GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0);713 null,cast(GConnectFlags)0); 699 714 g_signal_connect_data(peer,"configure-event", 700 715 cast(GCallback)&mw_notify_callback, 701 716 cast(gpointer)this, 702 null, GConnectFlags.G_CONNECT_AFTER);//null,cast(GConnectFlags)0);717 null,cast(GConnectFlags)0); 703 718 setWindowPeer(this,peer,OWNS_PEER); 704 719 WindowList[this] = this; // prevent garbage collection … … 736 751 gtk_widget_realize(wcontent); 737 752 gtk_widget_show(wcontent); 753 gtk_widget_realize(cast(GtkWidget*)peer); 754 gtk_widget_show(cast(GtkWidget*)peer); 738 755 } 739 756 … … 821 838 } 822 839 823 extern (C) voidmw_notify_callback(GtkWidget* w, GdkEvent* ev, gpointer ud) {840 extern (C) gboolean mw_notify_callback(GtkWidget* w, GdkEvent* ev, gpointer ud) { 824 841 Window win = cast(Window) ud; 825 842 if (win && ev.type == GdkEventType.GDK_CONFIGURE) { … … 828 845 } 829 846 } 847 return false; 830 848 } 831 849 branches/bughunt/samples/notepad.d
r40 r55 8 8 9 9 import minwin.all; 10 import std.stdio; 11 version(LOG) import minwin.logging; 10 12 11 13 extern(C) 12 14 int MinWinMain(Application* app) { 13 Windowwin = new Window("MinWin Notepad");15 auto win = new Window("MinWin Notepad"); 14 16 win.quitOnDestroy = true; 15 17 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");22 18 enum File { 23 19 Open, … … 25 21 Quit 26 22 } 23 auto menubar = new MenuBar(win); 24 auto menu = new Menu(menubar, "File"); 27 25 menu.add("Open file", File.Open); 28 26 menu.add("Save file", File.Save); 29 27 menu.add("Quit", File.Quit); 30 28 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); 33 32 34 33 win.commandDelegate ~= (Component c, int cmd) { … … 48 47 }; 49 48 50 win.windowDelegate ~= (Component c, WindowEvent* e) {51 text.userPreferredSize(c.width,c.height);52 win.childLayoutDirty = true;53 };54 55 49 win.pack(); 56 win.visible = true;57 50 return app.enterEventLoop(); 58 51 } 59 52 60 53 void openFile(Window win, MultiLineText text) { 61 62 54 } 63 55
