annotate dwt/widgets/TreeColumn.d @ 259:c0d810de7093

Update SWT 3.4M7 to 3.4
author Frank Benoit <benoit@tionex.de>
date Sun, 29 Jun 2008 14:33:38 +0200
parents 5a30aa9820f3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
115
52b32f5cb1e0 many file checked for switch default
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
1 /*******************************************************************************
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
108
0f12f6bb9739 author notice
Frank Benoit <benoit@tionex.de>
parents: 90
diff changeset
10 * Port to the D programming language:
0f12f6bb9739 author notice
Frank Benoit <benoit@tionex.de>
parents: 90
diff changeset
11 * Frank Benoit <benoit@tionex.de>
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 *******************************************************************************/
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 module dwt.widgets.TreeColumn;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
15 import dwt.dwthelper.utils;
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
16
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19 import dwt.DWT;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 import dwt.DWTException;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 import dwt.events.ControlListener;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 import dwt.events.SelectionEvent;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 import dwt.events.SelectionListener;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 import dwt.graphics.Image;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25 import dwt.internal.gtk.OS;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 import dwt.widgets.Item;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 import dwt.widgets.Tree;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28 import dwt.widgets.Shell;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 import dwt.widgets.ImageList;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 import dwt.widgets.TypedListener;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 import Math = tango.math.Math;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 * Instances of this class represent a column in a tree widget.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 * <p><dl>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 * <dt><b>Styles:</b></dt>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 * <dd>LEFT, RIGHT, CENTER</dd>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 * <dt><b>Events:</b></dt>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 * <dd> Move, Resize, Selection</dd>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 * </dl>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 * </p><p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 * Note: Only one of the styles LEFT, RIGHT and CENTER may be specified.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 * </p><p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 * IMPORTANT: This class is <em>not</em> intended to be subclassed.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 * </p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 *
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
48 * @see <a href="http://www.eclipse.org/swt/snippets/#tree">Tree, TreeItem, TreeColumn snippets</a>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
49 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
50 *
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 * @since 3.1
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 public class TreeColumn : Item {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54 GtkWidget* labelHandle, imageHandle, buttonHandle;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 Tree parent;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 int modelIndex, lastButton, lastTime, lastX, lastWidth;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 bool customDraw, useFixedWidth;
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
58 String toolTipText;
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 * Constructs a new instance of this class given its parent
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 * (which must be a <code>Tree</code>) and a style value
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
63 * describing its behavior and appearance. The item is added
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
64 * to the end of the items maintained by its parent.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
65 * <p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
66 * The style value is either one of the style constants defined in
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 * class <code>DWT</code> which is applicable to instances of this
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68 * class, or must be built by <em>bitwise OR</em>'ing together
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 * (that is, using the <code>int</code> "|" operator) two or more
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 * of those <code>DWT</code> style constants. The class description
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 * lists the style constants that are applicable to the class.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72 * Style bits are also inherited from superclasses.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73 * </p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75 * @param parent a composite control which will be the parent of the new instance (cannot be null)
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 * @param style the style of control to construct
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
79 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
80 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
81 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
82 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
83 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
84 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
85 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
86 * @see DWT#LEFT
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
87 * @see DWT#RIGHT
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 * @see DWT#CENTER
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89 * @see Widget#checkSubclass
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90 * @see Widget#getStyle
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 public this (Tree parent, int style) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 super (parent, checkStyle (style));
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94 this.parent = parent;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 createWidget (parent.getColumnCount ());
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99 * Constructs a new instance of this class given its parent
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 * (which must be a <code>Tree</code>), a style value
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 * describing its behavior and appearance, and the index
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 * at which to place it in the items maintained by its parent.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 * <p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104 * The style value is either one of the style constants defined in
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 * class <code>DWT</code> which is applicable to instances of this
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 * class, or must be built by <em>bitwise OR</em>'ing together
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 * (that is, using the <code>int</code> "|" operator) two or more
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108 * of those <code>DWT</code> style constants. The class description
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109 * lists the style constants that are applicable to the class.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 * Style bits are also inherited from superclasses.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 * </p>
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
112 * <p>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
113 * Note that due to a restriction on some platforms, the first column
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
114 * is always left aligned.
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
115 * </p>
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
116 * @param parent a composite control which will be the parent of the new instance (cannot be null)
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
117 * @param style the style of control to construct
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
118 * @param index the zero-relative index to store the receiver in its parent
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
119 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
120 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
121 * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
122 * <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the parent (inclusive)</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
123 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
124 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
125 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
126 * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
127 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
128 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
129 * @see DWT#LEFT
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
130 * @see DWT#RIGHT
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
131 * @see DWT#CENTER
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
132 * @see Widget#checkSubclass
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
133 * @see Widget#getStyle
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
134 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
135 public this (Tree parent, int style, int index) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
136 super (parent, checkStyle (style));
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
137 this.parent = parent;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
138 createWidget (index);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
139 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
140
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
141 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
142 * Adds the listener to the collection of listeners who will
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
143 * be notified when the control is moved or resized, by sending
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
144 * it one of the messages defined in the <code>ControlListener</code>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
145 * interface.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
146 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
147 * @param listener the listener which should be notified
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
148 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
149 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
150 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
151 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
152 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
153 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
154 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
155 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
156 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
157 * @see ControlListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
158 * @see #removeControlListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
159 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
160 public void addControlListener(ControlListener listener) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
161 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
162 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
163 TypedListener typedListener = new TypedListener (listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
164 addListener (DWT.Resize,typedListener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
165 addListener (DWT.Move,typedListener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
166 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
167
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
168 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
169 * Adds the listener to the collection of listeners who will
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
170 * be notified when the control is selected by the user, by sending
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
171 * it one of the messages defined in the <code>SelectionListener</code>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
172 * interface.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
173 * <p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
174 * <code>widgetSelected</code> is called when the column header is selected.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
175 * <code>widgetDefaultSelected</code> is not called.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
176 * </p>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
177 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
178 * @param listener the listener which should be notified when the control is selected by the user
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
179 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
180 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
181 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
182 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
183 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
184 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
185 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
186 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
187 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
188 * @see SelectionListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
189 * @see #removeSelectionListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
190 * @see SelectionEvent
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
191 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
192 public void addSelectionListener (SelectionListener listener) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
193 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
194 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
195 TypedListener typedListener = new TypedListener (listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
196 addListener (DWT.Selection,typedListener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
197 addListener (DWT.DefaultSelection,typedListener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
198 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
199
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
200 static int checkStyle (int style) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
201 return checkBits (style, DWT.LEFT, DWT.CENTER, DWT.RIGHT, 0, 0, 0);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
202 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
203
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
204 protected void checkSubclass () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
205 if (!isValidSubclass ()) error (DWT.ERROR_INVALID_SUBCLASS);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
206 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
207
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
208 void createWidget (int index) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
209 parent.createItem (this, index);
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
210 setOrientation ();
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
211 hookEvents ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
212 register ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
213 text = "";
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
214 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
215
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
216 void deregister() {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
217 super.deregister ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
218 display.removeWidget (handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
219 if (buttonHandle !is null) display.removeWidget (buttonHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
220 if (labelHandle !is null) display.removeWidget (labelHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
221 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
222
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
223 void destroyWidget () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
224 parent.destroyItem (this);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
225 releaseHandle ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
226 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
227
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
228 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
229 * Returns a value which describes the position of the
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
230 * text or image in the receiver. The value will be one of
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
231 * <code>LEFT</code>, <code>RIGHT</code> or <code>CENTER</code>.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
232 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
233 * @return the alignment
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
234 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
235 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
236 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
237 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
238 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
239 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
240 public int getAlignment () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
241 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
242 if ((style & DWT.LEFT) !is 0) return DWT.LEFT;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
243 if ((style & DWT.CENTER) !is 0) return DWT.CENTER;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
244 if ((style & DWT.RIGHT) !is 0) return DWT.RIGHT;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
245 return DWT.LEFT;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
246 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
247
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
248 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
249 * Gets the moveable attribute. A column that is
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
250 * not moveable cannot be reordered by the user
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
251 * by dragging the header but may be reordered
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
252 * by the programmer.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
253 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
254 * @return the moveable attribute
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
255 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
256 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
257 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
258 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
259 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
260 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
261 * @see Tree#getColumnOrder()
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
262 * @see Tree#setColumnOrder(int[])
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
263 * @see TreeColumn#setMoveable(bool)
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
264 * @see DWT#Move
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
265 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
266 * @since 3.2
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
267 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
268 public bool getMoveable() {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
269 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
270 return cast(bool)OS.gtk_tree_view_column_get_reorderable (handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
271 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
272
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
273 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
274 * Returns the receiver's parent, which must be a <code>Tree</code>.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
275 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
276 * @return the receiver's parent
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
277 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
278 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
279 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
280 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
281 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
282 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
283 public Tree getParent () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
284 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
285 return parent;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
286 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
287
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
288 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
289 * Gets the resizable attribute. A column that is
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
290 * not resizable cannot be dragged by the user but
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
291 * may be resized by the programmer.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
292 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
293 * @return the resizable attribute
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
294 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
295 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
296 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
297 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
298 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
299 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
300 public bool getResizable () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
301 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
302 return cast(bool)OS.gtk_tree_view_column_get_resizable (handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
303 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
304
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
305 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
306 * Returns the receiver's tool tip text, or null if it has
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
307 * not been set.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
308 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
309 * @return the receiver's tool tip text
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
310 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
311 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
312 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
313 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
314 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
315 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
316 * @since 3.2
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
317 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
318 public String getToolTipText () {
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
319 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
320 return toolTipText;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
321 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
322
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
323 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
324 * Gets the width of the receiver.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
325 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
326 * @return the width
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
327 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
328 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
329 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
330 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
331 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
332 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
333 public int getWidth () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
334 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
335 if (!OS.gtk_tree_view_column_get_visible (handle)) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
336 return 0;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
337 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
338 if (useFixedWidth) return OS.gtk_tree_view_column_get_fixed_width (handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
339 return OS.gtk_tree_view_column_get_width (handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
340 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
341
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
342 override int gtk_clicked (GtkWidget* widget) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
343 /*
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
344 * There is no API to get a double click on a table column. Normally, when
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
345 * the mouse is double clicked, this is indicated by GDK_2BUTTON_PRESS
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
346 * but the table column sends the click signal on button release. The fix is to
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
347 * test for double click by remembering the last click time and mouse button
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
348 * and testing for the double click interval.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
349 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
350 bool doubleClick = false;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
351 bool postEvent_ = true;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
352 auto eventPtr = OS.gtk_get_current_event ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
353 if (eventPtr !is null) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
354 GdkEventButton* gdkEvent = cast(GdkEventButton*)eventPtr;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
355 scope(exit) OS.gdk_event_free (eventPtr);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
356 switch (gdkEvent.type) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
357 case OS.GDK_BUTTON_RELEASE: {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
358 int clickTime = display.getDoubleClickTime ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
359 int eventTime = gdkEvent.time, eventButton = gdkEvent.button;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
360 if (lastButton is eventButton && lastTime !is 0 && Math.abs (lastTime - eventTime) <= clickTime) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
361 doubleClick = true;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
362 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
363 lastTime = eventTime is 0 ? 1: eventTime;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
364 lastButton = eventButton;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
365 break;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
366 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
367 case OS.GDK_MOTION_NOTIFY: {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
368 /*
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
369 * Bug in GTK. Dragging a column in a GtkTreeView causes a clicked
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
370 * signal to be emitted even though the mouse button was never released.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
371 * The fix to ignore the signal if the current GDK event is a motion notify.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
372 * The GTK bug was fixed in version 2.6
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
373 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
374 if (OS.GTK_VERSION < OS.buildVERSION (2, 6, 0)) postEvent_ = false;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
375 break;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
376 }
115
52b32f5cb1e0 many file checked for switch default
Frank Benoit <benoit@tionex.de>
parents: 108
diff changeset
377 default:
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
378 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
379 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
380 if (postEvent_) postEvent (doubleClick ? DWT.DefaultSelection : DWT.Selection);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
381 return 0;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
382 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
383
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
384 override int gtk_mnemonic_activate (GtkWidget* widget, int /*long*/ arg1) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
385 return parent.gtk_mnemonic_activate (widget, arg1);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
386 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
387
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
388 override int gtk_size_allocate (GtkWidget* widget, int allocation) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
389 useFixedWidth = false;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
390 int x = OS.GTK_WIDGET_X (widget);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
391 int width = OS.GTK_WIDGET_WIDTH (widget);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
392 if (x !is lastX) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
393 lastX = x;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
394 sendEvent (DWT.Move);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
395 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
396 if (width !is lastWidth) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
397 lastWidth = width;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
398 sendEvent (DWT.Resize);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
399 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
400 return 0;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
401 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
402
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
403 void hookEvents () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
404 super.hookEvents ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
405 OS.g_signal_connect_closure (handle, OS.clicked.ptr, display.closures [CLICKED], false);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
406 if (buttonHandle !is null) OS.g_signal_connect_closure_by_id (buttonHandle, display.signalIds [SIZE_ALLOCATE], 0, display.closures [SIZE_ALLOCATE], false);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
407 if (labelHandle !is null) OS.g_signal_connect_closure_by_id (labelHandle, display.signalIds [MNEMONIC_ACTIVATE], 0, display.closures [MNEMONIC_ACTIVATE], false);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
408 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
409
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
410 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
411 * Causes the receiver to be resized to its preferred size.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
412 * For a composite, this involves computing the preferred size
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
413 * from its layout, if there is one.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
414 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
415 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
416 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
417 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
418 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
419 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
420 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
421 public void pack () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
422 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
423 int width = 0;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
424 if (buttonHandle !is null) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
425 GtkRequisition requisition;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
426 OS.gtk_widget_size_request (buttonHandle, &requisition);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
427 width = requisition.width;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
428 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
429 if ((parent.style & DWT.VIRTUAL) !is 0) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
430 //NOT DONE
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
431 } else {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
432 GtkTreeIter iter;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
433 if (OS.gtk_tree_model_get_iter_first (parent.modelHandle, &iter)) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
434 do {
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
435 width = Math.max (width, parent.calculateWidth (cast(GtkTreeViewColumn*)handle, &iter, true));
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
436 } while (OS.gtk_tree_model_iter_next(parent.modelHandle, &iter));
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
437 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
438 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
439 setWidth(width);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
440 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
441
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
442 void register () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
443 super.register ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
444 display.addWidget (handle, this);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
445 if (buttonHandle !is null) display.addWidget (buttonHandle, this);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
446 if (labelHandle !is null) display.addWidget (labelHandle, this);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
447 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
448
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
449 void releaseHandle () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
450 super.releaseHandle ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
451 handle = buttonHandle = labelHandle = imageHandle = null;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
452 modelIndex = -1;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
453 parent = null;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
454 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
455
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
456 void releaseParent () {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
457 super.releaseParent ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
458 if (parent.sortColumn is this) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
459 parent.sortColumn = null;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
460 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
461 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
462
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
463 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
464 * Removes the listener from the collection of listeners who will
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
465 * be notified when the control is moved or resized.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
466 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
467 * @param listener the listener which should no longer be notified
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
468 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
469 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
470 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
471 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
472 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
473 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
474 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
475 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
476 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
477 * @see ControlListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
478 * @see #addControlListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
479 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
480 public void removeControlListener (ControlListener listener) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
481 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
482 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
483 if (eventTable is null) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
484 eventTable.unhook (DWT.Move, listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
485 eventTable.unhook (DWT.Resize, listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
486 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
487
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
488 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
489 * Removes the listener from the collection of listeners who will
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
490 * be notified when the control is selected by the user.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
491 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
492 * @param listener the listener which should no longer be notified
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
493 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
494 * @exception IllegalArgumentException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
495 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
496 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
497 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
498 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
499 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
500 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
501 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
502 * @see SelectionListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
503 * @see #addSelectionListener
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
504 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
505 public void removeSelectionListener(SelectionListener listener) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
506 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
507 if (listener is null) error (DWT.ERROR_NULL_ARGUMENT);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
508 if (eventTable is null) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
509 eventTable.unhook (DWT.Selection, listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
510 eventTable.unhook (DWT.DefaultSelection,listener);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
511 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
512
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
513 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
514 * Controls how text and images will be displayed in the receiver.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
515 * The argument should be one of <code>LEFT</code>, <code>RIGHT</code>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
516 * or <code>CENTER</code>.
259
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
517 * <p>
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
518 * Note that due to a restriction on some platforms, the first column
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
519 * is always left aligned.
c0d810de7093 Update SWT 3.4M7 to 3.4
Frank Benoit <benoit@tionex.de>
parents: 255
diff changeset
520 * </p>
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
521 * @param alignment the new alignment
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
522 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
523 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
524 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
525 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
526 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
527 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
528 public void setAlignment (int alignment) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
529 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
530 if ((alignment & (DWT.LEFT | DWT.RIGHT | DWT.CENTER)) is 0) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
531 int index = parent.indexOf (this);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
532 if (index is -1 || index is 0) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
533 style &= ~(DWT.LEFT | DWT.RIGHT | DWT.CENTER);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
534 style |= alignment & (DWT.LEFT | DWT.RIGHT | DWT.CENTER);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
535 parent.createRenderers (cast(GtkTreeViewColumn*)handle, modelIndex, index is 0, style);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
536 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
537
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
538 void setFontDescription (PangoFontDescription* font) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
539 OS.gtk_widget_modify_font (labelHandle, font);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
540 OS.gtk_widget_modify_font (imageHandle, font);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
541 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
542
150
f2e04420fd6c reworked overrides and superclass aliases
Frank Benoit <benoit@tionex.de>
parents: 115
diff changeset
543 public override void setImage (Image image) {
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
544 checkWidget ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
545 super.setImage (image);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
546 if (image !is null) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
547 ImageList headerImageList = parent.headerImageList;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
548 if (headerImageList is null) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
549 headerImageList = parent.headerImageList = new ImageList ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
550 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
551 int imageIndex = headerImageList.indexOf (image);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
552 if (imageIndex is -1) imageIndex = headerImageList.add (image);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
553 auto pixbuf = headerImageList.getPixbuf (imageIndex);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
554 OS.gtk_image_set_from_pixbuf (imageHandle, pixbuf);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
555 OS.gtk_widget_show (imageHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
556 } else {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
557 OS.gtk_image_set_from_pixbuf (imageHandle, null);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
558 OS.gtk_widget_hide (imageHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
559 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
560 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
561
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
562 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
563 * Sets the moveable attribute. A column that is
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
564 * moveable can be reordered by the user by dragging
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
565 * the header. A column that is not moveable cannot be
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
566 * dragged by the user but may be reordered
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
567 * by the programmer.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
568 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
569 * @param moveable the moveable attribute
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
570 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
571 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
572 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
573 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
574 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
575 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
576 * @see Tree#setColumnOrder(int[])
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
577 * @see Tree#getColumnOrder()
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
578 * @see TreeColumn#getMoveable()
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
579 * @see DWT#Move
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
580 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
581 * @since 3.2
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
582 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
583 public void setMoveable (bool moveable) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
584 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
585 OS.gtk_tree_view_column_set_reorderable (handle, moveable);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
586 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
587
240
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
588 void setOrientation() {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
589 if ((parent.style & DWT.RIGHT_TO_LEFT) !is 0) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
590 if (buttonHandle !is null) {
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
591 OS.gtk_widget_set_direction (buttonHandle, OS.GTK_TEXT_DIR_RTL);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
592 display.doSetDirectionProc(buttonHandle, OS.GTK_TEXT_DIR_RTL);
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
593 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
594 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
595 }
ce446666f5a2 Update to SWT 3.4M7
Frank Benoit <benoit@tionex.de>
parents: 238
diff changeset
596
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
597 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
598 * Sets the resizable attribute. A column that is
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
599 * not resizable cannot be dragged by the user but
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
600 * may be resized by the programmer.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
601 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
602 * @param resizable the resize attribute
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
603 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
604 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
605 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
606 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
607 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
608 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
609 public void setResizable (bool resizable) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
610 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
611 OS.gtk_tree_view_column_set_resizable (handle, resizable);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
612 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
613
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
614 public override void setText (String string) {
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
615 checkWidget();
255
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 248
diff changeset
616 // DWT extension: allow null for zero length string
5a30aa9820f3 removed tango.stdc.stringz imports and allow null for arrays and string arguments.
Frank Benoit <benoit@tionex.de>
parents: 248
diff changeset
617 //if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
618 super.setText (string);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
619 char [] chars = fixMnemonic (string);
248
34409a2fc053 Fix call OS.gtk_label_set_text_with_mnemonic with valid ptr, even for zero length strings.
Frank Benoit <benoit@tionex.de>
parents: 240
diff changeset
620 OS.gtk_label_set_text_with_mnemonic (labelHandle, chars.toStringzValidPtr());
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
621 if (string.length !is 0) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
622 OS.gtk_widget_show (labelHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
623 } else {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
624 OS.gtk_widget_hide (labelHandle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
625 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
626 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
627
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
628 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
629 * Sets the receiver's tool tip text to the argument, which
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
630 * may be null indicating that no tool tip text should be shown.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
631 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
632 * @param string the new tool tip text (or null)
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
633 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
634 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
635 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
636 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
637 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
638 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
639 * @since 3.2
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
640 */
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
641 public void setToolTipText (String string) {
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
642 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
643 Shell shell = parent._getShell ();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
644 setToolTipText (shell, string);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
645 toolTipText = string;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
646 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
647
238
380bad9f6852 reverted char[] to String
Frank Benoit <benoit@tionex.de>
parents: 150
diff changeset
648 void setToolTipText (Shell shell, String newString) {
90
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
649 shell.setToolTipText (buttonHandle, newString);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
650 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
651
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
652 /**
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
653 * Sets the width of the receiver.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
654 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
655 * @param width the new width
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
656 *
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
657 * @exception DWTException <ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
658 * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
659 * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
660 * </ul>
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
661 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
662 public void setWidth (int width) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
663 checkWidget();
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
664 if (width < 0) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
665 if (width is lastWidth) return;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
666 if (width > 0) {
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
667 useFixedWidth = true;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
668 OS.gtk_tree_view_column_set_fixed_width (handle, width);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
669 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
670 /*
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
671 * Bug in GTK. For some reason, calling gtk_tree_view_column_set_visible()
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
672 * when the parent is not realized fails to show the column. The fix is to
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
673 * ensure that the table has been realized.
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
674 */
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
675 if (width !is 0) OS.gtk_widget_realize (parent.handle);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
676 OS.gtk_tree_view_column_set_visible (handle, width !is 0);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
677 lastWidth = width;
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
678 sendEvent (DWT.Resize);
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
679 }
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
680
9ba02d7fb226 Tree, TreeItem and TreeColumn
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
681 }