1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
/*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
module TestStock;
import std.traits;
private import gtk.ScrolledWindow;
private import gtk.Widget;
private import gtk.Table;
private import gtk.Button;
private import gtk.Tooltip;
private import gdk.Color;
private import gdk.Cursor;
private import gdk.Event;
debug import std.stdio;
/**
* This tests the gtkD the Stock images in button
*/
class TestStock : ScrolledWindow
{
this()
{
super(null, null);
debug(1)
{
writeln("instantiating TestStock");
}
Table table = new Table(2,2,false);
int col = 0;
int row = 0;
Color color = new Color(cast(ubyte)0,cast(ubyte)255,cast(ubyte)255);
IconSize size = Button.getIconSize();
Button.setIconSize(IconSize.DIALOG);
// WORKAROUND: https://issues.dlang.org/show_bug.cgi?id=14214
foreach(StockID stockID; [EnumMembers!StockID])
{
Button button = new Button(stockID, true);
button.setTooltipText(cast(string)stockID);
//button.setCursor(CursorType.BASED_ARROW_DOWN);
//button.setBackground(color);
//Cursor cursor = new Cursor(CursorType.CLOCK);
//button.setCursor(cursor);
// button.addOnEnterNotify(&enterNotify);
// button.addOnLeaveNotify(&leaveNotify);
table.attach(button,col,col+1,row,row+1,AttachOptions.SHRINK,AttachOptions.SHRINK,2,2);
++row;
if ( row == 16 )
{
row = 0;
++col;
}
}
Button.setIconSize(size);
addWithViewport(table);
}
// bit enterNotify(Widget widget, EventCrossing event)
// {
// writefln("TestStock.mouseEnterNotify %X",widget);
// Cursor cursor = new Cursor(CursorType.MAN);
// widget.setCursor(cursor);
// return true;
// }
// bit leaveNotify(Widget widget, EventCrossing event)
// {
// writefln("TestStock.mouseLeaveNotify");
// widget.resetCursor();
// return true;
// }
}
|