Changeset 147
- Timestamp:
- 04/21/06 01:42:58 (3 years ago)
- Files:
-
- trunk/demos/gtk/OtherTests.d (modified) (3 diffs)
- trunk/demos/gtk/SpawnTests.d (modified) (3 diffs)
- trunk/src/glib/Spawn.d (modified) (2 diffs)
- trunk/src/glib/Str.d (modified) (1 diff)
- trunk/src/gtk/Button.d (modified) (1 diff)
- trunk/src/gtk/MenuToolButton.d (modified) (5 diffs)
- trunk/src/gtk/TextView.d (modified) (2 diffs)
- trunk/src/gtk/Widget.d (modified) (4 diffs)
- trunk/wrap/APILookupGLib.txt (modified) (2 diffs)
- trunk/wrap/APILookupGtk.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/demos/gtk/OtherTests.d
r145 r147 27 27 private import gtk.Duit; 28 28 private import std.stdio; 29 private import gtk.Image; 29 30 30 31 private import gdk.typedefs; … … 53 54 }); 54 55 56 button.addOnPressed(&mousePressed); 57 //addOnButtonPress(&mousePressed); 58 55 59 box.add(button); 56 60 byeLabel = new Label("Bye-bye World"); … … 64 68 65 69 timeout = new Timeout(1000, &changeLabel); 70 } 71 72 void mousePressed(Button widget) 73 { 74 writefln("mousePressed"); 75 return false; 66 76 } 67 77 trunk/demos/gtk/SpawnTests.d
r145 r147 51 51 showAll(); 52 52 } 53 53 54 54 private void setupWindow() 55 55 { 56 56 Box main = new VBox(false, 2); 57 57 58 58 viewInput = new TextView(); 59 59 viewOutput = new TextView(); 60 60 viewError = new TextView(); 61 61 62 62 main.packStart(new ScrolledWindow(viewInput), false, false, 2); 63 63 Button button = new Button("exec", &execInput); … … 65 65 main.packStart(new ScrolledWindow(viewOutput), true, true, 2); 66 66 main.packStart(new ScrolledWindow(viewError), false, false, 2); 67 67 68 68 setBorderWidth(7); 69 69 add(main); … … 96 96 private bool exec(Spawn spawn) 97 97 { 98 99 viewOutput.getBuffer().setText(""); 100 viewError.getBuffer().setText(""); 101 98 102 int result = spawn.execAsyncWithPipes(); 99 103 trunk/src/glib/Spawn.d
r145 r147 72 72 char[][] argv; 73 73 char[][] envp; 74 GSpawnFlags flags ;74 GSpawnFlags flags = SpawnFlags.SEARCH_PATH; 75 75 GSpawnChildSetupFunc childSetup; 76 76 void* userData; … … 169 169 { 170 170 int result = g_spawn_async_with_pipes( 171 Str.toStringz(workingDirectory),172 Str.toStringzArray(argv),173 Str.toStringzArray(envp),174 flags,175 childSetup,176 userData,177 &childPid,178 &stdIn,179 &stdOut,180 &stdErr,181 &error171 Str.toStringz(workingDirectory), 172 Str.toStringzArray(argv), 173 Str.toStringzArray(envp), 174 flags, 175 childSetup, 176 userData, 177 &childPid, 178 &stdIn, 179 &stdOut, 180 &stdErr, 181 &error 182 182 ); 183 183 trunk/src/glib/Str.d
r145 r147 141 141 foreach (char[] p; args) 142 142 { 143 argv[argc++] = cast(char*) p;143 argv[argc++] = cast(char*)(p~'\0'); 144 144 } 145 145 argv[argc] = null; trunk/src/gtk/Button.d
r145 r147 172 172 { 173 173 this(); 174 removeAll(); 174 175 Image image = new Image(stockID,currentIconSize); 175 176 add(image); trunk/src/gtk/MenuToolButton.d
r145 r147 62 62 private import gtk.Widget; 63 63 private import gtk.Tooltips; 64 private import gtk.Menu; 64 65 65 66 /** … … 150 151 * Since 2.6 151 152 */ 152 public static ToolItem newMenuToolButton(Widget iconWidget, char[] label)153 public this(Widget iconWidget, char[] label) 153 154 { 154 155 // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget, const gchar *label); 155 return new ToolItem( gtk_menu_tool_button_new((iconWidget is null) ? null : iconWidget.getWidgetStruct(), Str.toStringz(label)) ); 156 this( cast(GtkMenuToolButton*)gtk_menu_tool_button_new( 157 (iconWidget is null) ? null : iconWidget.getWidgetStruct(), 158 Str.toStringz(label)) 159 ); 156 160 } 157 161 … … 166 170 * Since 2.6 167 171 */ 168 public static ToolItem newFromStock(char[]stockId)172 public this(StockID stockId) 169 173 { 170 174 // GtkToolItem* gtk_menu_tool_button_new_from_stock (const gchar *stock_id); 171 return new ToolItem( gtk_menu_tool_button_new_from_stock(Str.toStringz(stockId)) ); 172 } 173 175 this( 176 cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock( 177 Str.toStringz(StockDesc[stockId])) 178 ); 179 } 180 174 181 /** 175 182 * Sets the GtkMenu that is popped up when the user clicks on the arrow. … … 195 202 * Since 2.6 196 203 */ 197 public WidgetgetMenu()204 public Menu getMenu() 198 205 { 199 206 // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button); 200 return new Widget( gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 201 } 207 return new Menu( cast(GtkMenu*)gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 208 } 209 202 210 203 211 /** … … 239 247 gtk_menu_tool_button_set_arrow_tooltip(gtkMenuToolButton, (tooltips is null) ? null : tooltips.getTooltipsStruct(), Str.toStringz(tipText), Str.toStringz(tipPrivate)); 240 248 } 249 250 /** 251 * Sets the toolTip for the arrow 252 * Params: 253 * tipText = 254 * tipPrivate = 255 */ 256 public void setArrowTooltip(char[] tipText, char[] tipPrivate) 257 { 258 Tooltips tooltips = new Tooltips(); 259 gtk_menu_tool_button_set_arrow_tooltip( 260 gtkMenuToolButton, 261 (tooltips is null) ? null : tooltips.getTooltipsStruct(), 262 Str.toStringz(tipText), 263 Str.toStringz(tipPrivate) 264 ); 265 } 241 266 } trunk/src/gtk/TextView.d
r145 r147 149 149 } 150 150 151 private import glib.Str; 151 152 /** 152 153 * Simply appends some text to this view … … 158 159 TextBuffer buf = getBuffer(); 159 160 TextIter iter = new TextIter(); 161 buf = getBuffer(); 160 162 buf.getEndIter(iter); 161 163 buf.insert(iter, text); trunk/src/gtk/Widget.d
r145 r147 99 99 module gtk.Widget; 100 100 101 private import std.stdio; 102 101 103 private import gtk.typedefs; 102 104 … … 321 323 { 322 324 bit consumed = false; 323 324 325 foreach ( gboolean delegate(GdkEventButton*, Widget) dlg ; widget.onButtonPressListeners ) 325 326 { … … 329 330 return consumed; 330 331 } 332 333 static int p=0; 331 334 332 335 gboolean delegate(GdkEventButton*, Widget)[] onButtonReleaseListeners; 333 336 void addOnButtonRelease(gboolean delegate(GdkEventButton*, Widget) dlg) 334 337 { 335 if ( !("button-release-event" in connectedSignals) ) 338 if ( p++ < 1 ) 339 { 340 341 //if ( !("button-release-event" in connectedSignals) ) 336 342 { 337 343 addEvents(GdkEventMask.GDK_BUTTON_RELEASE_MASK); … … 346 352 } 347 353 onButtonReleaseListeners ~= dlg; 354 } 348 355 } 349 356 extern(C) static void callBackButtonRelease(GtkWidget* widgetStruct, GdkEventButton* event, Widget widget) 350 357 { 351 358 bit consumed = false; 352 359 353 360 foreach ( gboolean delegate(GdkEventButton*, Widget) dlg ; widget.onButtonReleaseListeners ) 354 361 { trunk/wrap/APILookupGLib.txt
r145 r147 405 405 foreach (char[] p; args) 406 406 { 407 argv[argc++] = cast(char*) p;407 argv[argc++] = cast(char*)(p~'\0'); 408 408 } 409 409 argv[argc] = null; … … 637 637 char[][] argv; 638 638 char[][] envp; 639 GSpawnFlags flags ;639 GSpawnFlags flags = SpawnFlags.SEARCH_PATH; 640 640 GSpawnChildSetupFunc childSetup; 641 641 void* userData; trunk/wrap/APILookupGtk.txt
r145 r147 4001 4001 import: gtk.Tooltips 4002 4002 structWrap: GtkTooltips* Tooltips 4003 import: gtk.Menu 4004 4005 4006 nocode: gtk_menu_tool_button_new 4007 nocode: gtk_menu_tool_button_new_from_stock 4008 nocode: gtk_menu_tool_button_get_menu 4009 4010 code: start 4011 /** 4012 * Creates a new GtkMenuToolButton using icon_widget as icon and 4013 * label as label. 4014 * icon_widget: 4015 * a widget that will be used as icon widget, or NULL 4016 * label: 4017 * a string that will be used as label, or NULL 4018 * Returns: 4019 * the new GtkMenuToolButton 4020 * Since 2.6 4021 */ 4022 public this(Widget iconWidget, char[] label) 4023 { 4024 // GtkToolItem* gtk_menu_tool_button_new (GtkWidget *icon_widget, const gchar *label); 4025 this( cast(GtkMenuToolButton*)gtk_menu_tool_button_new( 4026 (iconWidget is null) ? null : iconWidget.getWidgetStruct(), 4027 Str.toStringz(label)) 4028 ); 4029 } 4030 4031 /** 4032 * Creates a new GtkMenuToolButton. 4033 * The new GtkMenuToolButton will contain an icon and label from 4034 * the stock item indicated by stock_id. 4035 * stock_id: 4036 * the name of a stock item 4037 * Returns: 4038 * the new GtkMenuToolButton 4039 * Since 2.6 4040 */ 4041 public this(StockID stockId) 4042 { 4043 // GtkToolItem* gtk_menu_tool_button_new_from_stock (const gchar *stock_id); 4044 this( 4045 cast(GtkMenuToolButton*)gtk_menu_tool_button_new_from_stock( 4046 Str.toStringz(StockDesc[stockId])) 4047 ); 4048 } 4049 4050 /** 4051 * Gets the GtkMenu associated with GtkMenuToolButton. 4052 * button: 4053 * a GtkMenuToolButton 4054 * Returns: 4055 * the GtkMenu associated with GtkMenuToolButton 4056 * Since 2.6 4057 */ 4058 public Menu getMenu() 4059 { 4060 // GtkWidget* gtk_menu_tool_button_get_menu (GtkMenuToolButton *button); 4061 return new Menu( cast(GtkMenu*)gtk_menu_tool_button_get_menu(gtkMenuToolButton) ); 4062 } 4063 4064 /** 4065 * Sets the toolTip for the arrow 4066 * Params: 4067 * tipText = 4068 * tipPrivate = 4069 */ 4070 public void setArrowTooltip(char[] tipText, char[] tipPrivate) 4071 { 4072 Tooltips tooltips = new Tooltips(); 4073 gtk_menu_tool_button_set_arrow_tooltip( 4074 gtkMenuToolButton, 4075 (tooltips is null) ? null : tooltips.getTooltipsStruct(), 4076 Str.toStringz(tipText), 4077 Str.toStringz(tipPrivate) 4078 ); 4079 } 4080 4081 code: end 4082 4003 4083 outFile: MenuToolButton 4004 4084
