1537
1536
Allocated a GDKColor from a winapi color
1538
1537
------------------------------------------------------------------------------}
1539
function AllocGDKColor(const AColor: LongInt): TGDKColor;
1538
function AllocGDKColor(const AColor: TColorRef): TGDKColor;
2248
2247
Msg.KeyData := CommonKeyData or (Flags shl 16) or $0001 {TODO: repeatcount};
2250
2249
// send the (Sys)KeyDown message directly to the LCL
2251
NotifyApplicationUserInput(Msg.Msg);
2250
NotifyApplicationUserInput(TControl(TargetObj), Msg.Msg);
2252
2251
DeliverKeyMessage(TargetObj, Msg);
2401
2400
if not KeyAlreadyHandledByGtk
2403
2402
// send the (Sys)KeyDown message directly to the LCL
2404
NotifyApplicationUserInput(Msg.Msg);
2403
NotifyApplicationUserInput(TControl(TargetObj), Msg.Msg);
2405
2404
if DeliverKeyMessage(TargetObj, Msg)
2406
2405
and (Msg.CharCode <> Vkey) then
2425
2424
// send the message directly to the LCL
2427
NotifyApplicationUserInput(Msg.Msg);
2426
NotifyApplicationUserInput(TControl(TargetObj), Msg.Msg);
2429
2428
if DeliverKeyMessage(TargetObj, Msg)
2430
2429
and (Msg.CharCode <> VKey)
3157
3156
procedure UpdateModifierMap(const AModMap: TModMap; AKeyCode: Byte; AKeySym: Cardinal);
3158
3158
{$ifdef VerboseModifiermap}
3160
STATE_NAME: array[TShiftStateEnum] of String = ('ssShift', 'ssAlt', 'ssCtrl',
3161
'ssLeft', 'ssRight', 'ssMiddle', 'ssDouble',
3162
'ssMeta', 'ssSuper', 'ssHyper', 'ssAltGr', 'ssCaps', 'ssNum',
3163
'ssScroll', 'ssTriple', 'ssQuad', 'ssExtra1', 'ssExtra2');
3166
3161
ShiftState: TShiftStateEnum;
3168
3163
if AModMap[AKeyCode] = 0 then Exit;
3197
3192
MModifiers[ShiftState].UseValue := False;
3199
3194
{$ifdef VerboseModifiermap}
3200
DebugLn('Mapped keycode=%u, keysym=$%x, modifier=$%2.2x to shiftstate %s', [AKeyCode, AKeySym, AModMap[AKeyCode], STATE_NAME[ShiftState]]);
3195
WriteStr(s, ShiftState);
3196
DebugLn('Mapped keycode=%u, keysym=$%x, modifier=$%2.2x to shiftstate %s',
3197
[AKeyCode, AKeySym, AModMap[AKeyCode], s]);
3277
3274
FillChar(XKeyEvent, SizeOf(XKeyEvent), 0);
3278
3275
XKeyEvent._Type := GDK_KEY_PRESS;
3279
3276
XKeyEvent.Display := XDisplay;
3281
XKeyEvent.Same_Screen := True;
3283
3277
XKeyEvent.Same_Screen := 1;
3286
3279
// Retrieve the KeyCode bounds
3287
3280
XDisplayKeyCodes(XDisplay, @LoKey, @HiKey);
3813
3806
handle := TCommonDialog(AnObject).Handle;
3816
Assert(False, Format('Trace: [ObjectToGtkObject] Message received with unhandled class-type <%s>', [AnObject.ClassName]));
3809
//DebugLn(Format('Trace: [ObjectToGtkObject] Message received with unhandled class-type <%s>', [AnObject.ClassName]));
3818
3811
Result := PGTKObject(handle);
3819
3812
if handle = 0 then
4306
4299
ClientWidget: PGtkWidget;
4307
4300
NoteBookWidget: PGtkNotebook;
4309
if not TCustomNotebook(ANoteBook).HandleAllocated then exit;
4310
NoteBookWidget := PGtkNotebook(TCustomNotebook(ANoteBook).Handle);
4302
if not TCustomTabControl(ANoteBook).HandleAllocated then exit;
4303
NoteBookWidget := PGtkNotebook(TCustomTabControl(ANoteBook).Handle);
4311
4304
ClientWidget := nil;
4312
4305
SetFixedWidget(NoteBookWidget, ClientWidget);
4362
Loads the image for the close button in the tabs of the TCustomNoteBook(s).
4355
Loads the image for the close button in the tabs of the TCustomTabControl(s).
4363
4356
-------------------------------------------------------------------------------}
4365
4358
procedure GetNoteBookCloseBtnImage(Window: PGdkWindow;
4378
4371
{-------------------------------------------------------------------------------
4379
4372
method UpdateNotebookPageTab
4380
Params: ANoteBook: TCustomNotebook; APage: TCustomPage
4373
Params: ANoteBook: TCustomTabControl; APage: TCustomPage
4383
4376
Updates the tab of a page of a notebook. This contains the image to the left
4385
4378
-------------------------------------------------------------------------------}
4386
4379
procedure UpdateNotebookPageTab(ANoteBook, APage: TObject);
4388
TheNoteBook: TCustomNotebook;
4381
TheNoteBook: TCustomTabControl;
4389
4382
ThePage: TCustomPage;
4391
4384
NoteBookWidget: PGtkWidget; // the notebook
4565
4558
ThePage := TCustomPage(APage);
4566
TheNoteBook := TCustomNotebook(ANoteBook);
4559
TheNoteBook := TCustomTabControl(ANoteBook);
4567
4560
if (APage=nil) or (not ThePage.HandleAllocated) then exit;
4568
4561
if TheNoteBook=nil then begin
4569
TheNoteBook:=TCustomNotebook(ThePage.Parent);
4562
TheNoteBook:=TCustomTabControl(ThePage.Parent);
4570
4563
if TheNoteBook=nil then exit;
4572
4565
NoteBookWidget:=PGtkWidget(TWinControl(TheNoteBook).Handle);
6049
6042
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem; MenuItemWidget: PGtkWidget);
6051
UpdateInnerMenuItem(LCLMenuItem, MenuItemWidget, LCLMenuItem.ShortCut);
6044
UpdateInnerMenuItem(LCLMenuItem, MenuItemWidget, LCLMenuItem.ShortCut, LCLMenuItem.ShortCutKey2);
6054
6047
{------------------------------------------------------------------------------
6055
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem;
6056
MenuItemWidget: PGtkWidget; NewShortCut: TShortCut);
6058
6048
Update the inner widgets of a menuitem widget.
6059
6049
------------------------------------------------------------------------------}
6060
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem;
6061
MenuItemWidget: PGtkWidget; NewShortCut: TShortCut);
6050
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem; MenuItemWidget: PGtkWidget;
6051
NewShortCut, ShortCutKey2: TShortCut);
6064
6054
WidgetDirection : array[boolean] of longint = (GTK_TEXT_DIR_LTR, GTK_TEXT_DIR_RTL);
6089
6079
LabelWidget: PGtkLabel;
6090
6080
NeedShortCut: Boolean;
6082
Shift, Shift2: TShiftState;
6095
6085
//DebugLn(['UpdateShortCutLabel ',dbgsName(LCLMenuItem),' ',ShortCutToText(NewShortCut)]);
6096
6086
ShortCutToKey(NewShortCut, Key, Shift);
6098
// check if shortcut is needed
6099
NeedShortCut := Key <> 0;
6102
(LCLMenuItem.Parent <> nil) and
6103
LCLMenuItem.Parent.HandleAllocated and
6104
GtkWidgetIsA(PGtkWidget(LCLMenuItem.Parent.Handle), GTK_TYPE_MENU_BAR) then
6106
// no shortcut captions for items in menubar
6107
NeedShortCut := False;
6110
LabelWidget := PGtkLabel(gtk_object_get_data(PGtkObject(MenuItemWidget),
6111
'LCLShortCutLabel'));
6087
ShortCutToKey(ShortCutKey2, Key2, Shift2);
6089
// Check if shortcut is needed. No shortcut captions for items in menubar
6090
NeedShortCut := (Key <> 0) and
6091
not ( (LCLMenuItem.Parent <> nil) and LCLMenuItem.Parent.HandleAllocated and
6092
GtkWidgetIsA(PGtkWidget(LCLMenuItem.Parent.Handle), GTK_TYPE_MENU_BAR) );
6094
LabelWidget := PGtkLabel(gtk_object_get_data(PGtkObject(MenuItemWidget),'LCLShortCutLabel'));
6113
6095
if NeedShortCut then
6115
ShortCutToKey(NewShortCut, Key, Shift);
6116
6097
s := GetAcceleratorString(Key, Shift);
6099
s := s + ', ' + GetAcceleratorString(Key2, Shift2);
6117
6100
// ShortCutToText(NewShortCut);
6118
6101
if LabelWidget = nil then