mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 18:21:26 +02:00
gtk1 intf: fixed compilation
git-svn-id: trunk@25272 -
This commit is contained in:
parent
1bb0bd225f
commit
28419cb0f7
@ -5946,6 +5946,9 @@ begin
|
|||||||
gtk_widget_get_xthickness(gtk_widget_get_style(Widget)) +
|
gtk_widget_get_xthickness(gtk_widget_get_style(Widget)) +
|
||||||
HorizPadding +
|
HorizPadding +
|
||||||
((PGtkMenuItem(MenuItem)^.toggle_size-ToggleSpacing-IconWidth) div 2);
|
((PGtkMenuItem(MenuItem)^.toggle_size-ToggleSpacing-IconWidth) div 2);
|
||||||
|
|
||||||
|
if gtk_widget_get_direction(Widget) = GTK_TEXT_DIR_RTL then
|
||||||
|
ALeft := Widget^.Allocation.width - IconWidth - ALeft; //not sure it is the correct Width
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
ALeft := (BorderWidth + gtk_widget_get_xthickness(gtk_widget_get_style(Widget)) + 2)
|
ALeft := (BorderWidth + gtk_widget_get_xthickness(gtk_widget_get_style(Widget)) + 2)
|
||||||
+((PGtkMenuItem(MenuItem)^.toggle_size-IconWidth) div 2);
|
+((PGtkMenuItem(MenuItem)^.toggle_size-IconWidth) div 2);
|
||||||
@ -5953,9 +5956,6 @@ begin
|
|||||||
|
|
||||||
ATop := (Widget^.Allocation.Height - IconHeight) div 2;
|
ATop := (Widget^.Allocation.Height - IconHeight) div 2;
|
||||||
|
|
||||||
if gtk_widget_get_direction(Widget) = GTK_TEXT_DIR_RTL then
|
|
||||||
ALeft := Widget^.Allocation.width - IconWidth - ALeft; //not sure it is the correct Width
|
|
||||||
|
|
||||||
// draw icon
|
// draw icon
|
||||||
AImageList := LCLMenuItem.GetImageList;
|
AImageList := LCLMenuItem.GetImageList;
|
||||||
if AImageList = nil then
|
if AImageList = nil then
|
||||||
@ -6059,8 +6059,10 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem;
|
procedure UpdateInnerMenuItem(LCLMenuItem: TMenuItem;
|
||||||
MenuItemWidget: PGtkWidget; NewShortCut: TShortCut);
|
MenuItemWidget: PGtkWidget; NewShortCut: TShortCut);
|
||||||
|
{$ifdef GTK2}
|
||||||
const
|
const
|
||||||
WidgetDirection : array[boolean] of longint = (GTK_TEXT_DIR_LTR, GTK_TEXT_DIR_RTL);
|
WidgetDirection : array[boolean] of longint = (GTK_TEXT_DIR_LTR, GTK_TEXT_DIR_RTL);
|
||||||
|
{$endif}
|
||||||
function UseRTL: Boolean;
|
function UseRTL: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := LCLMenuItem.GetIsRightToLeft;
|
Result := LCLMenuItem.GetIsRightToLeft;
|
||||||
@ -6077,7 +6079,9 @@ var
|
|||||||
Exit;
|
Exit;
|
||||||
LabelWidget := gtk_object_get_data(PGtkObject(MenuItemWidget), 'LCLLabel');
|
LabelWidget := gtk_object_get_data(PGtkObject(MenuItemWidget), 'LCLLabel');
|
||||||
GtkWidgetset.SetLabelCaption(LabelWidget, LCLMenuItem.Caption);
|
GtkWidgetset.SetLabelCaption(LabelWidget, LCLMenuItem.Caption);
|
||||||
|
{$ifdef GTK2}
|
||||||
gtk_widget_set_direction(PGtkWidget(LabelWidget), WidgetDirection[UseRTL]);
|
gtk_widget_set_direction(PGtkWidget(LabelWidget), WidgetDirection[UseRTL]);
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateShortCutLabel;
|
procedure UpdateShortCutLabel;
|
||||||
@ -6123,7 +6127,9 @@ var
|
|||||||
begin
|
begin
|
||||||
gtk_label_set_text(LabelWidget, PChar(Pointer(s)));
|
gtk_label_set_text(LabelWidget, PChar(Pointer(s)));
|
||||||
end;
|
end;
|
||||||
|
{$ifdef GTK2}
|
||||||
gtk_widget_set_direction(PGtkWidget(LabelWidget), GTK_TEXT_DIR_LTR); //Shortcut always LTR
|
gtk_widget_set_direction(PGtkWidget(LabelWidget), GTK_TEXT_DIR_LTR); //Shortcut always LTR
|
||||||
|
{$endif}
|
||||||
if UseRTL then
|
if UseRTL then
|
||||||
gtk_misc_set_alignment(GTK_MISC(LabelWidget), 0.0, 0.5)
|
gtk_misc_set_alignment(GTK_MISC(LabelWidget), 0.0, 0.5)
|
||||||
else
|
else
|
||||||
@ -6206,7 +6212,9 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
HBoxWidget := gtk_hbox_new(false, 20);
|
HBoxWidget := gtk_hbox_new(false, 20);
|
||||||
|
{$ifdef GTK2}
|
||||||
gtk_widget_set_direction(PGtkWidget(HBoxWidget), WidgetDirection[UseRTL]);
|
gtk_widget_set_direction(PGtkWidget(HBoxWidget), WidgetDirection[UseRTL]);
|
||||||
|
{$endif}
|
||||||
gtk_object_set_data(PGtkObject(MenuItemWidget), 'LCLHBox', HBoxWidget);
|
gtk_object_set_data(PGtkObject(MenuItemWidget), 'LCLHBox', HBoxWidget);
|
||||||
CreateIcon;
|
CreateIcon;
|
||||||
CreateLabel;
|
CreateLabel;
|
||||||
@ -6224,7 +6232,9 @@ begin
|
|||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
// just update the content
|
// just update the content
|
||||||
|
{$ifdef GTK2}
|
||||||
gtk_widget_set_direction(PGtkWidget(HBoxWidget), WidgetDirection[UseRTL]);
|
gtk_widget_set_direction(PGtkWidget(HBoxWidget), WidgetDirection[UseRTL]);
|
||||||
|
{$endif}
|
||||||
SetMenuItemLabelText(LCLMenuItem, MenuItemWidget);
|
SetMenuItemLabelText(LCLMenuItem, MenuItemWidget);
|
||||||
UpdateShortCutLabel;
|
UpdateShortCutLabel;
|
||||||
end;
|
end;
|
||||||
|
@ -337,6 +337,12 @@ var
|
|||||||
WidgetInfo: PWidgetInfo;
|
WidgetInfo: PWidgetInfo;
|
||||||
Box: Pointer;
|
Box: Pointer;
|
||||||
ParentForm: TCustomForm;
|
ParentForm: TCustomForm;
|
||||||
|
{$ifdef GTK2}
|
||||||
|
const
|
||||||
|
MenuDirection : array[Boolean] of Longint = (
|
||||||
|
GTK_PACK_DIRECTION_LTR,
|
||||||
|
GTK_PACK_DIRECTION_RTL);
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
Widget := gtk_menu_bar_new();
|
Widget := gtk_menu_bar_new();
|
||||||
// get the VBox, the form has one child, a VBox
|
// get the VBox, the form has one child, a VBox
|
||||||
@ -351,7 +357,7 @@ begin
|
|||||||
gtk_box_pack_start(Box, Widget, False, False, 0);
|
gtk_box_pack_start(Box, Widget, False, False, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef GTK_2_8}
|
{$ifdef GTK2}
|
||||||
gtk_menu_bar_set_pack_direction(PGtkMenuBar(Widget), MenuDirection[AMenu.UseRightToLeftAlignment]);
|
gtk_menu_bar_set_pack_direction(PGtkMenuBar(Widget), MenuDirection[AMenu.UseRightToLeftAlignment]);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user