diff --git a/components/nvidia-widgets/examples/example.pp b/components/nvidia-widgets/examples/example.pp
index 19cb0a11d..46abe7940 100644
--- a/components/nvidia-widgets/examples/example.pp
+++ b/components/nvidia-widgets/examples/example.pp
@@ -6,7 +6,7 @@ program example;
uses
Classes, SysUtils,
GLut, GL, GLu,
- nvWidgets, nvGlutWidgets;
+ nvTypes, nvGlutContext, nvGLPainter, GLFreeTypeFont;
type
UIOption = (
@@ -169,6 +169,8 @@ begin
glutCreateWindow('UI example');
ui := GlutUIContext.Create;
+ ui.Painter := GLUIPainter.Create;
+ ui.Painter.Font := TGLFreeTypeFont.Create('Ubuntu-R.ttf', 10);
if not ui.init(win_w, win_h) then
begin
diff --git a/components/nvidia-widgets/examples/widget_test.lpi b/components/nvidia-widgets/examples/widget_test.lpi
index 35add7da3..7c2c23873 100644
--- a/components/nvidia-widgets/examples/widget_test.lpi
+++ b/components/nvidia-widgets/examples/widget_test.lpi
@@ -12,7 +12,6 @@
-
@@ -34,17 +33,42 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -55,7 +79,7 @@
-
+
diff --git a/components/nvidia-widgets/examples/widget_test.pp b/components/nvidia-widgets/examples/widget_test.pp
index 864abcd01..2ff3aed24 100644
--- a/components/nvidia-widgets/examples/widget_test.pp
+++ b/components/nvidia-widgets/examples/widget_test.pp
@@ -3,9 +3,8 @@ program widget_test;
{$mode objfpc}{$H+}
uses
- Classes, SysUtils,
- GLut, GL, GLu,
- nvWidgets, nvGLWidgets, nvBaseFont, nvGlutWidgets, GLFreeTypeFont, GLUTBitmapFont;
+ Classes, SysUtils, GLut, GL, GLu, nvGLPainter,
+ nvGlutContext, GLFreeTypeFont, GLUTBitmapFont, nvTypes;
var
ui: GlutUIContext;
diff --git a/components/nvidia-widgets/src/gl/glfreetype.pas b/components/nvidia-widgets/src/gl/glfreetype.pas
index b0955ffc3..32bfb7135 100644
--- a/components/nvidia-widgets/src/gl/glfreetype.pas
+++ b/components/nvidia-widgets/src/gl/glfreetype.pas
@@ -10,8 +10,7 @@ unit GLFreeType;
interface
uses
- SysUtils, freetypeh, GL, GLu,
- nvBaseFont;
+ SysUtils, freetypeh, GL, GLu;
//This holds all of the information related to any
//freetype font that we want to create.
diff --git a/components/nvidia-widgets/src/gl/nvglwidgets.pas b/components/nvidia-widgets/src/gl/nvglpainter.pas
similarity index 99%
rename from components/nvidia-widgets/src/gl/nvglwidgets.pas
rename to components/nvidia-widgets/src/gl/nvglpainter.pas
index 15dfd1d5d..f1025994d 100644
--- a/components/nvidia-widgets/src/gl/nvglwidgets.pas
+++ b/components/nvidia-widgets/src/gl/nvglpainter.pas
@@ -7,14 +7,14 @@
//
// Copyright (c) NVIDIA Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
-unit nvGLWidgets;
+unit nvGLPainter;
{$mode objfpc}{$H+}
interface
uses
- Classes, nvWidgets,
+ Classes, nvPainter, nvTypes,
GL, ftFont, FPCanvas;
const
diff --git a/components/nvidia-widgets/src/glut/nvglutwidgets.pas b/components/nvidia-widgets/src/glut/nvglutcontext.pas
similarity index 98%
rename from components/nvidia-widgets/src/glut/nvglutwidgets.pas
rename to components/nvidia-widgets/src/glut/nvglutcontext.pas
index c19571f28..355da0890 100755
--- a/components/nvidia-widgets/src/glut/nvglutwidgets.pas
+++ b/components/nvidia-widgets/src/glut/nvglutcontext.pas
@@ -11,14 +11,14 @@
//
// Copyright (c) NVIDIA Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////
-unit nvGlutWidgets;
+unit nvGlutContext;
{$mode objfpc}{$H+}
interface
uses
- SysUtils, nvWidgets;
+ SysUtils, nvContext, nvTypes;
type
diff --git a/components/nvidia-widgets/src/nvwidgets.pas b/components/nvidia-widgets/src/nvcontext.pas
similarity index 76%
rename from components/nvidia-widgets/src/nvwidgets.pas
rename to components/nvidia-widgets/src/nvcontext.pas
index 67b7b5d2b..eba6a28cc 100644
--- a/components/nvidia-widgets/src/nvwidgets.pas
+++ b/components/nvidia-widgets/src/nvcontext.pas
@@ -7,208 +7,17 @@
//
// Copyright (c) NVIDIA Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
-unit nvWidgets;
+unit nvContext;
{$mode objfpc}{$H+}
interface
uses
- Classes, SysUtils, nvBaseFont;
+ Classes, SysUtils, nvTypes, nvPainter, nvBaseFont;
type
- { Point }
-
- Point = object
- x, y: integer;
-
- constructor Point;
- constructor Point(ix, iy: integer);
- constructor Point(const p: Point);
- end;
-
-function SetPoint(x, y: integer): Point;
-
-type
- { Rect }
-
- Rect = object
- x, y, w, h: integer;
-
- constructor Rect;
- constructor Rect(const p: TPoint);
- constructor Rect(ix, iy: integer; iw: integer = 0; ih: integer = 0);
- constructor Rect(const r: Rect);
- end;
-
-function SetRect(x, y: integer): Rect;
-function SetRect(x, y, w, h: integer): Rect;
-
-const
- ButtonFlags_Off = $0;
- ButtonFlags_On = $1;
- ButtonFlags_Begin = $2;
- ButtonFlags_End = $4;
- ButtonFlags_Shift = $8;
- ButtonFlags_Alt = $10;
- ButtonFlags_Ctrl = $20;
-
-type
- ButtonState = record
- state: integer;
- time: TDateTime;
- cursor: Point;
- end;
-
-const
- // An enum to identify the mouse buttons
- MouseButton_Left = 1;
- MouseButton_Middle = 2;
- MouseButton_Right = 3;
-
- // An enum to identify the special key buttons not translated with ASCII codes
- Key_F1 = 128;
- Key_F2 = 129;
- Key_F3 = 130;
- Key_F4 = 131;
- Key_F5 = 132;
- Key_F6 = 133;
- Key_F7 = 134;
- Key_F8 = 135;
- Key_F9 = 136;
- Key_F10 = 137;
- Key_F11 = 138;
- Key_F12 = 139;
-
- Key_Left = 140;
- Key_Up = 141;
- Key_Right = 142;
- Key_Down = 143;
- Key_PageUp = 144;
- Key_PageDown = 145;
- Key_Home = 146;
- Key_End = 147;
- Key_Insert = 148;
-
- // The various flags to modify the behavior of the groups
-
- // Layout behavior flags
- GroupFlags_LayoutNone = $01;
- GroupFlags_LayoutVertical = $02;
- GroupFlags_LayoutHorizontal = $04;
- GroupFlags_LayoutMask = $07;
- GroupFlags_LayoutXMask = $ffff xor GroupFlags_LayoutMask;
-
- // Alignment flags for the widgets inserted in the group
- GroupFlags_AlignLeft = $10;
- GroupFlags_AlignRight = $20;
- GroupFlags_AlignTop = $40;
- GroupFlags_AlignBottom = $80;
- GroupFlags_AlignMask = $f0;
- GroupFlags_AlignXMask = $ffff xor GroupFlags_AlignMask;
-
- // Start flags defining the starting origin of the group
- GroupFlags_StartLeft = $100;
- GroupFlags_StartRight = $200;
- GroupFlags_StartTop = $400;
- GroupFlags_StartBottom = $800;
- GroupFlags_StartMask = $f00;
- GroupFlags_StartXMask = $ffff xor GroupFlags_StartMask;
-
- // Optional flags
- GroupFlags_LayoutForce = $8000;
- GroupFlags_LayoutDefault = $4000;
- GroupFlags_LayoutNoMargin = $2000;
- GroupFlags_LayoutNoSpace = $1000;
- GroupFlags_GrowRightFromBottom = GroupFlags_LayoutHorizontal or GroupFlags_StartLeft or GroupFlags_AlignLeft or GroupFlags_StartBottom or GroupFlags_AlignBottom;
-
- // Predefined configurations
- GroupFlags_GrowRightFromTop = GroupFlags_LayoutHorizontal or GroupFlags_StartLeft or GroupFlags_AlignLeft or GroupFlags_StartTop or GroupFlags_AlignTop;
- GroupFlags_GrowLeftFromBottom = GroupFlags_LayoutHorizontal or GroupFlags_StartRight or GroupFlags_AlignRight or GroupFlags_StartBottom or GroupFlags_AlignBottom;
- GroupFlags_GrowLeftFromTop = GroupFlags_LayoutHorizontal or GroupFlags_StartRight or GroupFlags_AlignRight or GroupFlags_StartTop or GroupFlags_AlignTop;
- GroupFlags_GrowUpFromLeft = GroupFlags_LayoutVertical or GroupFlags_StartBottom or GroupFlags_AlignBottom or GroupFlags_StartLeft or GroupFlags_AlignLeft;
- GroupFlags_GrowUpFromRight = GroupFlags_LayoutVertical or GroupFlags_StartBottom or GroupFlags_AlignBottom or GroupFlags_StartRight or GroupFlags_AlignRight;
- GroupFlags_GrowDownFromLeft = GroupFlags_LayoutVertical or GroupFlags_StartTop or GroupFlags_AlignTop or GroupFlags_StartLeft or GroupFlags_AlignLeft;
- GroupFlags_GrowDownFromRight = GroupFlags_LayoutVertical or GroupFlags_StartTop or GroupFlags_AlignTop or GroupFlags_StartRight or GroupFlags_AlignRight;
- GroupFlags_LayoutDefaultFallback = GroupFlags_GrowDownFromLeft;
-
-type
- Group = record
- bounds: Rect; //anchor point + width and height of the region
- flags: integer; //group behavior
- margin: integer; //border
- space: integer; //interior
- end;
- PGroup = ^Group;
-
- //*************************************************************************
- // UIPainter
-
- UIPainter = class(TObject)
- private
- FFont: TnvBaseFont;
- procedure SetFont(AValue: TnvBaseFont);
- public
- constructor Create;
-
- procedure _begin(const window: Rect); virtual;
- procedure _end; virtual;
-
- // These methods should be called between begin/end
-
- procedure drawFrame(const r: Rect; margin: integer; style: integer); virtual; abstract;
-
- function getLabelRect(const r: Rect; const Text: string; out rt: Rect; out nbLines: integer): Rect; virtual; abstract;
- procedure drawLabel(const r: Rect; const Text: string; const rt: Rect; const nbLines: integer; isHover: boolean; style: integer); virtual; abstract;
-
- function getButtonRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
- procedure drawButton(const r: Rect; const Text: string; const rt: Rect; isDown: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
-
- function getCheckRect(const r: Rect; const Text: string; out rt: Rect; out rc: Rect): Rect; virtual; abstract;
- procedure drawCheckButton(const r: Rect; const Text: string; const rt: Rect; const rr: Rect; isChecked: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
-
- function getRadioRect(const r: Rect; const Text: string; out rt: Rect; out rr: Rect): Rect; virtual; abstract;
- procedure drawRadioButton(const r: Rect; const Text: string; const rt: Rect; const rr: Rect; isOn: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
-
- function getHorizontalSliderRect(const r: Rect; out rs: Rect; v: double; out rc: Rect): Rect; virtual; abstract;
- procedure drawHorizontalSlider(const r: Rect; rs: Rect; v: double; rc: Rect; isHover: boolean; style: integer); virtual; abstract;
-
- function getItemRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
- procedure drawListItem(const r: Rect; const Text: string; const rt: Rect; isSelected: boolean; isHover: boolean; style: integer); virtual; abstract;
-
- function getListRect(const r: Rect; numOptions: integer; const options: array of string; out ri: Rect; out rt: Rect): Rect; virtual; abstract;
- procedure drawListBox(const r: Rect; numOptions: integer; const options: array of string; const ri: Rect; const rt: Rect; selected: integer; hovered: integer; style: integer); virtual; abstract;
-
- function getComboRect(const r: Rect; numOptions: integer; const options: array of string; selected: integer; out rt: Rect; out ra: Rect): Rect; virtual; abstract;
- function getComboOptionsRect(const rCombo: Rect; numOptions: integer; const options: array of string; out ri: Rect; out rit: Rect): Rect; virtual; abstract;
- procedure drawComboBox(const rect: Rect; numOptions: integer; const options: array of string; const rt: Rect; const ra: Rect; selected: integer; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
- procedure drawComboOptions(const rect: Rect; numOptions: integer; const options: array of string; const ri: Rect; const rit: Rect; selected: integer; hovered: integer; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
-
- function getLineEditRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
- procedure drawLineEdit(const r: Rect; const Text: string; const rt: Rect; caretPos: integer; isSelected: boolean; isHover: boolean; style: integer); virtual; abstract;
-
- function getPanelRect(const r: Rect; const Text: string; out rt: Rect; out ra: Rect): Rect; virtual; abstract;
- procedure drawPanel(const rect: Rect; const Text: string; const rt: Rect; const ra: Rect; isUnfold: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
-
- function getTextureViewRect(const rect: Rect; out rt: Rect): Rect; virtual; abstract;
- procedure drawTextureView(const rect: Rect; const texID: integer; const rt: Rect; const rz: Rect; mipLevel: integer; texelScale: double; texelOffset: double; r: integer; g: integer; b: integer; a: integer; style: integer); virtual; abstract;
-
- // Eval widget dimensions
- function getCanvasMargin: integer; virtual;
- function getCanvasSpace: integer; virtual;
- function getFontHeight: integer; virtual;
- function getTextLineWidth(const Text: string): integer; virtual;
- function getTextSize(const Text: string; out nbLines: integer): integer; virtual;
- function getPickedCharNb(const Text: string; const at: Point): integer; virtual;
-
- procedure drawDebugRect(const r: Rect); virtual; abstract;
-
- procedure init; virtual; abstract;
- published
- property Font: TnvBaseFont read FFont write SetFont;
- end;
-
{ UIContext }
UIContext = class(TObject)
@@ -428,75 +237,6 @@ begin
Result := 0;
end;
-{ Point }
-
-constructor Point.Point;
-begin
- x := 0;
- y := 0;
-end;
-
-constructor Point.Point(ix, iy: integer);
-begin
- x := ix;
- y := iy;
-end;
-
-constructor Point.Point(const p: Point);
-begin
- x := p.x;
- y := p.y;
-end;
-
-{ Rect }
-
-constructor Rect.Rect;
-begin
- x := 0;
- y := 0;
- w := 0;
- h := 0;
-end;
-
-constructor Rect.Rect(const p: TPoint);
-begin
- x := p.x;
- y := p.y;
- w := 0;
- h := 0;
-end;
-
-constructor Rect.Rect(ix, iy: integer; iw: integer; ih: integer);
-begin
- x := ix;
- y := iy;
- w := iw;
- h := ih;
-end;
-
-constructor Rect.Rect(const r: Rect);
-begin
- x := r.x;
- y := r.y;
- w := r.w;
- h := r.h;
-end;
-
-function SetPoint(x, y: integer): Point;
-begin
- Result.Point(x, y);
-end;
-
-function SetRect(x, y: integer): Rect;
-begin
- Result.Rect(x, y);
-end;
-
-function SetRect(x, y, w, h: integer): Rect;
-begin
- Result.Rect(x, y, w, h);
-end;
-
{ UIContext }
constructor UIContext.Create;
@@ -1375,58 +1115,5 @@ begin
Result := aRect;
end;
-{ UIPainter }
-
-procedure UIPainter.SetFont(AValue: TnvBaseFont);
-begin
- if FFont=AValue then Exit;
- FFont:=AValue;
-end;
-
-constructor UIPainter.Create;
-begin
- inherited;
-end;
-
-procedure UIPainter._begin(const window: Rect);
-begin
- init;
-end;
-
-procedure UIPainter._end;
-begin
-
-end;
-
-function UIPainter.getCanvasMargin: integer;
-begin
- Result := 0;
-end;
-
-function UIPainter.getCanvasSpace: integer;
-begin
- Result := 0;
-end;
-
-function UIPainter.getFontHeight: integer;
-begin
- Result := 0;
-end;
-
-function UIPainter.getTextLineWidth(const Text: string): integer;
-begin
- Result := 0;
-end;
-
-function UIPainter.getTextSize(const Text: string; out nbLines: integer): integer;
-begin
- Result := 0;
-end;
-
-function UIPainter.getPickedCharNb(const Text: string; const at: Point): integer;
-begin
- Result := 0;
-end;
-
end.
diff --git a/components/nvidia-widgets/src/nvpainter.pas b/components/nvidia-widgets/src/nvpainter.pas
new file mode 100644
index 000000000..949c4e323
--- /dev/null
+++ b/components/nvidia-widgets/src/nvpainter.pas
@@ -0,0 +1,154 @@
+//
+// nvWidgets.h - User Interface library
+//
+//
+// Author: Ignacio Castano, Samuel Gateau, Evan Hart
+// Email: sdkfeedback@nvidia.com
+//
+// Copyright (c) NVIDIA Corporation. All rights reserved.
+////////////////////////////////////////////////////////////////////////////////
+unit nvPainter;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, nvBaseFont, nvTypes;
+
+type
+
+ UIPainter = class(TObject)
+ private
+ FFont: TnvBaseFont;
+ procedure SetFont(AValue: TnvBaseFont);
+ public
+ constructor Create;
+
+ procedure _begin(const window: Rect); virtual;
+ procedure _end; virtual;
+
+ // These methods should be called between begin/end
+
+ procedure drawFrame(const r: Rect; margin: integer; style: integer); virtual; abstract;
+
+ function getLabelRect(const r: Rect; const Text: string; out rt: Rect; out nbLines: integer): Rect; virtual; abstract;
+ procedure drawLabel(const r: Rect; const Text: string; const rt: Rect; const nbLines: integer; isHover: boolean; style: integer); virtual; abstract;
+
+ function getButtonRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
+ procedure drawButton(const r: Rect; const Text: string; const rt: Rect; isDown: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+
+ function getCheckRect(const r: Rect; const Text: string; out rt: Rect; out rc: Rect): Rect; virtual; abstract;
+ procedure drawCheckButton(const r: Rect; const Text: string; const rt: Rect; const rr: Rect; isChecked: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+
+ function getRadioRect(const r: Rect; const Text: string; out rt: Rect; out rr: Rect): Rect; virtual; abstract;
+ procedure drawRadioButton(const r: Rect; const Text: string; const rt: Rect; const rr: Rect; isOn: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+
+ function getHorizontalSliderRect(const r: Rect; out rs: Rect; v: double; out rc: Rect): Rect; virtual; abstract;
+ procedure drawHorizontalSlider(const r: Rect; rs: Rect; v: double; rc: Rect; isHover: boolean; style: integer); virtual; abstract;
+
+ function getItemRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
+ procedure drawListItem(const r: Rect; const Text: string; const rt: Rect; isSelected: boolean; isHover: boolean; style: integer); virtual; abstract;
+
+ function getListRect(const r: Rect; numOptions: integer; const options: array of string; out ri: Rect; out rt: Rect): Rect; virtual; abstract;
+ procedure drawListBox(const r: Rect; numOptions: integer; const options: array of string; const ri: Rect; const rt: Rect; selected: integer; hovered: integer; style: integer); virtual; abstract;
+
+ function getComboRect(const r: Rect; numOptions: integer; const options: array of string; selected: integer; out rt: Rect; out ra: Rect): Rect; virtual; abstract;
+ function getComboOptionsRect(const rCombo: Rect; numOptions: integer; const options: array of string; out ri: Rect; out rit: Rect): Rect; virtual; abstract;
+ procedure drawComboBox(const rect: Rect; numOptions: integer; const options: array of string; const rt: Rect; const ra: Rect; selected: integer; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+ procedure drawComboOptions(const rect: Rect; numOptions: integer; const options: array of string; const ri: Rect; const rit: Rect; selected: integer; hovered: integer; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+
+ function getLineEditRect(const r: Rect; const Text: string; out rt: Rect): Rect; virtual; abstract;
+ procedure drawLineEdit(const r: Rect; const Text: string; const rt: Rect; caretPos: integer; isSelected: boolean; isHover: boolean; style: integer); virtual; abstract;
+
+ function getPanelRect(const r: Rect; const Text: string; out rt: Rect; out ra: Rect): Rect; virtual; abstract;
+ procedure drawPanel(const rect: Rect; const Text: string; const rt: Rect; const ra: Rect; isUnfold: boolean; isHover: boolean; isFocus: boolean; style: integer); virtual; abstract;
+
+ function getTextureViewRect(const rect: Rect; out rt: Rect): Rect; virtual; abstract;
+ procedure drawTextureView(const rect: Rect; const texID: integer; const rt: Rect; const rz: Rect; mipLevel: integer; texelScale: double; texelOffset: double; r: integer; g: integer; b: integer; a: integer; style: integer); virtual; abstract;
+
+ // Eval widget dimensions
+ function getCanvasMargin: integer; virtual;
+ function getCanvasSpace: integer; virtual;
+ function getFontHeight: integer; virtual;
+ function getTextLineWidth(const Text: string): integer; virtual;
+ function getTextSize(const Text: string; out nbLines: integer): integer; virtual;
+ function getPickedCharNb(const Text: string; const at: Point): integer; virtual;
+
+ procedure drawDebugRect(const r: Rect); virtual; abstract;
+
+ procedure init; virtual; abstract;
+ published
+ property Font: TnvBaseFont read FFont write SetFont;
+ end;
+
+function EvalBool(b: boolean): byte;
+
+implementation
+
+uses
+ Math;
+
+function EvalBool(b: boolean): byte;
+begin
+ if b then
+ Result := 1
+ else
+ Result := 0;
+end;
+
+{ UIPainter }
+
+procedure UIPainter.SetFont(AValue: TnvBaseFont);
+begin
+ if FFont=AValue then Exit;
+ FFont:=AValue;
+end;
+
+constructor UIPainter.Create;
+begin
+ inherited;
+end;
+
+procedure UIPainter._begin(const window: Rect);
+begin
+ init;
+end;
+
+procedure UIPainter._end;
+begin
+
+end;
+
+function UIPainter.getCanvasMargin: integer;
+begin
+ Result := 0;
+end;
+
+function UIPainter.getCanvasSpace: integer;
+begin
+ Result := 0;
+end;
+
+function UIPainter.getFontHeight: integer;
+begin
+ Result := 0;
+end;
+
+function UIPainter.getTextLineWidth(const Text: string): integer;
+begin
+ Result := 0;
+end;
+
+function UIPainter.getTextSize(const Text: string; out nbLines: integer): integer;
+begin
+ Result := 0;
+end;
+
+function UIPainter.getPickedCharNb(const Text: string; const at: Point): integer;
+begin
+ Result := 0;
+end;
+
+end.
+
diff --git a/components/nvidia-widgets/src/nvtypes.pas b/components/nvidia-widgets/src/nvtypes.pas
new file mode 100644
index 000000000..05346f1db
--- /dev/null
+++ b/components/nvidia-widgets/src/nvtypes.pas
@@ -0,0 +1,208 @@
+unit nvTypes;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils;
+
+type
+
+ { Point }
+
+ Point = object
+ x, y: integer;
+
+ constructor Point;
+ constructor Point(ix, iy: integer);
+ constructor Point(const p: Point);
+ end;
+
+function SetPoint(x, y: integer): Point;
+
+type
+ { Rect }
+
+ Rect = object
+ x, y, w, h: integer;
+
+ constructor Rect;
+ constructor Rect(const p: TPoint);
+ constructor Rect(ix, iy: integer; iw: integer = 0; ih: integer = 0);
+ constructor Rect(const r: Rect);
+ end;
+
+function SetRect(x, y: integer): Rect;
+function SetRect(x, y, w, h: integer): Rect;
+
+const
+ ButtonFlags_Off = $0;
+ ButtonFlags_On = $1;
+ ButtonFlags_Begin = $2;
+ ButtonFlags_End = $4;
+ ButtonFlags_Shift = $8;
+ ButtonFlags_Alt = $10;
+ ButtonFlags_Ctrl = $20;
+
+type
+ ButtonState = record
+ state: integer;
+ time: TDateTime;
+ cursor: Point;
+ end;
+
+const
+ // An enum to identify the mouse buttons
+ MouseButton_Left = 1;
+ MouseButton_Middle = 2;
+ MouseButton_Right = 3;
+
+ // An enum to identify the special key buttons not translated with ASCII codes
+ Key_F1 = 128;
+ Key_F2 = 129;
+ Key_F3 = 130;
+ Key_F4 = 131;
+ Key_F5 = 132;
+ Key_F6 = 133;
+ Key_F7 = 134;
+ Key_F8 = 135;
+ Key_F9 = 136;
+ Key_F10 = 137;
+ Key_F11 = 138;
+ Key_F12 = 139;
+
+ Key_Left = 140;
+ Key_Up = 141;
+ Key_Right = 142;
+ Key_Down = 143;
+ Key_PageUp = 144;
+ Key_PageDown = 145;
+ Key_Home = 146;
+ Key_End = 147;
+ Key_Insert = 148;
+
+ // The various flags to modify the behavior of the groups
+
+ // Layout behavior flags
+ GroupFlags_LayoutNone = $01;
+ GroupFlags_LayoutVertical = $02;
+ GroupFlags_LayoutHorizontal = $04;
+ GroupFlags_LayoutMask = $07;
+ GroupFlags_LayoutXMask = $ffff xor GroupFlags_LayoutMask;
+
+ // Alignment flags for the widgets inserted in the group
+ GroupFlags_AlignLeft = $10;
+ GroupFlags_AlignRight = $20;
+ GroupFlags_AlignTop = $40;
+ GroupFlags_AlignBottom = $80;
+ GroupFlags_AlignMask = $f0;
+ GroupFlags_AlignXMask = $ffff xor GroupFlags_AlignMask;
+
+ // Start flags defining the starting origin of the group
+ GroupFlags_StartLeft = $100;
+ GroupFlags_StartRight = $200;
+ GroupFlags_StartTop = $400;
+ GroupFlags_StartBottom = $800;
+ GroupFlags_StartMask = $f00;
+ GroupFlags_StartXMask = $ffff xor GroupFlags_StartMask;
+
+ // Optional flags
+ GroupFlags_LayoutForce = $8000;
+ GroupFlags_LayoutDefault = $4000;
+ GroupFlags_LayoutNoMargin = $2000;
+ GroupFlags_LayoutNoSpace = $1000;
+ GroupFlags_GrowRightFromBottom = GroupFlags_LayoutHorizontal or GroupFlags_StartLeft or GroupFlags_AlignLeft or GroupFlags_StartBottom or GroupFlags_AlignBottom;
+
+ // Predefined configurations
+ GroupFlags_GrowRightFromTop = GroupFlags_LayoutHorizontal or GroupFlags_StartLeft or GroupFlags_AlignLeft or GroupFlags_StartTop or GroupFlags_AlignTop;
+ GroupFlags_GrowLeftFromBottom = GroupFlags_LayoutHorizontal or GroupFlags_StartRight or GroupFlags_AlignRight or GroupFlags_StartBottom or GroupFlags_AlignBottom;
+ GroupFlags_GrowLeftFromTop = GroupFlags_LayoutHorizontal or GroupFlags_StartRight or GroupFlags_AlignRight or GroupFlags_StartTop or GroupFlags_AlignTop;
+ GroupFlags_GrowUpFromLeft = GroupFlags_LayoutVertical or GroupFlags_StartBottom or GroupFlags_AlignBottom or GroupFlags_StartLeft or GroupFlags_AlignLeft;
+ GroupFlags_GrowUpFromRight = GroupFlags_LayoutVertical or GroupFlags_StartBottom or GroupFlags_AlignBottom or GroupFlags_StartRight or GroupFlags_AlignRight;
+ GroupFlags_GrowDownFromLeft = GroupFlags_LayoutVertical or GroupFlags_StartTop or GroupFlags_AlignTop or GroupFlags_StartLeft or GroupFlags_AlignLeft;
+ GroupFlags_GrowDownFromRight = GroupFlags_LayoutVertical or GroupFlags_StartTop or GroupFlags_AlignTop or GroupFlags_StartRight or GroupFlags_AlignRight;
+ GroupFlags_LayoutDefaultFallback = GroupFlags_GrowDownFromLeft;
+
+type
+ Group = record
+ bounds: Rect; //anchor point + width and height of the region
+ flags: integer; //group behavior
+ margin: integer; //border
+ space: integer; //interior
+ end;
+ PGroup = ^Group;
+
+implementation
+
+{ Point }
+
+constructor Point.Point;
+begin
+ x := 0;
+ y := 0;
+end;
+
+constructor Point.Point(ix, iy: integer);
+begin
+ x := ix;
+ y := iy;
+end;
+
+constructor Point.Point(const p: Point);
+begin
+ x := p.x;
+ y := p.y;
+end;
+
+{ Rect }
+
+constructor Rect.Rect;
+begin
+ x := 0;
+ y := 0;
+ w := 0;
+ h := 0;
+end;
+
+constructor Rect.Rect(const p: TPoint);
+begin
+ x := p.x;
+ y := p.y;
+ w := 0;
+ h := 0;
+end;
+
+constructor Rect.Rect(ix, iy: integer; iw: integer; ih: integer);
+begin
+ x := ix;
+ y := iy;
+ w := iw;
+ h := ih;
+end;
+
+constructor Rect.Rect(const r: Rect);
+begin
+ x := r.x;
+ y := r.y;
+ w := r.w;
+ h := r.h;
+end;
+
+function SetPoint(x, y: integer): Point;
+begin
+ Result.Point(x, y);
+end;
+
+function SetRect(x, y: integer): Rect;
+begin
+ Result.Rect(x, y);
+end;
+
+function SetRect(x, y, w, h: integer): Rect;
+begin
+ Result.Rect(x, y, w, h);
+end;
+
+end.
+