1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD 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 3 of the License, or
7  * (at your option) any later version.
8  *
9  * gtkD 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.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with gtkD; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
17  */
18 
19 module TestStock;
20 
21 private import gtk.ScrolledWindow;
22 
23 private import gtk.Widget;
24 private import gtk.Table;
25 private import gtk.Button;
26 private import gtk.Tooltip;
27 
28 private import gdk.Color;
29 private import gdk.Cursor;
30 
31 private import gdk.Event;
32 
33 /**
34  * This tests the gtkD the Stock images in button
35  */
36 class TestStock : ScrolledWindow
37 {
38 
39 	this()
40 	{
41 		super(null, null);
42 		debug(1)
43 		{
44 			printf("instantiating TestStock\n");
45 		}
46 
47 		Table table = new Table(2,2,false);
48 		int col = 0;
49 		int row = 0;
50 
51 		Color color = new Color(cast(ubyte)0,cast(ubyte)255,cast(ubyte)255);
52 
53 		IconSize size = Button.getIconSize();
54 		Button.setIconSize(IconSize.DIALOG);
55 		for(StockID stockID=StockID.min ; stockID<=StockID.max ; stockID++)
56 		{
57 			Button button = new Button(stockID, true);
58 			button.setTooltipText(StockDesc[stockID]);
59 
60 			//button.setCursor(CursorType.BASED_ARROW_DOWN);
61 			//button.setBackground(color);
62 			//Cursor cursor = new Cursor(CursorType.CLOCK);
63 			//button.setCursor(cursor);
64 
65 //			button.addOnEnterNotify(&enterNotify);
66 //			button.addOnLeaveNotify(&leaveNotify);
67 
68 
69 			table.attach(button,col,col+1,row,row+1,AttachOptions.SHRINK,AttachOptions.SHRINK,2,2);
70 			++row;
71 			if ( row == 16 )
72 			{
73 				row = 0;
74 				++col;
75 			}
76 		}
77 
78 		Button.setIconSize(size);
79 		addWithViewport(table);
80 
81 	}
82 
83 //	bit enterNotify(Widget widget, EventCrossing event)
84 //	{
85 //		printf("TestStock.mouseEnterNotify %X\n",widget);
86 //		Cursor cursor = new Cursor(CursorType.MAN);
87 //		widget.setCursor(cursor);
88 //		return true;
89 //	}
90 //	bit leaveNotify(Widget widget, EventCrossing event)
91 //	{
92 //		printf("TestStock.mouseLeaveNotify\n");
93 //		widget.resetCursor();
94 //		return true;
95 //	}
96 
97 
98 }