mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 22:00:50 +02:00
convert LM_GETITEMS message to interface method
git-svn-id: trunk@6005 -
This commit is contained in:
parent
6f629054b9
commit
489c23ece2
@ -69,7 +69,7 @@ begin
|
|||||||
CNSendMessage(LM_SETBORDER, Self, nil);
|
CNSendMessage(LM_SETBORDER, Self, nil);
|
||||||
|
|
||||||
// fetch the interface item list
|
// fetch the interface item list
|
||||||
NewStrings:= TStrings(Pointer(CNSendMessage(LM_GETITEMS, Self, nil)));
|
NewStrings := TWSCustomListBoxClass(WidgetSetClass).GetStrings(Self);
|
||||||
// copy the items (text+objects)
|
// copy the items (text+objects)
|
||||||
NewStrings.Assign(Items);
|
NewStrings.Assign(Items);
|
||||||
OldItems := FItems as TExtendedStringList;
|
OldItems := FItems as TExtendedStringList;
|
||||||
|
@ -3126,39 +3126,6 @@ begin
|
|||||||
PLMScreenInit(Data)^.ColorDepth:= gdk_visual_get_system^.depth;
|
PLMScreenInit(Data)^.ColorDepth:= gdk_visual_get_system^.depth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
LM_GETITEMS :
|
|
||||||
{$IFdef GTK2}
|
|
||||||
begin
|
|
||||||
DebugLn('TODO: TGtkWidgetSet.IntSendMessage3 LM_GETITEMS');
|
|
||||||
end;
|
|
||||||
{$Else}
|
|
||||||
begin
|
|
||||||
case TControl(Sender).fCompStyle of
|
|
||||||
csCListBox:
|
|
||||||
begin
|
|
||||||
Widget:= GetWidgetInfo(Pointer(Handle), True)^.CoreWidget;
|
|
||||||
|
|
||||||
Data := TGtkCListStringList.Create(PGtkCList(Widget));
|
|
||||||
if Sender is TCustomListBox then
|
|
||||||
TGtkCListStringList(Data).Sorted:=TCustomListBox(Sender).Sorted;
|
|
||||||
Result := integer(Data);
|
|
||||||
end;
|
|
||||||
|
|
||||||
csCheckListBox, csListBox:
|
|
||||||
begin
|
|
||||||
Widget:= GetWidgetInfo(Pointer(Handle), True)^.CoreWidget;
|
|
||||||
Data:= TGtkListStringList.Create(PGtkList(Widget),
|
|
||||||
TWinControl(Sender), TControl(Sender).fCompStyle = csCheckListBox);
|
|
||||||
if Sender is TCustomListBox then
|
|
||||||
TGtkListStringList(Data).Sorted:=TCustomListBox(Sender).Sorted;
|
|
||||||
Result:= Integer(Data);
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
raise Exception.Create('Message LM_GETITEMS - Not implemented');
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$EndIf}
|
|
||||||
|
|
||||||
LM_GETITEMINDEX :
|
LM_GETITEMINDEX :
|
||||||
begin
|
begin
|
||||||
case TControl(Sender).fCompStyle of
|
case TControl(Sender).fCompStyle of
|
||||||
@ -8190,6 +8157,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.569 2004/09/15 14:45:39 micha
|
||||||
|
convert LM_GETITEMS message to interface method
|
||||||
|
|
||||||
Revision 1.568 2004/09/15 07:57:59 micha
|
Revision 1.568 2004/09/15 07:57:59 micha
|
||||||
convert LM_SETFORMICON message to interface method
|
convert LM_SETFORMICON message to interface method
|
||||||
|
|
||||||
|
@ -27,13 +27,13 @@ unit GtkWSStdCtrls;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
StdCtrls,
|
StdCtrls, SysUtils,
|
||||||
{$IFDEF gtk2}
|
{$IFDEF gtk2}
|
||||||
glib2, gdk2pixbuf, gdk2, gtk2, Pango,
|
glib2, gdk2pixbuf, gdk2, gtk2, Pango,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
glib, gdk, gtk, {$Ifndef NoGdkPixbufLib}gdkpixbuf,{$EndIf} GtkFontCache,
|
glib, gdk, gtk, {$Ifndef NoGdkPixbufLib}gdkpixbuf,{$EndIf} GtkFontCache,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
WSStdCtrls, WSLCLClasses, GtkInt, Classes,
|
WSStdCtrls, WSLCLClasses, GtkInt, Classes, LCLType,
|
||||||
GTKWinApiWindow, gtkglobals, gtkproc;
|
GTKWinApiWindow, gtkglobals, gtkproc;
|
||||||
|
|
||||||
|
|
||||||
@ -97,6 +97,7 @@ type
|
|||||||
private
|
private
|
||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtkWSListBox }
|
{ TGtkWSListBox }
|
||||||
@ -247,6 +248,40 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TGtkWSCustomListBox }
|
||||||
|
|
||||||
|
function TGtkWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
|
||||||
|
var
|
||||||
|
Widget : PGtkWidget; // pointer to gtk-widget
|
||||||
|
Handle: HWND;
|
||||||
|
begin
|
||||||
|
{$ifdef GTK2}
|
||||||
|
DebugLn('TODO: TGtkWSCustomListBox.GetStrings');
|
||||||
|
{$else}
|
||||||
|
Handle := ACustomListBox.Handle;
|
||||||
|
case ACustomListBox.fCompStyle of
|
||||||
|
csCListBox:
|
||||||
|
begin
|
||||||
|
Widget:= GetWidgetInfo(Pointer(Handle), True)^.CoreWidget;
|
||||||
|
|
||||||
|
Result := TGtkCListStringList.Create(PGtkCList(Widget));
|
||||||
|
if ACustomListBox is TCustomListBox then
|
||||||
|
TGtkCListStringList(Result).Sorted := TCustomListBox(ACustomListBox).Sorted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
csCheckListBox, csListBox:
|
||||||
|
begin
|
||||||
|
Widget := GetWidgetInfo(Pointer(Handle), True)^.CoreWidget;
|
||||||
|
Result := TGtkListStringList.Create(PGtkList(Widget),
|
||||||
|
ACustomListBox, ACustomListBox.fCompStyle = csCheckListBox);
|
||||||
|
if ACustomListBox is TCustomListBox then
|
||||||
|
TGtkListStringList(Result).Sorted := ACustomListBox.Sorted;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
raise Exception.Create('TGtkWSCustomListBox.GetStrings');
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
|
||||||
{ TGtkWSCustomComboBox }
|
{ TGtkWSCustomComboBox }
|
||||||
|
|
||||||
|
@ -330,17 +330,6 @@ Begin
|
|||||||
Else
|
Else
|
||||||
Assert(False, Format('Trace:I don''t know how to destroy component %S', [Sender.ClassName]));
|
Assert(False, Format('Trace:I don''t know how to destroy component %S', [Sender.ClassName]));
|
||||||
End;
|
End;
|
||||||
LM_GETITEMS :
|
|
||||||
Begin
|
|
||||||
If (Sender as TControl).fCompStyle = csCListBox
|
|
||||||
Then Data := TWin32CListStringList.Create(Handle,TWinControl(Sender))
|
|
||||||
Else
|
|
||||||
If (Sender Is TCheckListBox)
|
|
||||||
Then Data := TWin32CheckListBoxStrings.Create(Handle,TWinControl(Sender))
|
|
||||||
Else Data := TWin32ListStringList.Create(Handle,TWinControl(Sender));
|
|
||||||
Result := Integer(Data);
|
|
||||||
Windows.SetProp(Handle, 'List', Result);
|
|
||||||
End;
|
|
||||||
LM_GETITEMINDEX :
|
LM_GETITEMINDEX :
|
||||||
Begin
|
Begin
|
||||||
Case (Sender as TControl).FCompStyle Of
|
Case (Sender as TControl).FCompStyle Of
|
||||||
@ -2235,6 +2224,9 @@ End;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.262 2004/09/15 14:45:39 micha
|
||||||
|
convert LM_GETITEMS message to interface method
|
||||||
|
|
||||||
Revision 1.261 2004/09/15 07:58:00 micha
|
Revision 1.261 2004/09/15 07:58:00 micha
|
||||||
convert LM_SETFORMICON message to interface method
|
convert LM_SETFORMICON message to interface method
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ uses
|
|||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
StdCtrls,
|
StdCtrls,
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
WSStdCtrls, WSLCLClasses, Classes, Windows;
|
WSStdCtrls, WSLCLClasses, Classes, Windows, Win32Int, InterfaceBase, LCLType;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -98,6 +98,7 @@ type
|
|||||||
protected
|
protected
|
||||||
public
|
public
|
||||||
class procedure SetStyle(const ACustomListBox: TCustomListBox); override;
|
class procedure SetStyle(const ACustomListBox: TCustomListBox); override;
|
||||||
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWin32WSListBox }
|
{ TWin32WSListBox }
|
||||||
@ -229,11 +230,21 @@ procedure EditSetSelLength(WinHandle: HWND; NewLength: integer);
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
Win32Int, InterfaceBase;
|
|
||||||
|
|
||||||
{ TWin32WSCustomListBox }
|
{ TWin32WSCustomListBox }
|
||||||
|
|
||||||
|
function TWin32WSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
|
||||||
|
var
|
||||||
|
Handle: HWND;
|
||||||
|
begin
|
||||||
|
Handle := ACustomListBox.Handle;
|
||||||
|
if ACustomListBox.fCompStyle = csCListBox
|
||||||
|
then Result := TWin32CListStringList.Create(Handle, ACustomListBox)
|
||||||
|
else
|
||||||
|
if ACustomListBox.fCompStyle = csCheckListBox then
|
||||||
|
Result := TWin32CheckListBoxStrings.Create(Handle, ACustomListBox);
|
||||||
|
Windows.SetProp(Handle, 'List', dword(Result));
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TWin32WSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
|
procedure TWin32WSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
|
||||||
begin
|
begin
|
||||||
// The listbox styles can't be updated, so recreate the listbox
|
// The listbox styles can't be updated, so recreate the listbox
|
||||||
|
@ -71,7 +71,6 @@ const
|
|||||||
|
|
||||||
LM_SETGEOMETRY = LM_COMUSER+62;
|
LM_SETGEOMETRY = LM_COMUSER+62;
|
||||||
|
|
||||||
LM_GETITEMS = LM_COMUSER+63;
|
|
||||||
LM_GETITEMINDEX = LM_COMUSER+64;
|
LM_GETITEMINDEX = LM_COMUSER+64;
|
||||||
LM_SETITEMINDEX = LM_COMUSER+65;
|
LM_SETITEMINDEX = LM_COMUSER+65;
|
||||||
LM_GETSELTEXT = LM_COMUSER+66;
|
LM_GETSELTEXT = LM_COMUSER+66;
|
||||||
@ -839,7 +838,6 @@ begin
|
|||||||
|
|
||||||
LM_SETGEOMETRY :Result:='LM_SETGEOMETRY';
|
LM_SETGEOMETRY :Result:='LM_SETGEOMETRY';
|
||||||
|
|
||||||
LM_GETITEMS :Result:='LM_GETITEMS';
|
|
||||||
LM_GETITEMINDEX :Result:='LM_GETITEMINDEX';
|
LM_GETITEMINDEX :Result:='LM_GETITEMINDEX';
|
||||||
LM_SETITEMINDEX :Result:='LM_SETITEMINDEX';
|
LM_SETITEMINDEX :Result:='LM_SETITEMINDEX';
|
||||||
LM_GETSELTEXT :Result:='LM_GETSELTEXT';
|
LM_GETSELTEXT :Result:='LM_GETSELTEXT';
|
||||||
@ -959,6 +957,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.101 2004/09/15 14:45:39 micha
|
||||||
|
convert LM_GETITEMS message to interface method
|
||||||
|
|
||||||
Revision 1.100 2004/09/15 07:57:59 micha
|
Revision 1.100 2004/09/15 07:57:59 micha
|
||||||
convert LM_SETFORMICON message to interface method
|
convert LM_SETFORMICON message to interface method
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ type
|
|||||||
TWSCustomListBox = class(TWSWinControl)
|
TWSCustomListBox = class(TWSWinControl)
|
||||||
public
|
public
|
||||||
class procedure SetStyle(const ACustomListBox: TCustomListBox); virtual;
|
class procedure SetStyle(const ACustomListBox: TCustomListBox); virtual;
|
||||||
|
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; virtual;
|
||||||
end;
|
end;
|
||||||
TWSCustomListBoxClass = class of TWSCustomListBox;
|
TWSCustomListBoxClass = class of TWSCustomListBox;
|
||||||
|
|
||||||
@ -187,6 +188,11 @@ procedure TWSCustomListBox.SetStyle(const ACustomListBox: TCustomListBox);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TWSCustomListBox.GetStrings(const ACustomListBox: TCustomListBox): TStrings;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TWSCustomComboBox }
|
{ TWSCustomComboBox }
|
||||||
|
|
||||||
function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
function TWSCustomComboBox.GetSelStart(const ACustomComboBox: TCustomComboBox): integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user