fixed TColotDialog for GTK2

git-svn-id: trunk@4593 -
This commit is contained in:
ajgenius 2003-09-10 02:33:41 +00:00
parent 3f67846f84
commit eef2bbe9ad
4 changed files with 47 additions and 20 deletions

View File

@ -1559,7 +1559,6 @@ var
theDialog : TCommonDialog; theDialog : TCommonDialog;
Fpointer : Pointer; Fpointer : Pointer;
// colordialog // colordialog
colorArray : array[0..2] of double;
colorsel : PGtkColorSelection; colorsel : PGtkColorSelection;
newColor : TGdkColor; newColor : TGdkColor;
// fontdialog // fontdialog
@ -1627,11 +1626,7 @@ begin
else if theDialog is TColorDialog then else if theDialog is TColorDialog then
begin begin
colorSel := PGtkColorSelection(PGtkColorSelectionDialog(FPointer)^.colorsel); colorSel := PGtkColorSelection(PGtkColorSelectionDialog(FPointer)^.colorsel);
gtk_color_selection_get_color(colorsel, @colorArray[0]); gtk_color_selection_get_current_color(colorsel, @newColor);
newColor.pixel := 0;
newColor.red := Trunc(colorArray[0] * $FFFF);
newColor.green := Trunc(colorArray[1] * $FFFF);
newColor.blue := Trunc(colorArray[2] * $FFFF);
TColorDialog(theDialog).Color := TGDKColorToTColor(newcolor); TColorDialog(theDialog).Color := TGDKColorToTColor(newcolor);
end end
else if theDialog is TFontDialog then else if theDialog is TFontDialog then
@ -2849,6 +2844,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.188 2003/09/10 02:33:41 ajgenius
fixed TColotDialog for GTK2
Revision 1.187 2003/09/09 04:15:08 ajgenius Revision 1.187 2003/09/09 04:15:08 ajgenius
more updates for GTK2, more GTK1 wrappers, removal of more ifdef's, partly fixed signals more updates for GTK2, more GTK1 wrappers, removal of more ifdef's, partly fixed signals

View File

@ -6586,22 +6586,16 @@ end;
procedure TgtkObject.SetColorDialogColor(ColorSelection: PGtkColorSelection; procedure TgtkObject.SetColorDialogColor(ColorSelection: PGtkColorSelection;
Color: TColor); Color: TColor);
var var
SelectionColor: PGDouble; // currently only used by TColorDialog SelectionColor: TGDKColor; // currently only used by TColorDialog
colorSel : PGTKCOLORSELECTION; colorSel : PGTKCOLORSELECTION;
begin begin
GetMem(SelectionColor,4*SizeOf(GDouble)); Color:=ColorToRGB(Color);
try SelectionColor.Pixel := 0;
Color:=ColorToRGB(Color); SelectionColor.Red := Red(Color) shl 8;
SelectionColor[0]:=GDouble(Color and $ff)/255; SelectionColor.Green:= Green(Color) shl 8;
SelectionColor[1]:=GDouble((Color shr 8) and $ff)/255; SelectionColor.Blue:= Blue(Color) shl 8;
SelectionColor[2]:=GDouble((Color shr 16) and $ff)/255; colorSel := PGTKCOLORSELECTION((PGTKCOLORSELECTIONDIALOG(ColorSelection))^.colorsel);
SelectionColor[3]:=0.0; gtk_color_selection_set_current_color(colorSel,@SelectionColor);
colorSel := PGTKCOLORSELECTION(
(PGTKCOLORSELECTIONDIALOG(ColorSelection))^.colorsel);
gtk_color_selection_set_color(colorSel,SelectionColor);
finally
FreeMem(SelectionColor);
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -8178,6 +8172,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.412 2003/09/10 02:33:41 ajgenius
fixed TColotDialog for GTK2
Revision 1.411 2003/09/09 20:46:38 ajgenius Revision 1.411 2003/09/09 20:46:38 ajgenius
more implementation toward pango for gtk2 more implementation toward pango for gtk2

View File

@ -115,6 +115,33 @@ begin
result := gtk.gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH); result := gtk.gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH);
end; end;
Procedure gtk_color_selection_get_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
var
colorArray : array[0..2] of double;
begin
gtk_color_selection_get_color(colorsel, @colorArray[0]);
Color^.pixel := 0;
Color^.red := Trunc(colorArray[0] * $FFFF);
Color^.green := Trunc(colorArray[1] * $FFFF);
Color^.blue := Trunc(colorArray[2] * $FFFF);
end;
Procedure gtk_color_selection_set_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
var
SelectionColor: PGDouble;
begin
GetMem(SelectionColor,4*SizeOf(GDouble));
try
SelectionColor[0]:=Color^.Red/65535;
SelectionColor[1]:=Color^.Green/65535;
SelectionColor[2]:=Color^.Blue/65535;
SelectionColor[3]:=0.0;
gtk_color_selection_set_color(colorSel,SelectionColor);
finally
FreeMem(SelectionColor);
end;
end;
procedure gdk_image_unref(Image : PGdkImage); procedure gdk_image_unref(Image : PGdkImage);
begin begin
gdk_window_unref(PGdkWindow(Image)); gdk_window_unref(PGdkWindow(Image));
@ -4623,6 +4650,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.202 2003/09/10 02:33:41 ajgenius
fixed TColotDialog for GTK2
Revision 1.201 2003/09/09 20:46:38 ajgenius Revision 1.201 2003/09/09 20:46:38 ajgenius
more implementation toward pango for gtk2 more implementation toward pango for gtk2

View File

@ -529,6 +529,8 @@ function gtk_widget_get_ythickness(Style : PGTKWidget) : gint; overload;
Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean); Procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
Function gtk_image_new : PGTKWidget; Function gtk_image_new : PGTKWidget;
Function gtk_toolbar_new : PGTKWidget; Function gtk_toolbar_new : PGTKWidget;
Procedure gtk_color_selection_get_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
Procedure gtk_color_selection_set_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
//routines to mimic similar GDK2 routines/behaviour--> //routines to mimic similar GDK2 routines/behaviour-->
procedure gdk_image_unref(Image : PGdkImage); procedure gdk_image_unref(Image : PGdkImage);