mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 15:37:25 +01:00
* Fix compile probelem under GTK2 related to
THandle <--> Pointer conversion git-svn-id: trunk@6090 -
This commit is contained in:
parent
bcb9c47ed9
commit
964538eebf
@ -4670,6 +4670,34 @@ begin
|
||||
Accelerate(Component,Widget,GDKKey,GDKModifier,Signal);
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
method TGtkWidgetSet LoadPixbufFromLazResource
|
||||
Params: const ResourceName: string;
|
||||
var Pixbuf: PGdkPixbuf
|
||||
Result: none
|
||||
|
||||
Loads a pixbuf from a lazarus resource. The resource must be a XPM file.
|
||||
-------------------------------------------------------------------------------}
|
||||
{$IfNDef NoGdkPixbufLib}
|
||||
procedure LoadPixbufFromLazResource(const ResourceName: string;
|
||||
var Pixbuf: PGdkPixbuf);
|
||||
var
|
||||
ImgData: PPChar;
|
||||
begin
|
||||
Pixbuf:=nil;
|
||||
try
|
||||
ImgData:=LazResourceXPMToPPChar(ResourceName);
|
||||
except
|
||||
on e: Exception do
|
||||
DebugLn('WARNING: TGtkWidgetSet.LoadXPMFromLazResource: '+e.Message);
|
||||
end;
|
||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||
pixbuf:=gdk_pixbuf_new_from_xpm_data(ImgData);
|
||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||
FreeMem(ImgData);
|
||||
end;
|
||||
{$EndIF}
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
method LoadXPMFromLazResource
|
||||
Params: const ResourceName: string;
|
||||
@ -7337,6 +7365,10 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.312 2004/09/30 10:35:50 mazen
|
||||
* Fix compile probelem under GTK2 related to
|
||||
THandle <--> Pointer conversion
|
||||
|
||||
Revision 1.311 2004/09/25 15:05:39 mattias
|
||||
implemented Rename Identifier
|
||||
|
||||
|
||||
@ -580,6 +580,8 @@ procedure Accelerate(Component: TComponent; const Widget: PGtkWidget;
|
||||
procedure ShareWindowAccelGroups(AWindow: PGtkWidget);
|
||||
procedure UnshareWindowAccelGroups(AWindow: PGtkWidget);
|
||||
|
||||
procedure LoadPixbufFromLazResource(const ResourceName: string;
|
||||
var Pixbuf: PGdkPixbuf);
|
||||
procedure LoadXPMFromLazResource(const ResourceName: string;
|
||||
Window: PGdkWindow; var PixmapImg, PixmapMask: PGdkPixmap);
|
||||
|
||||
|
||||
@ -893,39 +893,39 @@ begin
|
||||
with AProgressBar do
|
||||
begin
|
||||
if Smooth
|
||||
then gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
|
||||
then gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_CONTINUOUS)
|
||||
else gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(whandle),
|
||||
else gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_DISCRETE);
|
||||
case Orientation of
|
||||
pbVertical : gtk_progress_bar_set_orientation(
|
||||
GTK_PROGRESS_BAR(whandle),
|
||||
GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_BOTTOM_TO_TOP);
|
||||
pbRightToLeft: gtk_progress_bar_set_orientation(
|
||||
GTK_PROGRESS_BAR(whandle),
|
||||
GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_RIGHT_TO_LEFT);
|
||||
pbTopDown : gtk_progress_bar_set_orientation(
|
||||
GTK_PROGRESS_BAR(whandle),
|
||||
GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_TOP_TO_BOTTOM);
|
||||
else { pbHorizontal is default }
|
||||
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(wHandle),
|
||||
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(Pointer(Pointer(wHandle))),
|
||||
GTK_PROGRESS_LEFT_TO_RIGHT);
|
||||
end;
|
||||
if BarShowText then
|
||||
begin
|
||||
gtk_progress_set_format_string (GTK_PROGRESS(wHandle),
|
||||
gtk_progress_set_format_string (GTK_PROGRESS(Pointer(Pointer(wHandle))),
|
||||
'%v from [%l-%u] (=%p%%)');
|
||||
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GdkTrue);
|
||||
gtk_progress_set_show_text (GTK_PROGRESS(Pointer(Pointer(wHandle))), GdkTrue);
|
||||
end
|
||||
else
|
||||
gtk_progress_set_show_text (GTK_PROGRESS(wHandle), GDKFalse);
|
||||
gtk_progress_configure(GTK_PROGRESS(wHandle),Position,Min,Max);
|
||||
gtk_progress_set_show_text (GTK_PROGRESS(Pointer(Pointer(wHandle))), GDKFalse);
|
||||
gtk_progress_configure(GTK_PROGRESS(Pointer(Pointer(wHandle))),Position,Min,Max);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGtkWSProgressBar.SetPosition(const AProgressBar: TProgressBar; const NewPosition: integer);
|
||||
begin
|
||||
gtk_progress_set_value(GTK_PROGRESS(AProgressBar.Handle), NewPosition);
|
||||
gtk_progress_set_value(GTK_PROGRESS(Pointer(AProgressBar.Handle)), NewPosition);
|
||||
end;
|
||||
|
||||
{ TGtkWSToolbar }
|
||||
@ -992,7 +992,7 @@ begin
|
||||
with ATrackBar do
|
||||
begin
|
||||
wHandle := Handle;
|
||||
Widget := GTK_WIDGET(gtk_range_get_adjustment (GTK_RANGE(wHandle)));
|
||||
Widget := GTK_WIDGET(gtk_range_get_adjustment (GTK_RANGE(Pointer(wHandle))));
|
||||
GTK_ADJUSTMENT(Widget)^.lower := Min;
|
||||
GTK_ADJUSTMENT(Widget)^.Upper := Max;
|
||||
GTK_ADJUSTMENT(Widget)^.Value := Position;
|
||||
@ -1001,16 +1001,16 @@ begin
|
||||
{ now do some of the more sophisticated features }
|
||||
{ Hint: For some unknown reason we have to disable the draw_value first,
|
||||
otherwise it's set always to true }
|
||||
gtk_scale_set_draw_value (GTK_SCALE (wHandle), false);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (Pointer(wHandle)), false);
|
||||
|
||||
if ShowScale then
|
||||
begin
|
||||
gtk_scale_set_draw_value (GTK_SCALE (wHandle), ShowScale);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (Pointer(wHandle)), ShowScale);
|
||||
case ScalePos of
|
||||
trLeft : gtk_scale_set_value_pos (GTK_SCALE (wHandle), GTK_POS_LEFT);
|
||||
trRight : gtk_scale_set_value_pos (GTK_SCALE (wHandle), GTK_POS_RIGHT);
|
||||
trTop : gtk_scale_set_value_pos (GTK_SCALE (wHandle), GTK_POS_TOP);
|
||||
trBottom: gtk_scale_set_value_pos (GTK_SCALE (wHandle), GTK_POS_BOTTOM);
|
||||
trLeft : gtk_scale_set_value_pos (GTK_SCALE (Pointer(wHandle)), GTK_POS_LEFT);
|
||||
trRight : gtk_scale_set_value_pos (GTK_SCALE (Pointer(wHandle)), GTK_POS_RIGHT);
|
||||
trTop : gtk_scale_set_value_pos (GTK_SCALE (Pointer(wHandle)), GTK_POS_TOP);
|
||||
trBottom: gtk_scale_set_value_pos (GTK_SCALE (Pointer(wHandle)), GTK_POS_BOTTOM);
|
||||
end;
|
||||
end;
|
||||
//Not here (Delphi compatibility): gtk_signal_emit_by_name (GTK_Object (Widget), 'value_changed');
|
||||
@ -1022,7 +1022,7 @@ begin
|
||||
if ATrackBar.HandleAllocated then
|
||||
begin
|
||||
Result := RoundToInt(gtk_range_get_adjustment(
|
||||
GTK_RANGE(ATrackBar.Handle))^.value);
|
||||
GTK_RANGE(Pointer(ATrackBar.Handle)))^.value);
|
||||
end else
|
||||
Result := 0;
|
||||
end;
|
||||
@ -1032,9 +1032,9 @@ var
|
||||
Handle: HWND;
|
||||
begin
|
||||
Handle := ATrackBar.Handle;
|
||||
gtk_range_get_adjustment(GTK_RANGE(Handle))^.value := NewPosition;
|
||||
gtk_range_get_adjustment(GTK_RANGE(Pointer(Handle)))^.value := NewPosition;
|
||||
g_signal_emit_by_name(PGtkObject(
|
||||
gtk_range_get_adjustment(GTK_RANGE(Handle))), 'value_changed');
|
||||
gtk_range_get_adjustment(GTK_RANGE(Pointer(Handle)))), 'value_changed');
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -214,6 +214,9 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
gdk2PixBuf, glib2;
|
||||
|
||||
var
|
||||
{$IFDef GTK1}
|
||||
NoteBookCloseBtnPixmapImg: PGdkPixmap {$ifndef VER1_0} = nil {$endif};
|
||||
|
||||
@ -64,7 +64,7 @@ var
|
||||
wHandle: HWND;
|
||||
begin
|
||||
wHandle := ACustomSpinEdit.Handle;
|
||||
AnAdjustment:=gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(wHandle));
|
||||
AnAdjustment:=gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(Pointer(wHandle)));
|
||||
if (AnAdjustment^.lower<>ACustomSpinEdit.MinValue)
|
||||
or (AnAdjustment^.upper<>ACustomSpinEdit.MaxValue) then
|
||||
begin
|
||||
@ -72,11 +72,11 @@ begin
|
||||
AnAdjustment^.upper:=ACustomSpinEdit.MaxValue;
|
||||
gtk_adjustment_changed(AnAdjustment);
|
||||
end;
|
||||
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(wHandle),
|
||||
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(Pointer(wHandle)),
|
||||
ACustomSpinEdit.Decimal_Places);
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(wHandle),
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(Pointer(wHandle)),
|
||||
ACustomSpinEdit.Value);
|
||||
GTK_SPIN_BUTTON(wHandle)^.climb_rate:=ACustomSpinEdit.Climb_Rate;
|
||||
GTK_SPIN_BUTTON(Pointer(wHandle))^.climb_rate:=ACustomSpinEdit.Climb_Rate;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
@ -304,7 +304,7 @@ begin
|
||||
with AScrollBar do
|
||||
begin
|
||||
//set properties for the range
|
||||
Widget := GTK_WIDGET(gtk_range_get_adjustment (GTK_RANGE(Handle)));
|
||||
Widget := GTK_WIDGET(gtk_range_get_adjustment (GTK_RANGE(Pointer(Handle))));
|
||||
GTK_ADJUSTMENT(Widget)^.lower := Min;
|
||||
GTK_ADJUSTMENT(Widget)^.Upper := Max;
|
||||
GTK_ADJUSTMENT(Widget)^.Value := Position;
|
||||
@ -790,7 +790,7 @@ end;
|
||||
procedure TGtkWSCustomLabel.SetWordWrap(const ACustomLabel: TCustomLabel;
|
||||
const NewWordWrap: boolean);
|
||||
begin
|
||||
gtk_label_set_line_wrap(GTK_LABEL(ACustomLabel.Handle), NewWordWrap);
|
||||
gtk_label_set_line_wrap(GTK_LABEL(Pointer(ACustomLabel.Handle)), NewWordWrap);
|
||||
end;
|
||||
|
||||
{ TGtkWSCustomCheckBox }
|
||||
|
||||
@ -53,11 +53,11 @@ type
|
||||
function CreateComponent(Sender : TObject): THandle; override;
|
||||
function GetText(Sender: TComponent; var Text: String): Boolean;
|
||||
procedure HookSignals(const AGTKObject: PGTKObject; const ALCLObject: TObject); override;
|
||||
function IntSendMessage3(LM_Message : Integer; Sender : TObject; data : pointer) : integer; override;
|
||||
//function IntSendMessage3(LM_Message : Integer; Sender : TObject; data : pointer) : integer; override;
|
||||
function LoadStockPixmap(StockID: longint) : HBitmap; override;
|
||||
procedure SetCallback(const AMsg: LongInt; const AGTKObject: PGTKObject; const ALCLObject: TObject);override;
|
||||
procedure SetLabel(Sender : TObject; Data : Pointer);
|
||||
function SetProperties(Sender : TObject) : integer; override;
|
||||
//function SetProperties(Sender : TObject) : integer; override;
|
||||
procedure SetSelectionMode(Sender: TObject; Widget: PGtkWidget;
|
||||
MultiSelect, ExtendedSelect: boolean); override;
|
||||
function SetTopIndex(Sender: TObject; NewTopIndex: integer): integer; override;
|
||||
@ -594,6 +594,10 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.35 2004/09/30 10:35:50 mazen
|
||||
* Fix compile probelem under GTK2 related to
|
||||
THandle <--> Pointer conversion
|
||||
|
||||
Revision 1.34 2004/09/12 19:08:35 mazen
|
||||
* Fix compilation problem with GTK2
|
||||
|
||||
|
||||
@ -403,7 +403,7 @@ end;
|
||||
WARNING: the result of this function sometimes is not always really an
|
||||
integer!!!!!
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.IntSendMessage3(LM_Message : Integer; Sender : TObject;
|
||||
(*function TGtk2WidgetSet.IntSendMessage3(LM_Message : Integer; Sender : TObject;
|
||||
data : pointer) : integer;
|
||||
var
|
||||
handle : hwnd; // handle of sender
|
||||
@ -438,7 +438,7 @@ begin
|
||||
handle := hwnd(ObjectToGtkObject(Sender));
|
||||
{Case LM_Message of}
|
||||
|
||||
(* LM_CLB_GETCHECKED :
|
||||
LM_CLB_GETCHECKED :
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(Data)
|
||||
@ -457,9 +457,9 @@ begin
|
||||
result := 1;
|
||||
end;
|
||||
end;
|
||||
end; *)
|
||||
end;
|
||||
|
||||
(*LM_CLB_SETCHECKED :
|
||||
LM_CLB_SETCHECKED :
|
||||
begin
|
||||
if Assigned(Data)
|
||||
and (Sender is TControl)
|
||||
@ -474,9 +474,9 @@ begin
|
||||
then
|
||||
gtk_list_store_set(GTK_LIST_STORE(aTreeModel), @aTreeIter, [0, TLMSetChecked(Data^).Checked, -1]);
|
||||
end;
|
||||
end;*)
|
||||
end;
|
||||
|
||||
(*LM_GETITEMINDEX :
|
||||
LM_GETITEMINDEX :
|
||||
begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csListBox, csCheckListBox:
|
||||
@ -514,9 +514,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
end;
|
||||
|
||||
(*LM_GETITEMS :
|
||||
LM_GETITEMS :
|
||||
begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
csComboBox:
|
||||
@ -539,9 +539,9 @@ begin
|
||||
else
|
||||
raise Exception.Create('Message LM_GETITEMS - Not implemented');
|
||||
end;
|
||||
end;*)
|
||||
end;
|
||||
|
||||
(*LM_GETSEL :
|
||||
LM_GETSEL :
|
||||
begin
|
||||
Result := 0; { assume: nothing found }
|
||||
if (Sender is TControl)
|
||||
@ -565,8 +565,8 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
{
|
||||
end;
|
||||
|
||||
LM_GETSELSTART :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
@ -593,8 +593,8 @@ begin
|
||||
else
|
||||
Result:= 0;
|
||||
end;
|
||||
}
|
||||
(*LM_GETSELCOUNT :
|
||||
|
||||
LM_GETSELCOUNT :
|
||||
begin
|
||||
case (Sender as TControl).fCompStyle of
|
||||
csListBox, csCheckListBox :
|
||||
@ -613,8 +613,8 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
{
|
||||
end;
|
||||
|
||||
LM_GETSELLEN :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
@ -641,8 +641,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
(*LM_SETBORDER:
|
||||
|
||||
LM_SETBORDER:
|
||||
begin
|
||||
if (Sender is TWinControl) then
|
||||
begin
|
||||
@ -656,9 +656,9 @@ begin
|
||||
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(Widget), GTK_SHADOW_NONE);
|
||||
end
|
||||
end;
|
||||
end;*)
|
||||
end;
|
||||
|
||||
(*LM_SETITEMINDEX:
|
||||
LM_SETITEMINDEX:
|
||||
if Handle<>0 then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
|
||||
@ -683,9 +683,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
end;
|
||||
|
||||
(*LM_SETSEL:
|
||||
LM_SETSEL:
|
||||
begin
|
||||
if (Sender is TControl)
|
||||
and Assigned (data)
|
||||
@ -710,8 +710,8 @@ begin
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;*)
|
||||
(*
|
||||
end;
|
||||
|
||||
LM_SETSELSTART:
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
@ -742,8 +742,8 @@ begin
|
||||
else
|
||||
Result:= 0;
|
||||
end;
|
||||
*)
|
||||
(* LM_SETSELLEN :
|
||||
|
||||
LM_SETSELLEN :
|
||||
begin
|
||||
if (Sender is TControl) then begin
|
||||
case TControl(Sender).fCompStyle of
|
||||
@ -773,8 +773,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
*)
|
||||
(*LM_SORT:
|
||||
|
||||
LM_SORT:
|
||||
begin
|
||||
if (Sender is TControl) and assigned (data) then
|
||||
begin
|
||||
@ -789,16 +789,16 @@ begin
|
||||
end;
|
||||
end
|
||||
end
|
||||
end;*)
|
||||
end;
|
||||
|
||||
{else} begin
|
||||
else begin
|
||||
result := inherited IntSendMessage3(LM_Message, Sender, data);
|
||||
exit;
|
||||
end; // end of else-part of 2nd case
|
||||
{end;} // end of 2nd case
|
||||
end; // end of else-part of 1st case
|
||||
// end; // end of 1st case
|
||||
end;
|
||||
end;*)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TGtk2WidgetSet.SetCallback
|
||||
@ -1068,7 +1068,7 @@ end;
|
||||
Depending on the compStyle, this function will apply all properties of
|
||||
the calling object to the corresponding GTK2 object.
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.SetProperties(Sender : TObject) : integer;
|
||||
(*function TGtk2WidgetSet.SetProperties(Sender : TObject) : integer;
|
||||
const
|
||||
cLabelAlignX : array[TAlignment] of gfloat = (0.0, 1.0, 0.5);
|
||||
cLabelAlignY : array[TTextLayout] of gfloat = (0.0, 0.5, 1.0);
|
||||
@ -1164,7 +1164,7 @@ begin
|
||||
else
|
||||
Result := inherited SetProperties(Sender);
|
||||
end;
|
||||
end;
|
||||
end; *)
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TGtk2WidgetSet.SetSelectionMode(Sender: TObject; Widget: PGtkWidget;
|
||||
@ -1375,6 +1375,10 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.19 2004/09/30 10:35:50 mazen
|
||||
* Fix compile probelem under GTK2 related to
|
||||
THandle <--> Pointer conversion
|
||||
|
||||
Revision 1.18 2004/09/28 16:41:54 mazen
|
||||
* Fix GTK2 compilation problem
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user