mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 19:19:19 +02:00
- move TWidgetset.GetListBoxXXX to TWSCustomListBox.GetXXX (where XXX in [GetIndexAtY, GetItemRect]) *untested on Carbon and wince*
- implement GetIndexAtY and GetItemRect for TQtWsListBox git-svn-id: trunk@11875 -
This commit is contained in:
parent
66f6e87d4d
commit
abe113718c
@ -574,7 +574,7 @@ function TCustomListBox.GetIndexAtY(Y: integer): integer;
|
|||||||
begin
|
begin
|
||||||
Result:=-1;
|
Result:=-1;
|
||||||
if (not HandleAllocated) then exit;
|
if (not HandleAllocated) then exit;
|
||||||
Result:=GetListBoxIndexAtY(Self, Y);
|
Result := TWSCustomListBoxClass(WidgetSetClass).GetIndexAtY(Self, Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -618,12 +618,16 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
||||||
begin
|
begin
|
||||||
if (Index>=0) and (Index<Items.Count) then begin
|
if (Index>=0) and (Index<Items.Count) then
|
||||||
GetListBoxItemRect(Self,Index,Result);
|
begin
|
||||||
end else if (Index=Items.Count) and (Index>0) then begin
|
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index, Result);
|
||||||
GetListBoxItemRect(Self,Index-1,Result);
|
end else
|
||||||
|
if (Index=Items.Count) and (Index>0) then
|
||||||
|
begin
|
||||||
|
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index - 1, Result);
|
||||||
OffsetRect(Result,0,Result.Bottom-Result.Top);
|
OffsetRect(Result,0,Result.Bottom-Result.Top);
|
||||||
end else begin
|
end else
|
||||||
|
begin
|
||||||
FillChar(Result,SizeOf(Result),0);
|
FillChar(Result,SizeOf(Result),0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -639,8 +643,10 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
if (Index<0) or (Index>=Items.Count) then exit;
|
if (Index<0) or (Index>=Items.Count) then exit;
|
||||||
if not GetListBoxItemRect(Self,Index,ARect) then exit;
|
if not TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index, ARect) then
|
||||||
if (ARect.Bottom<0) or (ARect.Top>ClientHeight) then exit;
|
exit;
|
||||||
|
if (ARect.Bottom<0) or (ARect.Top>ClientHeight) then
|
||||||
|
exit;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -655,8 +661,10 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
if (Index<0) or (Index>=Items.Count) then exit;
|
if (Index<0) or (Index>=Items.Count) then exit;
|
||||||
if not GetListBoxItemRect(Self,Index,ARect) then exit;
|
if not TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index, ARect) then
|
||||||
if (ARect.Top<0) or (ARect.Bottom>ClientHeight) then exit;
|
exit;
|
||||||
|
if (ARect.Top<0) or (ARect.Bottom>ClientHeight) then
|
||||||
|
exit;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -361,18 +361,6 @@ begin
|
|||||||
else Result := nil;
|
else Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWidgetSet.GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWidgetSet.GetListBoxItemRect(ListBox: TComponent; Index: integer;
|
|
||||||
var ARect: TRect): boolean;
|
|
||||||
begin
|
|
||||||
FillChar(ARect,SizeOf(ARect),0);
|
|
||||||
Result:=false;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ifdef OldRawImageProcs}
|
{$ifdef OldRawImageProcs}
|
||||||
function TWidgetSet.GetRawImageFromDevice(SrcDC: HDC;
|
function TWidgetSet.GetRawImageFromDevice(SrcDC: HDC;
|
||||||
const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
||||||
|
@ -294,17 +294,6 @@ begin
|
|||||||
Result := WidgetSet.GetLCLOwnerObject(Handle);
|
Result := WidgetSet.GetLCLOwnerObject(Handle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer;
|
|
||||||
begin
|
|
||||||
Result := WidgetSet.GetListBoxIndexAtY(ListBox, y);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function GetListBoxItemRect(ListBox: TComponent; Index: integer;
|
|
||||||
var ARect: TRect): boolean;
|
|
||||||
begin
|
|
||||||
Result := WidgetSet.GetListBoxItemRect(ListBox,Index,ARect);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ifdef OldRawImageProcs}
|
{$ifdef OldRawImageProcs}
|
||||||
function GetRawImageFromDevice(SrcDC: HDC; const SrcRect: TRect;
|
function GetRawImageFromDevice(SrcDC: HDC; const SrcRect: TRect;
|
||||||
var NewRawImage: TRawImage): boolean;
|
var NewRawImage: TRawImage): boolean;
|
||||||
|
@ -89,8 +89,6 @@ function GetDeviceRawImageDescription(DC: HDC; Desc: PRawImageDescription): bool
|
|||||||
{$endif}
|
{$endif}
|
||||||
function GetDeviceSize(DC: HDC; var p: TPoint): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetDeviceSize(DC: HDC; var p: TPoint): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetLCLOwnerObject(Handle: HWnd): TObject; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetLCLOwnerObject(Handle: HWnd): TObject; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
|
||||||
function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
|
||||||
{$ifdef OldRawImageProcs}
|
{$ifdef OldRawImageProcs}
|
||||||
function GetRawImageFromDevice(SrcDC: HDC; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetRawImageFromDevice(SrcDC: HDC; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
function GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
function GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP; const SrcRect: TRect; var NewRawImage: TRawImage): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
|
||||||
|
@ -104,117 +104,6 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//It looks like there is no way to know the clientrect of a databrowser.
|
|
||||||
//border width (when active) should be 3 pixels
|
|
||||||
const DataBrowserBorderWidth = 3;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Method: GetListBoxIndexAtY
|
|
||||||
Params: ListBox - LCL List Box component
|
|
||||||
Y
|
|
||||||
Returns: Index of list item at the specified Y coordinate
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TCarbonWidgetSet.GetListBoxIndexAtY(ListBox: TComponent; y: integer
|
|
||||||
): integer;
|
|
||||||
var rowheight : UInt16;
|
|
||||||
atop, aleft : UInt32;
|
|
||||||
aWidget : ControlRef;
|
|
||||||
aListBox : TCustomListBox;
|
|
||||||
delta : integer;
|
|
||||||
const
|
|
||||||
SName = 'GetListBoxIndexAtY';
|
|
||||||
begin
|
|
||||||
Result:=0;
|
|
||||||
|
|
||||||
aListBox:=TCustomListBox(ListBox);
|
|
||||||
if aListBox=nil then exit;
|
|
||||||
if not CheckWidget(aListBox.Handle, SName) then Exit;
|
|
||||||
aWidget:=ControlRef(TCarbonListBox(aListBox.Handle).Widget);
|
|
||||||
if aWidget=nil then exit;
|
|
||||||
|
|
||||||
if OSError(
|
|
||||||
GetDataBrowserTableViewRowHeight(aWidget,rowheight),
|
|
||||||
Self,SName,'GetDataBrowserTableViewRowHeight')
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
if OSError(
|
|
||||||
GetDataBrowserScrollPosition(aWidget,atop,aleft),
|
|
||||||
Self,SName,'GetDataBrowserScrollPosition')
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
if aListBox.BorderStyle=bsSingle then delta:=DataBrowserBorderWidth
|
|
||||||
else delta:=0;
|
|
||||||
|
|
||||||
Result:=(atop+y-delta) div rowheight;
|
|
||||||
if Result>=aListBox.Items.Count then Result:=-1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Method: GetListBoxItemRect
|
|
||||||
Params: ListBox - LCL List Box component
|
|
||||||
Index - Index of list item
|
|
||||||
ARect - Rectangle
|
|
||||||
Returns: If the function succeeds
|
|
||||||
|
|
||||||
Retrieves rectangle of list item with the specified index
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TCarbonWidgetSet.GetListBoxItemRect(ListBox: TComponent;
|
|
||||||
Index: integer; var ARect: TRect): boolean;
|
|
||||||
var rowheight : UInt16;
|
|
||||||
atop, aleft : UInt32;
|
|
||||||
aWidget : ControlRef;
|
|
||||||
aListBox : TCustomListBox;
|
|
||||||
aHoriz, aVertical : boolean;
|
|
||||||
scrollwidth : Sint32;
|
|
||||||
delta : integer;
|
|
||||||
const
|
|
||||||
SName = 'GetListBoxItemRect';
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
|
|
||||||
aListBox:=TCustomListBox(ListBox);
|
|
||||||
if aListBox=nil then exit;
|
|
||||||
if not CheckWidget(aListBox.Handle, SName) then Exit;
|
|
||||||
aWidget:=ControlRef(TCarbonListBox(aListBox.Handle).Widget);
|
|
||||||
if aWidget=nil then exit;
|
|
||||||
|
|
||||||
if OSError(
|
|
||||||
GetDataBrowserTableViewRowHeight(aWidget,rowheight),
|
|
||||||
Self,SName,'GetDataBrowserTableViewRowHeight')
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
if OSError(
|
|
||||||
GetDataBrowserScrollPosition(aWidget,atop,aleft),
|
|
||||||
Self,SName,'GetDataBrowserScrollPosition')
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
if OSError(
|
|
||||||
GetDataBrowserHasScrollBars(aWidget,aHoriz,aVertical),
|
|
||||||
Self,SName,'GetDataBrowserHasScrollBars')
|
|
||||||
then exit;
|
|
||||||
|
|
||||||
if aVertical then
|
|
||||||
begin
|
|
||||||
if OSError(
|
|
||||||
GetThemeMetric(kThemeMetricScrollBarWidth,scrollwidth),
|
|
||||||
Self,SName,'GetThemeMetric')
|
|
||||||
then exit;
|
|
||||||
end
|
|
||||||
else scrollwidth:=0;
|
|
||||||
|
|
||||||
if aListBox.BorderStyle=bsSingle then delta:=DataBrowserBorderWidth
|
|
||||||
else delta:=0;
|
|
||||||
|
|
||||||
//note: itemrect.right and bottom are outside the "real" itemrect.
|
|
||||||
|
|
||||||
ARect.Top:=(Index*rowheight)-atop+delta;
|
|
||||||
ARect.Left:=delta;
|
|
||||||
ARect.Bottom:=Arect.Top+rowheight;
|
|
||||||
ARect.Right:=aListBox.Width-delta-scrollwidth;
|
|
||||||
|
|
||||||
Result:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: IntfSendsUTF8KeyPress
|
Method: IntfSendsUTF8KeyPress
|
||||||
Returns: If the interface sends UTF-8 key press events
|
Returns: If the interface sends UTF-8 key press events
|
||||||
|
@ -38,8 +38,6 @@ function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState)
|
|||||||
function GetControlConstraints(Constraints: TObject): boolean; override;
|
function GetControlConstraints(Constraints: TObject): boolean; override;
|
||||||
function GetDesignerDC(WindowHandle: HWND): HDC; override;
|
function GetDesignerDC(WindowHandle: HWND): HDC; override;
|
||||||
function GetLCLOwnerObject(Handle: HWnd): TObject; override;
|
function GetLCLOwnerObject(Handle: HWnd): TObject; override;
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
|
|
||||||
function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; override;
|
|
||||||
|
|
||||||
function IntfSendsUTF8KeyPress: boolean; override;
|
function IntfSendsUTF8KeyPress: boolean; override;
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ begin
|
|||||||
//get the client rect (the carbon provided one usually is smaller than it
|
//get the client rect (the carbon provided one usually is smaller than it
|
||||||
//should be)
|
//should be)
|
||||||
idx:=idx-1;
|
idx:=idx-1;
|
||||||
if not WidgetSet.GetListBoxItemRect(aListBox,idx,arect) then exit;
|
arect := aListBox.ItemRect(idx);
|
||||||
if checklist then
|
if checklist then
|
||||||
begin
|
begin
|
||||||
//shrink the rect so that it doesn't include the area used by checkbox
|
//shrink the rect so that it doesn't include the area used by checkbox
|
||||||
|
@ -107,11 +107,14 @@ type
|
|||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||||
//class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
//class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
||||||
@ -275,6 +278,10 @@ implementation
|
|||||||
uses
|
uses
|
||||||
CarbonProc, CarbonStrings, CarbonDbgConsts;
|
CarbonProc, CarbonStrings, CarbonDbgConsts;
|
||||||
|
|
||||||
|
//It looks like there is no way to know the clientrect of a databrowser.
|
||||||
|
//border width (when active) should be 3 pixels
|
||||||
|
const DataBrowserBorderWidth = 3;
|
||||||
|
|
||||||
{ TCarbonWSScrollBar }
|
{ TCarbonWSScrollBar }
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -529,6 +536,39 @@ begin
|
|||||||
Result := TLCLIntfHandle(TCarbonListBox.Create(AWinControl, AParams));
|
Result := TLCLIntfHandle(TCarbonListBox.Create(AWinControl, AParams));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TCarbonWSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
var rowheight : UInt16;
|
||||||
|
atop, aleft : UInt32;
|
||||||
|
aWidget : ControlRef;
|
||||||
|
delta : integer;
|
||||||
|
const
|
||||||
|
SName = 'GetIndexAtY';
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
|
||||||
|
if ACustomListBox=nil then exit;
|
||||||
|
if not CheckWidget(ACustomListBox.Handle, SName) then Exit;
|
||||||
|
aWidget:=ControlRef(TCarbonListBox(ACustomListBox.Handle).Widget);
|
||||||
|
if aWidget=nil then exit;
|
||||||
|
|
||||||
|
if OSError(
|
||||||
|
GetDataBrowserTableViewRowHeight(aWidget,rowheight),
|
||||||
|
Self,SName,'GetDataBrowserTableViewRowHeight')
|
||||||
|
then exit;
|
||||||
|
|
||||||
|
if OSError(
|
||||||
|
GetDataBrowserScrollPosition(aWidget,atop,aleft),
|
||||||
|
Self,SName,'GetDataBrowserScrollPosition')
|
||||||
|
then exit;
|
||||||
|
|
||||||
|
if aListBox.BorderStyle=bsSingle then delta:=DataBrowserBorderWidth
|
||||||
|
else delta:=0;
|
||||||
|
|
||||||
|
Result:=(atop+y-delta) div rowheight;
|
||||||
|
if Result>=aListBox.Items.Count then Result:=-1;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCarbonWSCustomListBox.GetSelCount
|
Method: TCarbonWSCustomListBox.GetSelCount
|
||||||
Params: ACustomListBox - LCL custom list box
|
Params: ACustomListBox - LCL custom list box
|
||||||
@ -585,6 +625,62 @@ begin
|
|||||||
Result := TCarbonListBox(ACustomListBox.Handle).GetItemIndex;
|
Result := TCarbonListBox(ACustomListBox.Handle).GetItemIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TCarbonWSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
var rowheight : UInt16;
|
||||||
|
atop, aleft : UInt32;
|
||||||
|
aWidget : ControlRef;
|
||||||
|
aHoriz, aVertical : boolean;
|
||||||
|
scrollwidth : Sint32;
|
||||||
|
delta : integer;
|
||||||
|
const
|
||||||
|
SName = 'GetItemRect';
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
|
||||||
|
if ACustomListBox=nil then exit;
|
||||||
|
if not CheckWidget(ACustomListBox.Handle, SName) then Exit;
|
||||||
|
aWidget:=ControlRef(TCarbonListBox(ACustomListBox.Handle).Widget);
|
||||||
|
if aWidget=nil then exit;
|
||||||
|
|
||||||
|
if OSError(
|
||||||
|
GetDataBrowserTableViewRowHeight(aWidget,rowheight),
|
||||||
|
Self,SName,'GetDataBrowserTableViewRowHeight')
|
||||||
|
then exit;
|
||||||
|
|
||||||
|
if OSError(
|
||||||
|
GetDataBrowserScrollPosition(aWidget,atop,aleft),
|
||||||
|
Self,SName,'GetDataBrowserScrollPosition')
|
||||||
|
then exit;
|
||||||
|
|
||||||
|
if OSError(
|
||||||
|
GetDataBrowserHasScrollBars(aWidget,aHoriz,aVertical),
|
||||||
|
Self,SName,'GetDataBrowserHasScrollBars')
|
||||||
|
then exit;
|
||||||
|
|
||||||
|
if aVertical then
|
||||||
|
begin
|
||||||
|
if OSError(
|
||||||
|
GetThemeMetric(kThemeMetricScrollBarWidth,scrollwidth),
|
||||||
|
Self,SName,'GetThemeMetric')
|
||||||
|
then exit;
|
||||||
|
end
|
||||||
|
else scrollwidth:=0;
|
||||||
|
|
||||||
|
if aListBox.BorderStyle=bsSingle then delta:=DataBrowserBorderWidth
|
||||||
|
else delta:=0;
|
||||||
|
|
||||||
|
//note: itemrect.right and bottom are outside the "real" itemrect.
|
||||||
|
|
||||||
|
ARect.Top:=(Index*rowheight)-atop+delta;
|
||||||
|
ARect.Left:=delta;
|
||||||
|
ARect.Bottom:=Arect.Top+rowheight;
|
||||||
|
ARect.Right:=aListBox.Width-delta-scrollwidth;
|
||||||
|
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCarbonWSCustomListBox.GetTopIndex
|
Method: TCarbonWSCustomListBox.GetTopIndex
|
||||||
Params: ACustomListBox - LCL custom list box
|
Params: ACustomListBox - LCL custom list box
|
||||||
|
@ -623,145 +623,6 @@ begin
|
|||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: GetListBoxIndexAtY
|
|
||||||
Params: ListBox:
|
|
||||||
y:
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TGtkWidgetSet.GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer;
|
|
||||||
{$IFdef GTK2}
|
|
||||||
var
|
|
||||||
aTreeView: PGtkTreeView;
|
|
||||||
aTreeColumn: PGtkTreeViewColumn;
|
|
||||||
aTreePath : PGtkTreePath;
|
|
||||||
AWinControl: TWinControl;
|
|
||||||
begin
|
|
||||||
Result:=-1;
|
|
||||||
if not (ListBox is TWinControl) then exit;
|
|
||||||
AWinControl:=TWinControl(ListBox);
|
|
||||||
case AWinControl.fCompStyle of
|
|
||||||
|
|
||||||
csListBox, csCheckListBox:
|
|
||||||
begin
|
|
||||||
aTreeView :=
|
|
||||||
GTK_TREE_VIEW(GetWidgetInfo(Pointer(AWinControl.Handle), True)
|
|
||||||
^.CoreWidget);
|
|
||||||
|
|
||||||
if gtk_tree_view_get_path_at_pos(aTreeView, 0, Y, aTreePath, aTreeColumn,
|
|
||||||
nil, nil)
|
|
||||||
then begin
|
|
||||||
Result := gtk_tree_path_get_indices(aTreePath)[0];
|
|
||||||
gtk_tree_path_free(aTreePath);
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$Else}
|
|
||||||
var
|
|
||||||
ScrolledWindow: PGtkScrolledWindow;
|
|
||||||
VertAdj: PGTKAdjustment;
|
|
||||||
AdjValue: integer;
|
|
||||||
ListWidget: PGtkList;
|
|
||||||
AWidget: PGtkWidget;
|
|
||||||
GListItem: PGList;
|
|
||||||
ListItemWidget: PGtkWidget;
|
|
||||||
begin
|
|
||||||
Result:=-1;
|
|
||||||
if not (ListBox is TCustomListbox) then exit;
|
|
||||||
|
|
||||||
if TCustomListbox(ListBox).FCompStyle in [csListBox, csCheckListBox] then
|
|
||||||
begin
|
|
||||||
AWidget:=PGtkWidget(TCustomListbox(ListBox).Handle);
|
|
||||||
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
|
||||||
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
|
||||||
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
|
||||||
if VertAdj=nil then
|
|
||||||
AdjValue:=y
|
|
||||||
else
|
|
||||||
AdjValue:=RoundToInt(VertAdj^.value)+y;
|
|
||||||
GListItem:=ListWidget^.children;
|
|
||||||
while GListItem<>nil do begin
|
|
||||||
inc(Result);
|
|
||||||
ListItemWidget:=PGtkWidget(GListItem^.data);
|
|
||||||
dec(AdjValue,ListItemWidget^.Allocation.Height);
|
|
||||||
if AdjValue<0 then exit;
|
|
||||||
GListItem:=GListItem^.next;
|
|
||||||
end;
|
|
||||||
Result:=-1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
function TGtkWidgetSet.GetListBoxItemRect(ListBox: TComponent; Index: integer;
|
|
||||||
var ARect: TRect): boolean;
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TGtkWidgetSet.GetListBoxItemRect(ListBox: TComponent; Index: integer;
|
|
||||||
var ARect: TRect): boolean;
|
|
||||||
{$IFdef GTK2}
|
|
||||||
var
|
|
||||||
AWinControl: TWinControl;
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
FillChar(ARect,SizeOf(ARect),0);
|
|
||||||
if not (ListBox is TWinControl) then exit;
|
|
||||||
AWinControl:=TWinControl(ListBox);
|
|
||||||
case AWinControl.fCompStyle of
|
|
||||||
|
|
||||||
csListBox, csCheckListBox:
|
|
||||||
begin
|
|
||||||
// ToDo
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$Else}
|
|
||||||
var
|
|
||||||
ScrolledWindow: PGtkScrolledWindow;
|
|
||||||
VertAdj: PGTKAdjustment;
|
|
||||||
AdjValue: integer;
|
|
||||||
ListWidget: PGtkList;
|
|
||||||
AWidget: PGtkWidget;
|
|
||||||
GListItem: PGList;
|
|
||||||
ListItemWidget: PGtkWidget;
|
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
FillChar(ARect,SizeOf(ARect),0);
|
|
||||||
if not (ListBox is TCustomListbox) then exit;
|
|
||||||
|
|
||||||
if TCustomListbox(ListBox).FCompStyle in [csListBox, csCheckListBox] then
|
|
||||||
begin
|
|
||||||
AWidget:=PGtkWidget(TCustomListbox(ListBox).Handle);
|
|
||||||
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
|
||||||
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
|
||||||
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
|
||||||
if VertAdj=nil then
|
|
||||||
AdjValue:=0
|
|
||||||
else
|
|
||||||
AdjValue:= (-RoundToInt(VertAdj^.value));
|
|
||||||
GListItem:=ListWidget^.children;
|
|
||||||
while GListItem<>nil do begin
|
|
||||||
ListItemWidget:=PGtkWidget(GListItem^.data);
|
|
||||||
if Index=0 then begin
|
|
||||||
ARect.Left:=0;
|
|
||||||
ARect.Top:=AdjValue;
|
|
||||||
ARect.Right:=ListItemWidget^.Allocation.Width;
|
|
||||||
ARect.Bottom:=ARect.Top+ListItemWidget^.Allocation.Height;
|
|
||||||
Result:=true;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
inc(AdjValue,ListItemWidget^.Allocation.Height);
|
|
||||||
dec(Index);
|
|
||||||
GListItem:=GListItem^.next;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TGtkWidgetSet.IntfSendsUTF8KeyPress: boolean;
|
function TGtkWidgetSet.IntfSendsUTF8KeyPress: boolean;
|
||||||
|
|
||||||
|
@ -47,8 +47,6 @@ function FontIsMonoSpace(Font: HFont): boolean; override;
|
|||||||
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
||||||
function GetControlConstraints(Constraints: TObject): boolean; override;
|
function GetControlConstraints(Constraints: TObject): boolean; override;
|
||||||
function GetLCLOwnerObject(Handle: HWnd): TObject; override;
|
function GetLCLOwnerObject(Handle: HWnd): TObject; override;
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
|
|
||||||
function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; override;
|
|
||||||
|
|
||||||
function IntfSendsUTF8KeyPress: boolean; override;
|
function IntfSendsUTF8KeyPress: boolean; override;
|
||||||
|
|
||||||
|
@ -115,10 +115,12 @@ type
|
|||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
{$IFDEF GTK1}
|
{$IFDEF GTK1}
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||||
@ -374,6 +376,42 @@ end;
|
|||||||
|
|
||||||
{ TGtkWSCustomListBox }
|
{ TGtkWSCustomListBox }
|
||||||
{$IFDEF GTK1}
|
{$IFDEF GTK1}
|
||||||
|
|
||||||
|
class function TGtkWSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
var
|
||||||
|
ScrolledWindow: PGtkScrolledWindow;
|
||||||
|
VertAdj: PGTKAdjustment;
|
||||||
|
AdjValue: integer;
|
||||||
|
ListWidget: PGtkList;
|
||||||
|
AWidget: PGtkWidget;
|
||||||
|
GListItem: PGList;
|
||||||
|
ListItemWidget: PGtkWidget;
|
||||||
|
begin
|
||||||
|
Result:=-1;
|
||||||
|
|
||||||
|
if ACustomListBox.FCompStyle in [csListBox, csCheckListBox] then
|
||||||
|
begin
|
||||||
|
AWidget:=PGtkWidget(ACustomListBox.Handle);
|
||||||
|
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
||||||
|
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
||||||
|
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
||||||
|
if VertAdj=nil then
|
||||||
|
AdjValue:=y
|
||||||
|
else
|
||||||
|
AdjValue:=RoundToInt(VertAdj^.value)+y;
|
||||||
|
GListItem:=ListWidget^.children;
|
||||||
|
while GListItem<>nil do begin
|
||||||
|
inc(Result);
|
||||||
|
ListItemWidget:=PGtkWidget(GListItem^.data);
|
||||||
|
dec(AdjValue,ListItemWidget^.Allocation.Height);
|
||||||
|
if AdjValue<0 then exit;
|
||||||
|
GListItem:=GListItem^.next;
|
||||||
|
end;
|
||||||
|
Result:=-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TGtkWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox
|
class function TGtkWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox
|
||||||
): integer;
|
): integer;
|
||||||
var
|
var
|
||||||
@ -417,6 +455,49 @@ begin
|
|||||||
{!$EndIf}
|
{!$EndIf}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TGtkWSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
var
|
||||||
|
ScrolledWindow: PGtkScrolledWindow;
|
||||||
|
VertAdj: PGTKAdjustment;
|
||||||
|
AdjValue: integer;
|
||||||
|
ListWidget: PGtkList;
|
||||||
|
AWidget: PGtkWidget;
|
||||||
|
GListItem: PGList;
|
||||||
|
ListItemWidget: PGtkWidget;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
FillChar(ARect,SizeOf(ARect),0);
|
||||||
|
|
||||||
|
if ACustomListBox.FCompStyle in [csListBox, csCheckListBox] then
|
||||||
|
begin
|
||||||
|
AWidget:=PGtkWidget(ACustomListBox.Handle);
|
||||||
|
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
||||||
|
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
||||||
|
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
||||||
|
if VertAdj=nil then
|
||||||
|
AdjValue:=0
|
||||||
|
else
|
||||||
|
AdjValue:= (-RoundToInt(VertAdj^.value));
|
||||||
|
GListItem:=ListWidget^.children;
|
||||||
|
while GListItem<>nil do begin
|
||||||
|
ListItemWidget:=PGtkWidget(GListItem^.data);
|
||||||
|
if Index=0 then begin
|
||||||
|
ARect.Left:=0;
|
||||||
|
ARect.Top:=AdjValue;
|
||||||
|
ARect.Right:=ListItemWidget^.Allocation.Width;
|
||||||
|
ARect.Bottom:=ARect.Top+ListItemWidget^.Allocation.Height;
|
||||||
|
Result:=true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
inc(AdjValue,ListItemWidget^.Allocation.Height);
|
||||||
|
dec(Index);
|
||||||
|
GListItem:=GListItem^.next;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TGtkWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox
|
class function TGtkWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox
|
||||||
): integer;
|
): integer;
|
||||||
var
|
var
|
||||||
@ -505,7 +586,7 @@ end;
|
|||||||
class function TGtkWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox
|
class function TGtkWSCustomListBox.GetTopIndex(const ACustomListBox: TCustomListBox
|
||||||
): integer;
|
): integer;
|
||||||
begin
|
begin
|
||||||
Result:=TGtkWidgetSet(WidgetSet).GetListBoxIndexAtY(ACustomListBox, 0);
|
Result := GetIndexAtY(ACustomListBox, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtkWSCustomListBox.SelectItem(const ACustomListBox: TCustomListBox;
|
class procedure TGtkWSCustomListBox.SelectItem(const ACustomListBox: TCustomListBox;
|
||||||
|
@ -146,11 +146,14 @@ type
|
|||||||
protected
|
protected
|
||||||
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: PWidgetInfo); virtual;
|
||||||
public
|
public
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AnIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AnIndex: integer; ASelected: boolean); override;
|
||||||
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
||||||
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
||||||
@ -372,10 +375,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TGtk2WSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
FillChar(ARect,SizeOf(ARect),0);
|
||||||
|
case ACustomListBox.fCompStyle of
|
||||||
|
csListBox, csCheckListBox:
|
||||||
|
begin
|
||||||
|
// ToDo
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TGtk2WSCustomListBox.GetTopIndex(
|
class function TGtk2WSCustomListBox.GetTopIndex(
|
||||||
const ACustomListBox: TCustomListBox): integer;
|
const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
Result:=TGtk2WidgetSet(WidgetSet).GetListBoxIndexAtY(ACustomListBox, 0);
|
Result := GetIndexAtY(ACustomListBox, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomListBox.SelectItem(
|
class procedure TGtk2WSCustomListBox.SelectItem(
|
||||||
@ -570,6 +587,32 @@ begin
|
|||||||
SignalConnect(PGtkWidget(Selection), 'changed', @Gtk2WS_ListBoxChange, AWidgetInfo);
|
SignalConnect(PGtkWidget(Selection), 'changed', @Gtk2WS_ListBoxChange, AWidgetInfo);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TGtk2WSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
var
|
||||||
|
aTreeView: PGtkTreeView;
|
||||||
|
aTreeColumn: PGtkTreeViewColumn;
|
||||||
|
aTreePath: PGtkTreePath;
|
||||||
|
begin
|
||||||
|
Result:=-1;
|
||||||
|
case ACustomListBox.fCompStyle of
|
||||||
|
csListBox, csCheckListBox:
|
||||||
|
begin
|
||||||
|
aTreeView :=
|
||||||
|
GTK_TREE_VIEW(GetWidgetInfo(Pointer(ACustomListBox.Handle), True)
|
||||||
|
^.CoreWidget);
|
||||||
|
|
||||||
|
if gtk_tree_view_get_path_at_pos(aTreeView, 0, Y, aTreePath, aTreeColumn,
|
||||||
|
nil, nil)
|
||||||
|
then begin
|
||||||
|
Result := gtk_tree_path_get_indices(aTreePath)[0];
|
||||||
|
gtk_tree_path_free(aTreePath);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TGtk2WSCustomListBox.GetSelCount(
|
class function TGtk2WSCustomListBox.GetSelCount(
|
||||||
const ACustomListBox: TCustomListBox): integer;
|
const ACustomListBox: TCustomListBox): integer;
|
||||||
var
|
var
|
||||||
|
@ -560,6 +560,8 @@ type
|
|||||||
procedure SetOwnerDrawn(const AValue: Boolean);
|
procedure SetOwnerDrawn(const AValue: Boolean);
|
||||||
public
|
public
|
||||||
constructor Create(const AWinControl: TWinControl; const AParams: TCreateParams); override;
|
constructor Create(const AWinControl: TWinControl; const AParams: TCreateParams); override;
|
||||||
|
function modelIndex(row, column: Integer; parent: QModelIndexH = nil): QModelIndexH;
|
||||||
|
function visualRect(Index: QModelIndexH): TRect;
|
||||||
property OwnerDrawn: Boolean read GetOwnerDrawn write SetOwnerDrawn;
|
property OwnerDrawn: Boolean read GetOwnerDrawn write SetOwnerDrawn;
|
||||||
public
|
public
|
||||||
procedure ItemDelegateSizeHint(option: QStyleOptionViewItemH; index: QModelIndexH; Size: PSize); cdecl;
|
procedure ItemDelegateSizeHint(option: QStyleOptionViewItemH; index: QModelIndexH; Size: PSize); cdecl;
|
||||||
@ -594,6 +596,7 @@ type
|
|||||||
procedure ItemDelegatePaint(painter: QPainterH; option: QStyleOptionViewItemH; index: QModelIndexH); cdecl; override;
|
procedure ItemDelegatePaint(painter: QPainterH; option: QStyleOptionViewItemH; index: QModelIndexH); cdecl; override;
|
||||||
public
|
public
|
||||||
function currentRow: Integer;
|
function currentRow: Integer;
|
||||||
|
function IndexAt(APoint: PQtPoint): Integer;
|
||||||
procedure setCurrentRow(row: Integer);
|
procedure setCurrentRow(row: Integer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4679,7 +4682,7 @@ begin
|
|||||||
State := QStyleOption_state(option);
|
State := QStyleOption_state(option);
|
||||||
DrawStruct.ItemID := QModelIndex_row(index);
|
DrawStruct.ItemID := QModelIndex_row(index);
|
||||||
|
|
||||||
QAbstractItemView_visualRect(QAbstractItemViewH(Widget), @DrawStruct.Area, index);
|
DrawStruct.Area := visualRect(index);
|
||||||
DrawStruct.DC := HDC(TQtDeviceContext.CreateFromPainter(painter));
|
DrawStruct.DC := HDC(TQtDeviceContext.CreateFromPainter(painter));
|
||||||
|
|
||||||
DrawStruct.ItemState := [];
|
DrawStruct.ItemState := [];
|
||||||
@ -4722,6 +4725,15 @@ begin
|
|||||||
Result := QListWidget_currentRow(QListWidgetH(Widget));
|
Result := QListWidget_currentRow(QListWidgetH(Widget));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtListWidget.IndexAt(APoint: PQtPoint): Integer;
|
||||||
|
var
|
||||||
|
AModelIndex: QModelIndexH;
|
||||||
|
begin
|
||||||
|
AModelIndex := QModelIndex_create();
|
||||||
|
QListView_indexAt(QListWidgetH(Widget), AModelIndex, APoint);
|
||||||
|
Result := QModelIndex_row(AModelIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: TQtListWidget.setCurrentRow
|
Function: TQtListWidget.setCurrentRow
|
||||||
Params: None
|
Params: None
|
||||||
@ -6114,6 +6126,20 @@ begin
|
|||||||
FNewDelegate := nil;
|
FNewDelegate := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtAbstractItemView.modelIndex(row, column: Integer; parent: QModelIndexH = nil): QModelIndexH;
|
||||||
|
var
|
||||||
|
AModel: QAbstractItemModelH;
|
||||||
|
begin
|
||||||
|
AModel := QAbstractItemView_model(QAbstractItemViewH(Widget));
|
||||||
|
Result := QModelIndex_create();
|
||||||
|
QAbstractItemModel_index(AModel, Result, row, column, parent);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TQtAbstractItemView.visualRect(Index: QModelIndexH): TRect;
|
||||||
|
begin
|
||||||
|
QAbstractItemView_visualRect(QAbstractItemViewH(Widget), @Result, Index);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQtAbstractItemView.ItemDelegateSizeHint(
|
procedure TQtAbstractItemView.ItemDelegateSizeHint(
|
||||||
option: QStyleOptionViewItemH; index: QModelIndexH; Size: PSize); cdecl;
|
option: QStyleOptionViewItemH; index: QModelIndexH; Size: PSize); cdecl;
|
||||||
var
|
var
|
||||||
|
@ -122,10 +122,12 @@ type
|
|||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): TLCLIntfHandle; override;
|
const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
public
|
public
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||||
@ -469,6 +471,15 @@ begin
|
|||||||
Result := THandle(QtListWidget);
|
Result := THandle(QtListWidget);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TQtWSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
var
|
||||||
|
APoint: TQtPoint;
|
||||||
|
begin
|
||||||
|
APoint := QtPoint(1, y);
|
||||||
|
Result := TQtListWidget(ACustomListBox.Handle).indexAt(@APoint);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TQtWSCustomListBox.GetSelCount
|
Method: TQtWSCustomListBox.GetSelCount
|
||||||
Params: None
|
Params: None
|
||||||
@ -529,6 +540,17 @@ begin
|
|||||||
Result := TQtListWidget(ACustomListBox.Handle).currentRow;
|
Result := TQtListWidget(ACustomListBox.Handle).currentRow;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TQtWSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
var
|
||||||
|
ModelIndex: QModelIndexH;
|
||||||
|
begin
|
||||||
|
ModelIndex := TQtListWidget(ACustomListBox.Handle).ModelIndex(Index, 0);
|
||||||
|
ARect := TQtListWidget(ACustomListBox.Handle).visualRect(ModelIndex);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TQtWSCustomListBox.GetTopIndex
|
Method: TQtWSCustomListBox.GetTopIndex
|
||||||
Params: None
|
Params: None
|
||||||
|
@ -354,33 +354,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: GetListBoxIndexAtY
|
|
||||||
Params: ListBox:
|
|
||||||
y:
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TWin32WidgetSet.GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
if ListBox is TCustomListBox then begin
|
|
||||||
Result := Windows.SendMessage(TCustomListBox(ListBox).Handle, LB_ITEMFROMPOINT, 0, MakeLParam(0,y));
|
|
||||||
if hi(Result)=0 then
|
|
||||||
Result := lo(Result)
|
|
||||||
else Result := -1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWin32WidgetSet.GetListBoxItemRect(ListBox: TComponent;
|
|
||||||
Index: integer; var ARect: TRect): boolean;
|
|
||||||
begin
|
|
||||||
Result := false;
|
|
||||||
if ListBox is TCustomListBox then
|
|
||||||
Result := Windows.SendMessage(TCustomListBox(ListBox).Handle,
|
|
||||||
LB_GETITEMRECT, Index, LPARAM(@ARect)) <> LB_ERR;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ifdef OldRawImageProcs}
|
{$ifdef OldRawImageProcs}
|
||||||
function TWin32WidgetSet.GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP; const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
function TWin32WidgetSet.GetRawImageFromBitmap(SrcBitmap, SrcMaskBitmap: HBITMAP; const SrcRect: TRect; var NewRawImage: TRawImage): boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -49,8 +49,6 @@ function FontCanUTF8(Font: HFont): boolean; override;
|
|||||||
|
|
||||||
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
||||||
function GetControlConstraints(Constraints: TObject): boolean; override;
|
function GetControlConstraints(Constraints: TObject): boolean; override;
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
|
|
||||||
function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; override;
|
|
||||||
|
|
||||||
{$note todo: remove ---}
|
{$note todo: remove ---}
|
||||||
{$ifdef OldRawImageProcs}
|
{$ifdef OldRawImageProcs}
|
||||||
|
@ -124,10 +124,12 @@ type
|
|||||||
var Left, Top, Width, Height: integer; var SuppressMove: boolean); override;
|
var Left, Top, Width, Height: integer; var SuppressMove: boolean); override;
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): HWND; override;
|
const AParams: TCreateParams): HWND; override;
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||||
@ -518,6 +520,16 @@ begin
|
|||||||
Result := Params.Window;
|
Result := Params.Window;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWin32WSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
begin
|
||||||
|
Result := Windows.SendMessage(ACustomListBox.Handle, LB_ITEMFROMPOINT, 0, MakeLParam(0,y));
|
||||||
|
if hi(Result)=0 then
|
||||||
|
Result := lo(Result)
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
class function TWin32WSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
if ACustomListBox.MultiSelect then
|
if ACustomListBox.MultiSelect then
|
||||||
@ -533,6 +545,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWin32WSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
begin
|
||||||
|
Result := Windows.SendMessage(ACustomListBox.Handle, LB_GETITEMRECT, Index,
|
||||||
|
LPARAM(@ARect)) <> LB_ERR;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
|
class function TWin32WSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
// GetSelCount only works for multiple-selection listboxes
|
// GetSelCount only works for multiple-selection listboxes
|
||||||
|
@ -463,22 +463,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
Function: GetListBoxIndexAtY
|
|
||||||
Params: ListBox:
|
|
||||||
y:
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TWinCEWidgetSet.GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
if ListBox is TCustomListBox then begin
|
|
||||||
Result := Windows.SendMessage(TCustomListBox(ListBox).Handle, LB_ITEMFROMPOINT, 0, MakeLParam(0,y));
|
|
||||||
if hi(Result)=0 then
|
|
||||||
Result := lo(Result)
|
|
||||||
else Result := -1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||||
|
@ -41,7 +41,6 @@ procedure DrawArrow(Arrow: TComponent; Canvas: TPersistent); override;
|
|||||||
|
|
||||||
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
function GetAcceleratorString(const AVKey: Byte; const AShiftState: TShiftState): String; override;
|
||||||
function GetControlConstraints(Constraints: TObject): boolean; override;
|
function GetControlConstraints(Constraints: TObject): boolean; override;
|
||||||
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
|
|
||||||
|
|
||||||
function RawImage_CreateBitmaps(const ARawImage: TRawImage; out ABitmap, AMask: HBitmap; ASkipMask: Boolean = False): Boolean; override;
|
function RawImage_CreateBitmaps(const ARawImage: TRawImage; out ABitmap, AMask: HBitmap; ASkipMask: Boolean = False): Boolean; override;
|
||||||
function RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): Boolean; override;
|
function RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): Boolean; override;
|
||||||
|
@ -114,11 +114,13 @@ type
|
|||||||
public
|
public
|
||||||
class function CreateHandle(const AWinControl: TWinControl;
|
class function CreateHandle(const AWinControl: TWinControl;
|
||||||
const AParams: TCreateParams): HWND; override;
|
const AParams: TCreateParams): HWND; override;
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||||
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
||||||
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
||||||
@ -456,6 +458,16 @@ begin
|
|||||||
Result := Params.Window;
|
Result := Params.Window;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWinCEWSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
begin
|
||||||
|
Result := Windows.SendMessage(ACustomListBox.Handle, LB_ITEMFROMPOINT, 0, MakeLParam(0,y));
|
||||||
|
if hi(Result)=0 then
|
||||||
|
Result := lo(Result)
|
||||||
|
else
|
||||||
|
Result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
//this should not be called in multiple selection things
|
//this should not be called in multiple selection things
|
||||||
class function TWinCEWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
class function TWinCEWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
|
@ -100,11 +100,14 @@ type
|
|||||||
{ TWSCustomListBox }
|
{ TWSCustomListBox }
|
||||||
|
|
||||||
TWSCustomListBox = class(TWSWinControl)
|
TWSCustomListBox = class(TWSWinControl)
|
||||||
|
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; virtual;
|
||||||
|
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; virtual;
|
||||||
|
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; virtual;
|
||||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; virtual;
|
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; virtual;
|
||||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; virtual;
|
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; virtual;
|
||||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; virtual;
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; virtual;
|
||||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; virtual;
|
|
||||||
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; virtual;
|
class function GetTopIndex(const ACustomListBox: TCustomListBox): integer; virtual;
|
||||||
|
|
||||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); virtual;
|
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); virtual;
|
||||||
|
|
||||||
class procedure SetBorder(const ACustomListBox: TCustomListBox); virtual;
|
class procedure SetBorder(const ACustomListBox: TCustomListBox); virtual;
|
||||||
@ -223,11 +226,25 @@ end;
|
|||||||
|
|
||||||
{ TWSCustomListBox }
|
{ TWSCustomListBox }
|
||||||
|
|
||||||
|
class function TWSCustomListBox.GetIndexAtY(
|
||||||
|
const ACustomListBox: TCustomListBox; y: integer): integer;
|
||||||
|
begin
|
||||||
|
Result := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
class function TWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class function TWSCustomListBox.GetItemRect(
|
||||||
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||||
|
): boolean;
|
||||||
|
begin
|
||||||
|
FillChar(ARect,SizeOf(ARect),0);
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
class function TWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
|
class function TWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user