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 import std.traits; 22 23 private import gtk.ScrolledWindow; 24 25 private import gtk.Widget; 26 private import gtk.Table; 27 private import gtk.Button; 28 private import gtk.Tooltip; 29 30 private import gdk.Color; 31 private import gdk.Cursor; 32 33 private import gdk.Event; 34 35 /** 36 * This tests the gtkD the Stock images in button 37 */ 38 class TestStock : ScrolledWindow 39 { 40 41 this() 42 { 43 super(null, null); 44 debug(1) 45 { 46 writeln("instantiating TestStock"); 47 } 48 49 Table table = new Table(2,2,false); 50 int col = 0; 51 int row = 0; 52 53 Color color = new Color(cast(ubyte)0,cast(ubyte)255,cast(ubyte)255); 54 55 IconSize size = Button.getIconSize(); 56 Button.setIconSize(IconSize.DIALOG); 57 foreach(StockID stockID; EnumMembers!StockID) 58 { 59 Button button = new Button(stockID, true); 60 button.setTooltipText(cast(string)stockID); 61 62 //button.setCursor(CursorType.BASED_ARROW_DOWN); 63 //button.setBackground(color); 64 //Cursor cursor = new Cursor(CursorType.CLOCK); 65 //button.setCursor(cursor); 66 67 // button.addOnEnterNotify(&enterNotify); 68 // button.addOnLeaveNotify(&leaveNotify); 69 70 71 table.attach(button,col,col+1,row,row+1,AttachOptions.SHRINK,AttachOptions.SHRINK,2,2); 72 ++row; 73 if ( row == 16 ) 74 { 75 row = 0; 76 ++col; 77 } 78 } 79 80 Button.setIconSize(size); 81 addWithViewport(table); 82 83 } 84 85 // bit enterNotify(Widget widget, EventCrossing event) 86 // { 87 // writeln("TestStock.mouseEnterNotify %X",widget); 88 // Cursor cursor = new Cursor(CursorType.MAN); 89 // widget.setCursor(cursor); 90 // return true; 91 // } 92 // bit leaveNotify(Widget widget, EventCrossing event) 93 // { 94 // writeln("TestStock.mouseLeaveNotify"); 95 // widget.resetCursor(); 96 // return true; 97 // } 98 99 100 }