Merge branch 'main' into 'main'

GTK3: Migrate several C enum type to enumeration type.

See merge request freepascal.org/lazarus/lazarus!185
This commit is contained in:
Maxim Ganetsky 2023-06-01 23:27:18 +00:00
commit 9ce42e1fbb
4 changed files with 47 additions and 51 deletions

View File

@ -2689,6 +2689,25 @@ type
GDK_TOUCH_CANCEL = 40, GDK_TOUCH_CANCEL = 40,
GDK_EVENT_LAST = 41 GDK_EVENT_LAST = 41
); );
TGdkScrollDirection = (
TGdkScrollDirectionMinValue = -$7FFFFFFF,
GDK_SCROLL_UP = 0,
GDK_SCROLL_DOWN = 1,
GDK_SCROLL_LEFT = 2,
GDK_SCROLL_RIGHT = 3,
GDK_SCROLL_SMOOTH = 4,
TGdkScrollDirectionMaxValue = $7FFFFFFF
);
TGdkVisualType = (
TGdkVisualTypeMinValue = -$7FFFFFFF,
GDK_VISUAL_STATIC_GRAY = 0,
GDK_VISUAL_GRAYSCALE = 1,
GDK_VISUAL_STATIC_COLOR = 2,
GDK_VISUAL_PSEUDO_COLOR = 3,
GDK_VISUAL_TRUE_COLOR = 4,
GDK_VISUAL_DIRECT_COLOR = 5,
TGdkVisualTypeMaxValue = $7FFFFFFF
);
type type
TGdkVisibilityState = Integer; TGdkVisibilityState = Integer;
@ -2698,16 +2717,6 @@ const
GDK_VISIBILITY_PARTIAL: TGdkVisibilityState = 1; GDK_VISIBILITY_PARTIAL: TGdkVisibilityState = 1;
GDK_VISIBILITY_FULLY_OBSCURED: TGdkVisibilityState = 2; GDK_VISIBILITY_FULLY_OBSCURED: TGdkVisibilityState = 2;
type
TGdkScrollDirection = Integer;
const
{ GdkScrollDirection }
GDK_SCROLL_UP: TGdkScrollDirection = 0;
GDK_SCROLL_DOWN: TGdkScrollDirection = 1;
GDK_SCROLL_LEFT: TGdkScrollDirection = 2;
GDK_SCROLL_RIGHT: TGdkScrollDirection = 3;
GDK_SCROLL_SMOOTH: TGdkScrollDirection = 4;
type type
TGdkNotifyType = Integer; TGdkNotifyType = Integer;
const const
@ -2820,17 +2829,6 @@ const
GDK_PROP_MODE_PREPEND: TGdkPropMode = 1; GDK_PROP_MODE_PREPEND: TGdkPropMode = 1;
GDK_PROP_MODE_APPEND: TGdkPropMode = 2; GDK_PROP_MODE_APPEND: TGdkPropMode = 2;
type
TGdkVisualType = Integer;
const
{ GdkVisualType }
GDK_VISUAL_STATIC_GRAY: TGdkVisualType = 0;
GDK_VISUAL_GRAYSCALE: TGdkVisualType = 1;
GDK_VISUAL_STATIC_COLOR: TGdkVisualType = 2;
GDK_VISUAL_PSEUDO_COLOR: TGdkVisualType = 3;
GDK_VISUAL_TRUE_COLOR: TGdkVisualType = 4;
GDK_VISUAL_DIRECT_COLOR: TGdkVisualType = 5;
type type
TGdkStatus = Integer; TGdkStatus = Integer;
const const

View File

