mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 19:39:28 +02:00
lcl: gtk3: less hints
git-svn-id: trunk@65100 -
This commit is contained in:
parent
7879c790a4
commit
331f647184
@ -27,7 +27,7 @@ uses
|
|||||||
Controls, StdCtrls, ExtCtrls, Buttons, ComCtrls, Graphics, Dialogs, Forms, Menus, ExtDlgs,
|
Controls, StdCtrls, ExtCtrls, Buttons, ComCtrls, Graphics, Dialogs, Forms, Menus, ExtDlgs,
|
||||||
Spin, CheckLst, PairSplitter, LCLType, LMessages, LCLMessageGlue, LCLIntf,
|
Spin, CheckLst, PairSplitter, LCLType, LMessages, LCLMessageGlue, LCLIntf,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazLoggerBase, GraphType,
|
LazLoggerBase, GraphType, LazUtilities,
|
||||||
// GTK3
|
// GTK3
|
||||||
LazGtk3, LazGdk3, LazGObject2, LazGLib2, LazCairo1, LazPango1, LazGdkPixbuf2,
|
LazGtk3, LazGdk3, LazGObject2, LazGLib2, LazCairo1, LazPango1, LazGdkPixbuf2,
|
||||||
gtk3objects, gtk3procs, gtk3private, Gtk3CellRenderer;
|
gtk3objects, gtk3procs, gtk3private, Gtk3CellRenderer;
|
||||||
@ -89,7 +89,7 @@ type
|
|||||||
procedure SetFont(AValue: PPangoFontDescription);
|
procedure SetFont(AValue: PPangoFontDescription);
|
||||||
procedure SetVisible(AValue: Boolean);
|
procedure SetVisible(AValue: Boolean);
|
||||||
procedure SetStyleContext(AValue: PGtkStyleContext);
|
procedure SetStyleContext(AValue: PGtkStyleContext);
|
||||||
class procedure destroy_event(w:Tgtk3Widget;data:gpointer);cdecl;
|
class procedure destroy_event(w:Tgtk3Widget;{%H-}data:gpointer);cdecl;
|
||||||
protected
|
protected
|
||||||
// IUnknown implementation
|
// IUnknown implementation
|
||||||
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
|
function QueryInterface(constref iid: TGuid; out obj): LongInt; {$IFDEF WINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
|
||||||
@ -99,7 +99,7 @@ type
|
|||||||
function getText: String; virtual;
|
function getText: String; virtual;
|
||||||
procedure setText(const AValue: String); virtual;
|
procedure setText(const AValue: String); virtual;
|
||||||
function GetContext: HDC; virtual;
|
function GetContext: HDC; virtual;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; virtual;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; virtual;
|
||||||
procedure DestroyWidget; virtual;
|
procedure DestroyWidget; virtual;
|
||||||
procedure DoBeforeLCLPaint; virtual;
|
procedure DoBeforeLCLPaint; virtual;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ type
|
|||||||
function GetWindow: PGdkWindow; virtual;
|
function GetWindow: PGdkWindow; virtual;
|
||||||
procedure Move(ALeft, ATop: Integer);
|
procedure Move(ALeft, ATop: Integer);
|
||||||
procedure Activate; virtual;
|
procedure Activate; virtual;
|
||||||
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); virtual;
|
procedure preferredSize(var PreferredWidth, PreferredHeight: integer; {%H-}WithThemeSpace: Boolean); virtual;
|
||||||
procedure SetCursor(ACursor: HCURSOR);
|
procedure SetCursor(ACursor: HCURSOR);
|
||||||
procedure SetFocus; virtual;
|
procedure SetFocus; virtual;
|
||||||
procedure SetParent(AParent: TGtk3Widget; const ALeft, ATop: Integer); virtual;
|
procedure SetParent(AParent: TGtk3Widget; const ALeft, ATop: Integer); virtual;
|
||||||
@ -221,7 +221,7 @@ type
|
|||||||
procedure InsertText(const atext:pchar;len:gint;var pos:gint;edt:TGtk3Entry);cdecl;
|
procedure InsertText(const atext:pchar;len:gint;var pos:gint;edt:TGtk3Entry);cdecl;
|
||||||
function getText: String; override;
|
function getText: String; override;
|
||||||
procedure setText(const AValue: String); override;
|
procedure setText(const AValue: String); override;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure InitializeWidget; override;
|
procedure InitializeWidget; override;
|
||||||
procedure SetEchoMode(AVisible: Boolean);
|
procedure SetEchoMode(AVisible: Boolean);
|
||||||
@ -250,8 +250,8 @@ type
|
|||||||
procedure SetStep(AValue: Double);
|
procedure SetStep(AValue: Double);
|
||||||
procedure SetValue(AValue: Double);
|
procedure SetValue(AValue: Double);
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
function EatArrowKeys(const AKey: Word): Boolean; override;
|
function EatArrowKeys(const {%H-}AKey: Word): Boolean; override;
|
||||||
public
|
public
|
||||||
function IsWidgetOk: Boolean; override;
|
function IsWidgetOk: Boolean; override;
|
||||||
procedure SetRange(AMin, AMax: Double);
|
procedure SetRange(AMin, AMax: Double);
|
||||||
@ -286,7 +286,7 @@ type
|
|||||||
function GetReversed: Boolean;
|
function GetReversed: Boolean;
|
||||||
procedure SetReversed(AValue: Boolean);
|
procedure SetReversed(AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure SetBounds(ALeft,ATop,AWidth,AHeight:integer);override;
|
procedure SetBounds(ALeft,ATop,AWidth,AHeight:integer);override;
|
||||||
function GetTrackBarOrientation: TTrackBarOrientation;
|
function GetTrackBarOrientation: TTrackBarOrientation;
|
||||||
@ -300,7 +300,7 @@ type
|
|||||||
TGtk3ScrollBar = class(TGtk3Range)
|
TGtk3ScrollBar = class(TGtk3Range)
|
||||||
protected
|
protected
|
||||||
class procedure value_changed (bar:TGtk3Scrollbar);cdecl;
|
class procedure value_changed (bar:TGtk3Scrollbar);cdecl;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure SetParams;
|
procedure SetParams;
|
||||||
end;
|
end;
|
||||||
@ -318,7 +318,7 @@ type
|
|||||||
procedure SetShowText(AValue: Boolean);
|
procedure SetShowText(AValue: Boolean);
|
||||||
procedure SetStyle(AValue: TProgressBarStyle);
|
procedure SetStyle(AValue: TProgressBarStyle);
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure InitializeWidget; override;
|
procedure InitializeWidget; override;
|
||||||
property Orientation: TProgressBarOrientation read GetOrientation write SetOrientation;
|
property Orientation: TProgressBarOrientation read GetOrientation write SetOrientation;
|
||||||
@ -331,7 +331,7 @@ type
|
|||||||
|
|
||||||
TGtk3Calendar = class(TGtk3Widget)
|
TGtk3Calendar = class(TGtk3Widget)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure GetDate(out AYear, AMonth, ADay: Word);
|
procedure GetDate(out AYear, AMonth, ADay: Word);
|
||||||
procedure SetDate(const AYear, AMonth, ADay: Word);
|
procedure SetDate(const AYear, AMonth, ADay: Word);
|
||||||
@ -349,7 +349,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function getText: String; override;
|
function getText: String; override;
|
||||||
procedure setText(const AValue: String); override;
|
procedure setText(const AValue: String); override;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
property Alignment: TAlignment read GetAlignment write SetAlignment;
|
property Alignment: TAlignment read GetAlignment write SetAlignment;
|
||||||
property StaticBorderStyle: TStaticBorderStyle read GetStaticBorderStyle write SetStaticBorderStyle;
|
property StaticBorderStyle: TStaticBorderStyle read GetStaticBorderStyle write SetStaticBorderStyle;
|
||||||
@ -381,7 +381,7 @@ type
|
|||||||
|
|
||||||
TGtk3NoteBook = class (TGtk3Container)
|
TGtk3NoteBook = class (TGtk3Container)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
procedure InitializeWidget;override;
|
procedure InitializeWidget;override;
|
||||||
function getClientRect: TRect; override;
|
function getClientRect: TRect; override;
|
||||||
@ -407,14 +407,14 @@ type
|
|||||||
|
|
||||||
TGtk3Paned = class(TGtk3Container)
|
TGtk3Paned = class(TGtk3Container)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3SplitterSide }
|
{ TGtk3SplitterSide }
|
||||||
|
|
||||||
TGtk3SplitterSide = class(TGtk3Container)
|
TGtk3SplitterSide = class(TGtk3Container)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -432,14 +432,14 @@ type
|
|||||||
|
|
||||||
TGtk3MenuBar = class(TGtk3MenuShell)
|
TGtk3MenuBar = class(TGtk3MenuShell)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3Menu }
|
{ TGtk3Menu }
|
||||||
|
|
||||||
TGtk3Menu = class(TGtk3MenuShell)
|
TGtk3Menu = class(TGtk3MenuShell)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
PopupPoint: TPoint;
|
PopupPoint: TPoint;
|
||||||
constructor CreateFromMenuItem(const AMenuItem: TMenuItem); virtual; overload;
|
constructor CreateFromMenuItem(const AMenuItem: TMenuItem); virtual; overload;
|
||||||
@ -452,7 +452,7 @@ type
|
|||||||
function GetCaption: string;
|
function GetCaption: string;
|
||||||
procedure SetCaption(const AValue: string);
|
procedure SetCaption(const AValue: string);
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
public
|
public
|
||||||
Lock:integer;
|
Lock:integer;
|
||||||
MenuItem: TMenuItem;
|
MenuItem: TMenuItem;
|
||||||
@ -496,7 +496,7 @@ type
|
|||||||
procedure ClearGlyphs;
|
procedure ClearGlyphs;
|
||||||
public
|
public
|
||||||
destructor Destroy;override;
|
destructor Destroy;override;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3Memo }
|
{ TGtk3Memo }
|
||||||
@ -616,7 +616,7 @@ type
|
|||||||
|
|
||||||
TGtk3StatusBar = class(TGtk3Box)
|
TGtk3StatusBar = class(TGtk3Box)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3Panel }
|
{ TGtk3Panel }
|
||||||
@ -626,7 +626,7 @@ type
|
|||||||
FBorderStyle: TBorderStyle;
|
FBorderStyle: TBorderStyle;
|
||||||
protected
|
protected
|
||||||
procedure SetColor(AValue: TColor); override;
|
procedure SetColor(AValue: TColor); override;
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
procedure DoBeforeLCLPaint; override;
|
procedure DoBeforeLCLPaint; override;
|
||||||
procedure setText(const AValue: String); override;
|
procedure setText(const AValue: String); override;
|
||||||
public
|
public
|
||||||
@ -637,7 +637,7 @@ type
|
|||||||
|
|
||||||
TGtk3GroupBox = class(TGtk3Bin)
|
TGtk3GroupBox = class(TGtk3Bin)
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
|
||||||
function getText: String; override;
|
function getText: String; override;
|
||||||
procedure setText(const AValue: String); override;
|
procedure setText(const AValue: String); override;
|
||||||
public
|
public
|
||||||
@ -1652,7 +1652,7 @@ begin
|
|||||||
if AEvent^.scroll.send_event = NO_PROPAGATION_TO_PARENT then
|
if AEvent^.scroll.send_event = NO_PROPAGATION_TO_PARENT then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
EventXY := Point(TruncToInt(AEvent^.Scroll.X),TruncToInt(AEvent^.scroll.Y));
|
EventXY := Point(LazUtilities.TruncToInt(AEvent^.Scroll.X),LazUtilities.TruncToInt(AEvent^.scroll.Y));
|
||||||
AState := GtkModifierStateToShiftState(AEvent^.scroll.state, False);
|
AState := GtkModifierStateToShiftState(AEvent^.scroll.state, False);
|
||||||
ShiftState := [];
|
ShiftState := [];
|
||||||
if AState and MK_SHIFT <> 0 then
|
if AState and MK_SHIFT <> 0 then
|
||||||
@ -1724,7 +1724,7 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
if Event^.type_ = GDK_ENTER_NOTIFY then
|
if Event^.type_ = GDK_ENTER_NOTIFY then
|
||||||
begin
|
begin
|
||||||
Msg.Msg := LM_MOUSEENTER;
|
Msg.Msg := LM_MOUSEENTER;
|
||||||
@ -1767,7 +1767,7 @@ begin
|
|||||||
if Event^.motion.send_event = NO_PROPAGATION_TO_PARENT then
|
if Event^.motion.send_event = NO_PROPAGATION_TO_PARENT then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
|
|
||||||
MousePos.x := Round(Event^.motion.x);
|
MousePos.x := Round(Event^.motion.x);
|
||||||
MousePos.y := Round(Event^.motion.y);
|
MousePos.y := Round(Event^.motion.y);
|
||||||
@ -1803,11 +1803,11 @@ begin
|
|||||||
if not FHasPaint then
|
if not FHasPaint then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
|
|
||||||
Msg.Msg := LM_PAINT;
|
Msg.Msg := LM_PAINT;
|
||||||
//New(AStruct);
|
//New(AStruct);
|
||||||
FillChar(AStruct, SizeOf(TPaintStruct), 0);
|
FillChar(AStruct{%H-}, SizeOf(TPaintStruct), 0);
|
||||||
Msg.PaintStruct := @AStruct;
|
Msg.PaintStruct := @AStruct;
|
||||||
|
|
||||||
with PaintData do
|
with PaintData do
|
||||||
@ -1853,7 +1853,6 @@ end;
|
|||||||
|
|
||||||
function TGtk3Widget.GtkEventResize(Sender: PGtkWidget; Event: PGdkEvent
|
function TGtk3Widget.GtkEventResize(Sender: PGtkWidget; Event: PGdkEvent
|
||||||
): Boolean; cdecl;
|
): Boolean; cdecl;
|
||||||
var alloc:TGtkAllocation;
|
|
||||||
begin
|
begin
|
||||||
{-$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGSIZE)}
|
{-$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGSIZE)}
|
||||||
DebugLn('GtkEventResize: ',dbgsName(LCLObject),' Send=',dbgs(Event^.configure.send_event),
|
DebugLn('GtkEventResize: ',dbgsName(LCLObject),' Send=',dbgs(Event^.configure.send_event),
|
||||||
@ -1873,7 +1872,7 @@ begin
|
|||||||
{$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGFOCUS)}
|
{$IF DEFINED(GTK3DEBUGEVENTS) OR DEFINED(GTK3DEBUGFOCUS)}
|
||||||
DebugLn('TGtk3Widget.GtkEventFocus ',dbgsName(LCLObject),' FocusIn ',dbgs(Event^.focus_change.in_ <> 0));
|
DebugLn('TGtk3Widget.GtkEventFocus ',dbgsName(LCLObject),' FocusIn ',dbgs(Event^.focus_change.in_ <> 0));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
if Event^.focus_change.in_ <> 0 then
|
if Event^.focus_change.in_ <> 0 then
|
||||||
Msg.Msg := LM_SETFOCUS
|
Msg.Msg := LM_SETFOCUS
|
||||||
else
|
else
|
||||||
@ -1885,7 +1884,7 @@ procedure TGtk3Widget.GtkEventDestroy; cdecl;
|
|||||||
var
|
var
|
||||||
Msg: TLMessage;
|
Msg: TLMessage;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
Msg.Msg := LM_DESTROY;
|
Msg.Msg := LM_DESTROY;
|
||||||
DeliverMessage(Msg);
|
DeliverMessage(Msg);
|
||||||
Release;
|
Release;
|
||||||
@ -1900,7 +1899,7 @@ begin
|
|||||||
// gtk3 have ugly bug with scroll-event
|
// gtk3 have ugly bug with scroll-event
|
||||||
// https://bugzilla.gnome.org/show_bug.cgi?id=675959
|
// https://bugzilla.gnome.org/show_bug.cgi?id=675959
|
||||||
Result := False;
|
Result := False;
|
||||||
EventXY := Point(TruncToInt(Event^.scroll.x), TruncToInt(Event^.scroll.y));
|
EventXY := Point(LazUtilities.TruncToInt(Event^.scroll.x), LazUtilities.TruncToInt(Event^.scroll.y));
|
||||||
FillChar(Msg{%H-},SizeOf(Msg),0);
|
FillChar(Msg{%H-},SizeOf(Msg),0);
|
||||||
Msg.Msg := LM_MOUSEWHEEL;
|
Msg.Msg := LM_MOUSEWHEEL;
|
||||||
//DebugLn('Scroll ',Format('deltaX %2.2n deltaY %2.2n x %2.2n y %2.2n rootx %2.2n rooty %2.2n',
|
//DebugLn('Scroll ',Format('deltaX %2.2n deltaY %2.2n x %2.2n y %2.2n rootx %2.2n rooty %2.2n',
|
||||||
@ -2001,8 +2000,6 @@ var
|
|||||||
AEvent: TGdkEventKey;
|
AEvent: TGdkEventKey;
|
||||||
Msg: TLMKey;
|
Msg: TLMKey;
|
||||||
CharMsg: TLMChar;
|
CharMsg: TLMChar;
|
||||||
KeyCode: Word;
|
|
||||||
AShiftState: TShiftState;
|
|
||||||
AEventString: String;
|
AEventString: String;
|
||||||
KeyValue, ACharCode: Word;
|
KeyValue, ACharCode: Word;
|
||||||
LCLModifiers: Word;
|
LCLModifiers: Word;
|
||||||
@ -2014,7 +2011,7 @@ begin
|
|||||||
//TODO: finish LCL messaging
|
//TODO: finish LCL messaging
|
||||||
Result := False;
|
Result := False;
|
||||||
AEvent := Event^.key;
|
AEvent := Event^.key;
|
||||||
FillChar(Msg, SizeOf(Msg), 0);
|
FillChar(Msg{%H-}, SizeOf(Msg), 0);
|
||||||
AEventString := AEvent.string_;
|
AEventString := AEvent.string_;
|
||||||
|
|
||||||
if gdk_keyval_is_lower(AEvent.keyval) then
|
if gdk_keyval_is_lower(AEvent.keyval) then
|
||||||
@ -2149,7 +2146,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// create the CN_CHAR / CN_SYSCHAR message
|
// create the CN_CHAR / CN_SYSCHAR message
|
||||||
FillChar(CharMsg, SizeOf(CharMsg), 0);
|
FillChar(CharMsg{%H-}, SizeOf(CharMsg), 0);
|
||||||
CharMsg.Msg := CN_CharMsg[IsSysKey];
|
CharMsg.Msg := CN_CharMsg[IsSysKey];
|
||||||
CharMsg.KeyData := Msg.KeyData;
|
CharMsg.KeyData := Msg.KeyData;
|
||||||
AChar := AEventString[1];
|
AChar := AEventString[1];
|
||||||
@ -2213,7 +2210,7 @@ begin
|
|||||||
if Event^.button.send_event = NO_PROPAGATION_TO_PARENT then
|
if Event^.button.send_event = NO_PROPAGATION_TO_PARENT then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
|
|
||||||
MousePos.x := Round(Event^.button.x);
|
MousePos.x := Round(Event^.button.x);
|
||||||
MousePos.y := Round(Event^.button.y);
|
MousePos.y := Round(Event^.button.y);
|
||||||
@ -2363,9 +2360,6 @@ var
|
|||||||
AColor: TGdkRGBA;
|
AColor: TGdkRGBA;
|
||||||
i: TGtkStateType;
|
i: TGtkStateType;
|
||||||
ARgba: TGdkRGBA;
|
ARgba: TGdkRGBA;
|
||||||
R: Double;
|
|
||||||
G: Double;
|
|
||||||
B: Double;
|
|
||||||
begin
|
begin
|
||||||
// new way (gtk3) but still buggy
|
// new way (gtk3) but still buggy
|
||||||
if IsWidgetOK and (0 > 1) then
|
if IsWidgetOK and (0 > 1) then
|
||||||
@ -3209,7 +3203,7 @@ end;
|
|||||||
procedure TGtk3Panel.SetColor(AValue: TColor);
|
procedure TGtk3Panel.SetColor(AValue: TColor);
|
||||||
var
|
var
|
||||||
AGdkRGBA: TGdkRGBA;
|
AGdkRGBA: TGdkRGBA;
|
||||||
AColor: TGdkColor;
|
//AColor: TGdkColor;
|
||||||
begin
|
begin
|
||||||
inherited SetColor(AValue);
|
inherited SetColor(AValue);
|
||||||
exit;
|
exit;
|
||||||
@ -3235,7 +3229,7 @@ begin
|
|||||||
FWidget^.override_background_color(GTK_STATE_FLAG_SELECTED, @AGdkRGBA);
|
FWidget^.override_background_color(GTK_STATE_FLAG_SELECTED, @AGdkRGBA);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
AColor := TColorToTGDKColor(AValue);
|
//AColor := TColorToTGDKColor(AValue);
|
||||||
// writeln('ACOLOR R=',AColor.Red,' G=',AColor.green,' B=',AColor.blue);
|
// writeln('ACOLOR R=',AColor.Red,' G=',AColor.green,' B=',AColor.blue);
|
||||||
//inherited SetColor(AValue);
|
//inherited SetColor(AValue);
|
||||||
end;
|
end;
|
||||||
@ -3477,29 +3471,29 @@ end;
|
|||||||
|
|
||||||
{ TGtk3Entry }
|
{ TGtk3Entry }
|
||||||
|
|
||||||
procedure Gtk3EntryDeletedText(AEntry: PGtkEntryBuffer; APosition: guint; ANumChars: guint; AData: GPointer); cdecl;
|
procedure Gtk3EntryDeletedText({%H-}AEntry: PGtkEntryBuffer; {%H-}APosition: guint; {%H-}ANumChars: guint; AData: GPointer); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMessage;
|
Msg: TLMessage;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), 0);
|
FillChar(Msg{%H-}, SizeOf(Msg), 0);
|
||||||
Msg.Msg := CM_TEXTCHANGED;
|
Msg.Msg := CM_TEXTCHANGED;
|
||||||
TGtk3Widget(AData).DeliverMessage(Msg);
|
TGtk3Widget(AData).DeliverMessage(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Gtk3EntryInsertedText(AEntry: PGtkEntryBuffer; APosition: guint; AChars: PGChar; ANumChars: guint; AData: GPointer); cdecl;
|
procedure Gtk3EntryInsertedText({%H-}AEntry: PGtkEntryBuffer; {%H-}APosition: guint; {%H-}AChars: PGChar; {%H-}ANumChars: guint; AData: GPointer); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMessage;
|
Msg: TLMessage;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), 0);
|
FillChar(Msg{%H-}, SizeOf(Msg), 0);
|
||||||
Msg.Msg := CM_TEXTCHANGED;
|
Msg.Msg := CM_TEXTCHANGED;
|
||||||
TGtk3Widget(AData).DeliverMessage(Msg);
|
TGtk3Widget(AData).DeliverMessage(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Gtk3EntryChanged(AEntry: PGtkEntryBuffer; AData: GPointer); cdecl;
|
procedure Gtk3EntryChanged({%H-}AEntry: PGtkEntryBuffer; AData: GPointer); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMessage;
|
Msg: TLMessage;
|
||||||
begin
|
begin
|
||||||
FillChar(Msg, SizeOf(Msg), 0);
|
FillChar(Msg{%H-}, SizeOf(Msg), 0);
|
||||||
Msg.Msg := CM_TEXTCHANGED;
|
Msg.Msg := CM_TEXTCHANGED;
|
||||||
TGtk3Widget(AData).DeliverMessage(Msg);
|
TGtk3Widget(AData).DeliverMessage(Msg);
|
||||||
end;
|
end;
|
||||||
@ -3758,7 +3752,7 @@ end;
|
|||||||
|
|
||||||
{ TGtk3Range }
|
{ TGtk3Range }
|
||||||
|
|
||||||
procedure Gtk3RangeChanged(ARange: PGtkRange; AData: gPointer); cdecl;
|
procedure Gtk3RangeChanged({%H-}ARange: PGtkRange; AData: gPointer); cdecl;
|
||||||
var
|
var
|
||||||
Msg: TLMessage;
|
Msg: TLMessage;
|
||||||
begin
|
begin
|
||||||
@ -3766,7 +3760,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if TGtk3Widget(AData).InUpdate then
|
if TGtk3Widget(AData).InUpdate then
|
||||||
Exit;
|
Exit;
|
||||||
FillChar(Msg, SizeOf(Msg), #0);
|
FillChar(Msg{%H-}, SizeOf(Msg), #0);
|
||||||
Msg.Msg := LM_CHANGED;
|
Msg.Msg := LM_CHANGED;
|
||||||
TGtk3Widget(AData).DeliverMessage(Msg);
|
TGtk3Widget(AData).DeliverMessage(Msg);
|
||||||
end;
|
end;
|
||||||
@ -4172,7 +4166,7 @@ procedure TGtk3ProgressBar.SetStyle(AValue: TProgressBarStyle);
|
|||||||
begin
|
begin
|
||||||
if IsWidgetOk then
|
if IsWidgetOk then
|
||||||
begin
|
begin
|
||||||
g_object_set_data(GetContainerWidget,'lclprogressbarstyle', Pointer(PtrUInt(Ord(AValue))));
|
g_object_set_data(GetContainerWidget,'lclprogressbarstyle', {%H-}Pointer(PtrUInt(Ord(AValue))));
|
||||||
if AValue = pbstNormal then
|
if AValue = pbstNormal then
|
||||||
begin
|
begin
|
||||||
Position := TCustomProgressBar(LCLObject).Position;
|
Position := TCustomProgressBar(LCLObject).Position;
|
||||||
@ -4225,9 +4219,10 @@ end;
|
|||||||
|
|
||||||
function TGtk3ProgressBar.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
function TGtk3ProgressBar.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
||||||
var
|
var
|
||||||
AProgres: TCustomProgressBar;
|
AProgress: TCustomProgressBar;
|
||||||
begin
|
begin
|
||||||
AProgres := TCustomProgressBar(LCLObject);
|
AProgress := TCustomProgressBar(LCLObject);
|
||||||
|
if AProgress=nil then ;
|
||||||
FWidgetType := FWidgetType + [wtProgressBar];
|
FWidgetType := FWidgetType + [wtProgressBar];
|
||||||
Result := TGtkEventBox.new;
|
Result := TGtkEventBox.new;
|
||||||
FCentralWidget := TGtkProgressBar.new;
|
FCentralWidget := TGtkProgressBar.new;
|
||||||
@ -4474,6 +4469,7 @@ var
|
|||||||
NMHdr: tagNMHDR;
|
NMHdr: tagNMHDR;
|
||||||
LCLPageIndex: Integer;
|
LCLPageIndex: Integer;
|
||||||
begin
|
begin
|
||||||
|
if widget=nil then ;
|
||||||
if TGtk3Widget(Data).InUpdate then
|
if TGtk3Widget(Data).InUpdate then
|
||||||
exit;
|
exit;
|
||||||
{page is deleted}
|
{page is deleted}
|
||||||
@ -4507,10 +4503,11 @@ begin
|
|||||||
if g_object_get_data(AWidget,'switch-page-signal-stopped') <> nil then
|
if g_object_get_data(AWidget,'switch-page-signal-stopped') <> nil then
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
APageNum := PtrInt(g_object_get_data(AWidget,'switch-page-signal-stopped'));
|
APageNum := {%H-}PtrInt(g_object_get_data(AWidget,'switch-page-signal-stopped'));
|
||||||
ACurrentPage := AWidget^.get_current_page;
|
ACurrentPage := AWidget^.get_current_page;
|
||||||
g_object_set_data(AWidget,'switch-page-signal-stopped', nil);
|
g_object_set_data(AWidget,'switch-page-signal-stopped', nil);
|
||||||
DebugLn('BackNoteBookSignal back notebook switch-page signal currpage=',dbgs(AWidget^.get_current_page),' blockedPage ',dbgs(APageNum));
|
DebugLn('BackNoteBookSignal back notebook switch-page signal currpage=',dbgs(AWidget^.get_current_page),' blockedPage ',dbgs(APageNum));
|
||||||
|
if ACurrentPage<0 then ;
|
||||||
// must hook into notebook^.priv to unlock APageNum
|
// must hook into notebook^.priv to unlock APageNum
|
||||||
// AWidget^.set_current_page(AWidget^.get_current_page);
|
// AWidget^.set_current_page(AWidget^.get_current_page);
|
||||||
// g_object_thaw_notify(AWidget^.get_nth_page(AWidget^.get_current_page));
|
// g_object_thaw_notify(AWidget^.get_nth_page(AWidget^.get_current_page));
|
||||||
@ -4531,7 +4528,7 @@ begin
|
|||||||
if TGtk3Widget(Data).InUpdate then
|
if TGtk3Widget(Data).InUpdate then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
DebugLn('GtkNotebookSwitchPage Data ',dbgHex(PtrUInt(Data)),' Realized ',dbgs(Widget^.get_realized),' pageNum=',dbgs(pageNum));
|
DebugLn('GtkNotebookSwitchPage Data ',dbgHex({%H-}PtrUInt(Data)),' Realized ',dbgs(Widget^.get_realized),' pageNum=',dbgs(pageNum));
|
||||||
|
|
||||||
{page is deleted}
|
{page is deleted}
|
||||||
if TGtk3NoteBook(Data).getPagesCount < TCustomTabControl(TGtk3NoteBook(Data).LCLObject).PageCount then
|
if TGtk3NoteBook(Data).getPagesCount < TCustomTabControl(TGtk3NoteBook(Data).LCLObject).PageCount then
|
||||||
@ -4553,7 +4550,7 @@ begin
|
|||||||
TGtk3Widget(Data).DeliverMessage(Mess);
|
TGtk3Widget(Data).DeliverMessage(Mess);
|
||||||
if Mess.Result <> 0 then
|
if Mess.Result <> 0 then
|
||||||
begin
|
begin
|
||||||
g_object_set_data(Widget,'switch-page-signal-stopped', GPointer(pageNum));
|
g_object_set_data(Widget,'switch-page-signal-stopped', {%H-}GPointer(pageNum));
|
||||||
g_signal_stop_emission_by_name(PGObject(Widget), 'switch-page');
|
g_signal_stop_emission_by_name(PGObject(Widget), 'switch-page');
|
||||||
// GtkNotebookAfterSwitchPage(Widget, page, pagenum, data);
|
// GtkNotebookAfterSwitchPage(Widget, page, pagenum, data);
|
||||||
g_idle_add(@BackNoteBookSignal, Widget);
|
g_idle_add(@BackNoteBookSignal, Widget);
|
||||||
@ -4564,7 +4561,11 @@ end;
|
|||||||
function GtkNotebookSelectPage(ANoteBook: PGtkNotebook; p1: gboolean; Data: gPointer): GBoolean; cdecl;
|
function GtkNotebookSelectPage(ANoteBook: PGtkNotebook; p1: gboolean; Data: gPointer): GBoolean; cdecl;
|
||||||
begin
|
begin
|
||||||
// does not trigger for some reason
|
// does not trigger for some reason
|
||||||
|
if ANoteBook=nil then ;
|
||||||
|
if p1 then ;
|
||||||
|
if Data=nil then ;
|
||||||
DebugLn('GtkNotebookSelectPage ');
|
DebugLn('GtkNotebookSelectPage ');
|
||||||
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3NoteBook.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
function TGtk3NoteBook.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
||||||
@ -4636,7 +4637,6 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
AWidget: PGtkWidget;
|
AWidget: PGtkWidget;
|
||||||
AMinimumH, ANaturalH, ANaturalW, AMinimumW: gint;
|
AMinimumH, ANaturalH, ANaturalW, AMinimumW: gint;
|
||||||
AChild: PGtkWidget;
|
|
||||||
begin
|
begin
|
||||||
AList := ANoteBook^.get_children;
|
AList := ANoteBook^.get_children;
|
||||||
for i := 0 to g_list_length(AList) - 1 do
|
for i := 0 to g_list_length(AList) - 1 do
|
||||||
@ -4644,7 +4644,6 @@ begin
|
|||||||
AWidget := PGtkWidget(g_list_nth_data(AList, I));
|
AWidget := PGtkWidget(g_list_nth_data(AList, I));
|
||||||
AWidget^.get_preferred_height(@AMinimumH, @ANaturalH);
|
AWidget^.get_preferred_height(@AMinimumH, @ANaturalH);
|
||||||
AWidget^.get_preferred_width(@AMinimumW, @ANaturalW);
|
AWidget^.get_preferred_width(@AMinimumW, @ANaturalW);
|
||||||
AChild := nil;
|
|
||||||
DebugLn(Format('Child[%d] MinH %d NatH %d MinW %d NatW %d ALLOCW %d ALLOCH %d child_type %s',
|
DebugLn(Format('Child[%d] MinH %d NatH %d MinW %d NatW %d ALLOCW %d ALLOCH %d child_type %s',
|
||||||
[I, AMinimumH, ANaturalH, AMinimumW, ANaturalW,
|
[I, AMinimumH, ANaturalH, AMinimumW, ANaturalW,
|
||||||
AWidget^.get_allocated_width, AWidget^.get_allocated_height, g_type_name(ANotebook^.child_type)]));
|
AWidget^.get_allocated_width, AWidget^.get_allocated_height, g_type_name(ANotebook^.child_type)]));
|
||||||
@ -4846,7 +4845,7 @@ begin
|
|||||||
if (ndx>0) then
|
if (ndx>0) then
|
||||||
begin
|
begin
|
||||||
ParentMenu:=menuItem.Parent.Items[ndx-1];
|
ParentMenu:=menuItem.Parent.Items[ndx-1];
|
||||||
if (MenuItem.GroupIndex>=0) and (ParentMenu.GroupIndex=MenuItem.GroupIndex) then
|
if (ParentMenu.GroupIndex=MenuItem.GroupIndex) then
|
||||||
begin
|
begin
|
||||||
pl:=PGtkRadioMenuItem(TGtk3MenuItem(ParentMenu.Handle).Widget)^.get_group;
|
pl:=PGtkRadioMenuItem(TGtk3MenuItem(ParentMenu.Handle).Widget)^.get_group;
|
||||||
PGtkRadioMenuItem(Result)^.set_group(pl);
|
PGtkRadioMenuItem(Result)^.set_group(pl);
|
||||||
|
Loading…
Reference in New Issue
Block a user