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.ObjectGtk; 26 private import gtk.Button; 27 28 private import gdk.Color; 29 private import gdk.Cursor; 30 31 private import gdk.Event; 32 33 private import gtk.Tooltips; 34 /** 35 * This tests the gtkD the Stock images in button 36 */ 37 class TestStock : ScrolledWindow 38 { 39 40 this() 41 { 42 super(null, null); 43 debug(1) 44 { 45 printf("instantiating TestStock\n"); 46 } 47 48 Table table = new Table(2,2,false); 49 int col = 0; 50 int row = 0; 51 52 Color color = new Color(cast(ubyte)0,cast(ubyte)255,cast(ubyte)255); 53 54 IconSize size = Button.getIconSize(); 55 Button.setIconSize(IconSize.DIALOG); 56 for(StockID stockID=StockID.min ; stockID<=StockID.max ; stockID++) 57 { 58 Button button = new Button(stockID, true); 59 Tooltips tt = new Tooltips(); 60 tt.setDelay(0); 61 tt.setTip(button, StockDesc[stockID], StockDesc[stockID]); 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 // printf("TestStock.mouseEnterNotify %X\n",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 // printf("TestStock.mouseLeaveNotify\n"); 95 // widget.resetCursor(); 96 // return true; 97 // } 98 99 100 }