@ -907,6 +907,12 @@ type
GTK_LEVEL_BAR_MODE_DISCRETE = 1, GTK_LEVEL_BAR_MODE_DISCRETE = 1,
TGtkLevelBarModeMaxValue = $7FFFFFFF TGtkLevelBarModeMaxValue = $7FFFFFFF
); );
TGtkSortType = (
TGtkSortTypeMinValue = -$7FFFFFFF,
GTK_SORT_ASCENDING = 0,
GTK_SORT_DESCENDING = 1,
TGtkSortTypeMaxValue = $7FFFFFFF
);
TGtkPackDirection = ( TGtkPackDirection = (
TGtkPackDirectionMinValue = -$7FFFFFFF, TGtkPackDirectionMinValue = -$7FFFFFFF,
GTK_PACK_DIRECTION_LTR = 0, GTK_PACK_DIRECTION_LTR = 0,
@ -1220,6 +1226,13 @@ type
GTK_TOOL_PALETTE_DRAG_GROUPS = 2, GTK_TOOL_PALETTE_DRAG_GROUPS = 2,
TGtkToolPaletteDragTargetsMaxValue = $7FFFFFFF TGtkToolPaletteDragTargetsMaxValue = $7FFFFFFF
); );
TGtkTreeViewColumnSizing = (
TGtkTreeViewColumnSizingMinValue = -$7FFFFFFF,
GTK_TREE_VIEW_COLUMN_GROW_ONLY = 0,
GTK_TREE_VIEW_COLUMN_AUTOSIZE = 1,
GTK_TREE_VIEW_COLUMN_FIXED = 2,
TGtkTreeViewColumnSizingMaxValue = $7FFFFFFF
);
TGtkTreeViewDropPosition = ( TGtkTreeViewDropPosition = (
TGtkTreeViewDropPositionMinValue = -$7FFFFFFF, TGtkTreeViewDropPositionMinValue = -$7FFFFFFF,
GTK_TREE_VIEW_DROP_BEFORE = 0, GTK_TREE_VIEW_DROP_BEFORE = 0,
@ -1298,13 +1311,6 @@ const
GTK_ICON_LOOKUP_GENERIC_FALLBACK: TGtkIconLookupFlags = 8; GTK_ICON_LOOKUP_GENERIC_FALLBACK: TGtkIconLookupFlags = 8;
GTK_ICON_LOOKUP_FORCE_SIZE: TGtkIconLookupFlags = 16; GTK_ICON_LOOKUP_FORCE_SIZE: TGtkIconLookupFlags = 16;
type
TGtkSortType = Integer;
const
{ GtkSortType }
GTK_SORT_ASCENDING: TGtkSortType = 0;
GTK_SORT_DESCENDING: TGtkSortType = 1;
type type
TGtkRcTokenType = Integer; TGtkRcTokenType = Integer;
const const
@ -1385,14 +1391,6 @@ const
GTK_TOOLBAR_SPACE_EMPTY: TGtkToolbarSpaceStyle = 0; GTK_TOOLBAR_SPACE_EMPTY: TGtkToolbarSpaceStyle = 0;
GTK_TOOLBAR_SPACE_LINE: TGtkToolbarSpaceStyle = 1; GTK_TOOLBAR_SPACE_LINE: TGtkToolbarSpaceStyle = 1;
type
TGtkTreeViewColumnSizing = Integer;
const
{ GtkTreeViewColumnSizing }
GTK_TREE_VIEW_COLUMN_GROW_ONLY: TGtkTreeViewColumnSizing = 0;
GTK_TREE_VIEW_COLUMN_AUTOSIZE: TGtkTreeViewColumnSizing = 1;
GTK_TREE_VIEW_COLUMN_FIXED: TGtkTreeViewColumnSizing = 2;
type type
TGtkUIManagerItemType = Integer; TGtkUIManagerItemType = Integer;
const const

View File

@ -598,12 +598,12 @@ begin
end else end else
begin begin
case Visual^.get_visual_type of case Visual^.get_visual_type of
0 {GDK_VISUAL_STATIC_GRAY}: ADesc.Format:=ricfGray; GDK_VISUAL_STATIC_GRAY {0} : ADesc.Format:=ricfGray;
1 {GDK_VISUAL_GRAYSCALE}: ADesc.Format:=ricfGray; GDK_VISUAL_GRAYSCALE {1} : ADesc.Format:=ricfGray;
2 {GDK_VISUAL_STATIC_COLOR}: ADesc.Format:=ricfGray; // this is not really gray, but an index in a color map, but colormaps are not supported yet, so use gray GDK_VISUAL_STATIC_COLOR {2} : ADesc.Format:=ricfGray; // this is not really gray, but an index in a color map, but colormaps are not supported yet, so use gray
3 {GDK_VISUAL_PSEUDO_COLOR}: ADesc.Format:=ricfGray; GDK_VISUAL_PSEUDO_COLOR {3} : ADesc.Format:=ricfGray;
4 {GDK_VISUAL_TRUE_COLOR}: ADesc.Format:=ricfRGBA; GDK_VISUAL_TRUE_COLOR {4} : ADesc.Format:=ricfRGBA;
5 {GDK_VISUAL_DIRECT_COLOR}: ADesc.Format:=ricfRGBA; GDK_VISUAL_DIRECT_COLOR {5} : ADesc.Format:=ricfRGBA;
else else
DebugLn('TGtk3WidgetSet.GetWindowRawImageDescription unknown Visual type ', DebugLn('TGtk3WidgetSet.GetWindowRawImageDescription unknown Visual type ',
dbgs(Integer(Visual^.get_visual_type))); dbgs(Integer(Visual^.get_visual_type)));

View File

@ -1616,10 +1616,10 @@ begin
{$ENDIF} {$ENDIF}
Result := False; Result := False;
case AEvent^.scroll.direction of case AEvent^.scroll.direction of
0, 1{GDK_SCROLL_UP, GDK_SCROLL_UP, {0}
GDK_SCROLL_DOWN}: Msg.Msg := LM_VSCROLL; GDK_SCROLL_DOWN {1}: Msg.Msg := LM_VSCROLL;
2, 3{GDK_SCROLL_LEFT, GDK_SCROLL_LEFT, {2}
GDK_SCROLL_RIGHT}: Msg.Msg := LM_HSCROLL; GDK_SCROLL_RIGHT {3}: Msg.Msg := LM_HSCROLL;
else else
begin begin
if AEvent^.scroll.direction = GDK_SCROLL_SMOOTH then if AEvent^.scroll.direction = GDK_SCROLL_SMOOTH then
@ -1697,8 +1697,8 @@ begin
FillChar(MessE{%H-},SizeOf(MessE),0); FillChar(MessE{%H-},SizeOf(MessE),0);
MessE.Msg := LM_MOUSEWHEEL; MessE.Msg := LM_MOUSEWHEEL;
case AEvent^.scroll.direction of case AEvent^.scroll.direction of
0 {GDK_SCROLL_UP}: MessE.WheelDelta := 120; GDK_SCROLL_UP {0}: MessE.WheelDelta := 120;
1 {GDK_SCROLL_DOWN}: MessE.WheelDelta := -120; GDK_SCROLL_DOWN {1}: MessE.WheelDelta := -120;
else else
exit; exit;
end; end;
@ -6241,8 +6241,8 @@ procedure TGtk3ListView.SetColumnAutoSize(AIndex: Integer;
AColumn: TListColumn; AAutoSize: Boolean); AColumn: TListColumn; AAutoSize: Boolean);
const const
SizingMap: array[Boolean] of TGtkTreeViewColumnSizing = ( SizingMap: array[Boolean] of TGtkTreeViewColumnSizing = (
2 {GTK_TREE_VIEW_COLUMN_FIXED}, GTK_TREE_VIEW_COLUMN_FIXED {2},
1 {GTK_TREE_VIEW_COLUMN_AUTOSIZE} GTK_TREE_VIEW_COLUMN_AUTOSIZE {1}
); );
var var
AGtkColumn: PGtkTreeViewColumn; AGtkColumn: PGtkTreeViewColumn;
@ -6332,7 +6332,7 @@ end;
procedure TGtk3ListView.ColumnSetSortIndicator(const AIndex: Integer; procedure TGtk3ListView.ColumnSetSortIndicator(const AIndex: Integer;
const AColumn: TListColumn; const ASortIndicator: TSortIndicator); const AColumn: TListColumn; const ASortIndicator: TSortIndicator);
const const
GtkOrder : array [ TSortIndicator] of TGtkSortType = (0, {GTK_SORT_ASCENDING}0, {GTK_SORT_DESCENDING}1); GtkOrder : array [ TSortIndicator] of TGtkSortType = (GTK_SORT_ASCENDING {0}, GTK_SORT_ASCENDING {0}, GTK_SORT_DESCENDING {1});
var var
AGtkColumn: PGtkTreeViewColumn; AGtkColumn: PGtkTreeViewColumn;
begin begin