alternative to assert
[gtkD.git] / demos / duit / TestStock.d
blob70e653fc2e0a07dbbcb816c0737160f0483a6c35
1 /*
2 * This file is part of dui.
3 *
4 * dui is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * dui is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with dui; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 module duit.TestStock;
21 private import gtk.gtktypes;
23 private import gtk.ScrolledWindow;
25 private import gtk.Widget;
26 private import gtk.Table;
27 private import gtk.ObjectGtk;
28 private import gtk.Button;
30 private import gdk.Color;
31 private import gdk.Cursor;
33 private import gdk.Event;
35 private import gtk.Tooltips;
36 /**
37 * This tests the DUI the Stock images in button
39 class TestStock : ScrolledWindow
42 this()
44 super(null, null);
45 debug(1)
47 printf("instantiating TestStock\n");
50 Table table = new Table(2,2,false);
51 int col = 0;
52 int row = 0;
54 Color color = new Color(cast(ubyte)0,cast(ubyte)255,cast(ubyte)255);
56 IconSize size = Button.getIconSize();
57 Button.setIconSize(IconSize.DIALOG);
58 for(StockID stockID=StockID.min ; stockID<=StockID.max ; stockID++)
60 Button button = new Button(stockID, true);
61 Tooltips tt = new Tooltips();
62 tt.setDelay(0);
63 tt.setTip(button, StockDesc[stockID], StockDesc[stockID]);
64 //button.setCursor(CursorType.BASED_ARROW_DOWN);
65 //button.setBackground(color);
66 //Cursor cursor = new Cursor(CursorType.CLOCK);
67 //button.setCursor(cursor);
69 // button.addOnEnterNotify(&enterNotify);
70 // button.addOnLeaveNotify(&leaveNotify);
73 table.attach(button,col,col+1,row,row+1,AttachOptions.SHRINK,AttachOptions.SHRINK,2,2);
74 ++row;
75 if ( row == 16 )
77 row = 0;
78 ++col;
82 Button.setIconSize(size);
83 addWithViewport(table);
87 // bit enterNotify(Widget widget, EventCrossing event)
88 // {
89 // printf("TestStock.mouseEnterNotify %X\n",widget);
90 // Cursor cursor = new Cursor(CursorType.MAN);
91 // widget.setCursor(cursor);
92 // return true;
93 // }
94 // bit leaveNotify(Widget widget, EventCrossing event)
95 // {
96 // printf("TestStock.mouseLeaveNotify\n");
97 // widget.resetCursor();
98 // return true;
99 // }