comparison dwt/widgets/Shell.d @ 238:380bad9f6852

reverted char[] to String
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:42:55 +0200
parents 17f8449522fd
children ce446666f5a2
comparison
equal deleted inserted replaced
237:98b80b00af79 238:380bad9f6852
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language: 10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de> 11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 12 *******************************************************************************/
13 module dwt.widgets.Shell; 13 module dwt.widgets.Shell;
14
15 import dwt.dwthelper.utils;
14 16
15 import dwt.widgets.Composite; 17 import dwt.widgets.Composite;
16 import dwt.widgets.Control; 18 import dwt.widgets.Control;
17 import dwt.internal.c.gtk; 19 import dwt.internal.c.gtk;
18 20
637 vboxHandle = OS.gtk_vbox_new (false, 0); 639 vboxHandle = OS.gtk_vbox_new (false, 0);
638 if (vboxHandle is null) error (DWT.ERROR_NO_HANDLES); 640 if (vboxHandle is null) error (DWT.ERROR_NO_HANDLES);
639 createHandle (index, false, true); 641 createHandle (index, false, true);
640 OS.gtk_container_add (cast(GtkContainer*)vboxHandle, scrolledHandle); 642 OS.gtk_container_add (cast(GtkContainer*)vboxHandle, scrolledHandle);
641 OS.gtk_box_set_child_packing (cast(GtkBox*)vboxHandle, scrolledHandle, true, true, 0, OS.GTK_PACK_END); 643 OS.gtk_box_set_child_packing (cast(GtkBox*)vboxHandle, scrolledHandle, true, true, 0, OS.GTK_PACK_END);
642 char[] dummy = "a"; 644 String dummy = "a";
643 OS.gtk_window_set_title (cast(GtkWindow*)shellHandle, dummy.ptr ); 645 OS.gtk_window_set_title (cast(GtkWindow*)shellHandle, dummy.ptr );
644 if ((style & (DWT.NO_TRIM | DWT.BORDER | DWT.SHELL_TRIM)) is 0) { 646 if ((style & (DWT.NO_TRIM | DWT.BORDER | DWT.SHELL_TRIM)) is 0) {
645 OS.gtk_container_set_border_width (cast(GtkContainer*)shellHandle, 1); 647 OS.gtk_container_set_border_width (cast(GtkContainer*)shellHandle, 1);
646 GdkColor* color = new GdkColor (); 648 GdkColor* color = new GdkColor ();
647 OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color); 649 OS.gtk_style_get_black (OS.gtk_widget_get_style (shellHandle), color);
793 } 795 }
794 796
795 void fixShell (Shell newShell, Control control) { 797 void fixShell (Shell newShell, Control control) {
796 if (this is newShell) return; 798 if (this is newShell) return;
797 if (control is lastActive) setActiveControl (null); 799 if (control is lastActive) setActiveControl (null);
798 char[] toolTipText = control.toolTipText; 800 String toolTipText = control.toolTipText;
799 if (toolTipText !is null) { 801 if (toolTipText !is null) {
800 control.setToolTipText (this, null); 802 control.setToolTipText (this, null);
801 control.setToolTipText (newShell, toolTipText); 803 control.setToolTipText (newShell, toolTipText);
802 } 804 }
803 } 805 }
1480 * Shells are never labelled by other widgets, so no initialization is needed. 1482 * Shells are never labelled by other widgets, so no initialization is needed.
1481 */ 1483 */
1482 override void setRelations() { 1484 override void setRelations() {
1483 } 1485 }
1484 1486
1485 public override void setText (char[] string) { 1487 public override void setText (String string) {
1486 super.setText (string); 1488 super.setText (string);
1487 1489
1488 /* 1490 /*
1489 * GTK bug 82013. For some reason, if the title string 1491 * GTK bug 82013. For some reason, if the title string
1490 * is less than 7 bytes long and is not terminated by 1492 * is less than 7 bytes long and is not terminated by
1753 display.doWindowRemoveFilter( &filterProcCallbackData, window, shellHandle ); 1755 display.doWindowRemoveFilter( &filterProcCallbackData, window, shellHandle );
1754 region = null; 1756 region = null;
1755 lastActive = null; 1757 lastActive = null;
1756 } 1758 }
1757 1759
1758 void setToolTipText (GtkWidget* widget, char[] string) { 1760 void setToolTipText (GtkWidget* widget, String string) {
1759 char* buffer = toStringz( string ); 1761 char* buffer = toStringz( string );
1760 if (tooltipsHandle is null) { 1762 if (tooltipsHandle is null) {
1761 tooltipsHandle = cast(GtkWidget*)OS.gtk_tooltips_new (); 1763 tooltipsHandle = cast(GtkWidget*)OS.gtk_tooltips_new ();
1762 if (tooltipsHandle is null) error (DWT.ERROR_NO_HANDLES); 1764 if (tooltipsHandle is null) error (DWT.ERROR_NO_HANDLES);
1763 OS.g_object_ref (tooltipsHandle); 1765 OS.g_object_ref (tooltipsHandle);