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