mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 12:29:21 +01:00
MWE:
* Cleanup in lmessages * Added Listview selection and notification events + introduced commctrl git-svn-id: trunk@1548 -
This commit is contained in:
parent
975e5a1711
commit
9efa84c67a
297
lcl/comctrls.pp
297
lcl/comctrls.pp
@ -34,265 +34,7 @@ interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Controls, LclLinux, LCLType, StdCtrls, ExtCtrls,
|
||||
vclGlobals, lMessages, Menus, ImgList, GraphType, Graphics, ToolWin;
|
||||
|
||||
|
||||
const
|
||||
TBSTATE_CHECKED = $01;
|
||||
TBSTATE_PRESSED = $02;
|
||||
TBSTATE_ENABLED = $04;
|
||||
TBSTATE_HIDDEN = $08;
|
||||
TBSTATE_INDETERMINATE = $10;
|
||||
TBSTATE_WRAP = $20;
|
||||
TBSTATE_ELLIPSES = $40;
|
||||
TBSTATE_MARKED = $80;
|
||||
|
||||
TBSTYLE_BUTTON = $00;
|
||||
TBSTYLE_SEP = $01;
|
||||
TBSTYLE_CHECK = $02;
|
||||
TBSTYLE_GROUP = $04;
|
||||
TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK;
|
||||
TBSTYLE_DROPDOWN = $08;
|
||||
TBSTYLE_AUTOSIZE = $0010;
|
||||
TBSTYLE_NOPREFIX = $0020;
|
||||
|
||||
TBSTYLE_TOOLTIPS = $0100;
|
||||
TBSTYLE_WRAPABLE = $0200;
|
||||
TBSTYLE_ALTDRAG = $0400;
|
||||
TBSTYLE_FLAT = $0800;
|
||||
TBSTYLE_LIST = $1000;
|
||||
TBSTYLE_CUSTOMERASE = $2000;
|
||||
TBSTYLE_REGISTERDROP = $4000;
|
||||
TBSTYLE_TRANSPARENT = $8000;
|
||||
TBSTYLE_EX_DRAWDDARROWS = $00000001;
|
||||
|
||||
|
||||
ToolBarClassName = 'ToolbarWindow32';
|
||||
|
||||
// Toolbar custom draw result flags
|
||||
{Not used yet, but soon}
|
||||
TBCDRF_NOEDGES = $00010000; // Don't draw the button edges
|
||||
TBCDRF_HILITEHOTTRACK = $00020000; // Use color of the button bk when hottracked
|
||||
TBCDRF_NOOFFSET = $00040000; // Don't offset the button if pressed
|
||||
TBCDRF_NOMARK = $00080000; // Don't draw the default highlight of the image/text for TBSTATE_MARKED
|
||||
TBCDRF_NOETCHEDEFFECT = $00100000; // Don't draw the etched effect for disabled items
|
||||
|
||||
TB_ENABLEBUTTON = WM_USER + 1;
|
||||
TB_CHECKBUTTON = WM_USER + 2;
|
||||
TB_PRESSBUTTON = WM_USER + 3;
|
||||
TB_HIDEBUTTON = WM_USER + 4;
|
||||
TB_INDETERMINATE = WM_USER + 5;
|
||||
TB_MARKBUTTON = WM_USER + 6;
|
||||
TB_ISBUTTONENABLED = WM_USER + 9;
|
||||
TB_ISBUTTONCHECKED = WM_USER + 10;
|
||||
TB_ISBUTTONPRESSED = WM_USER + 11;
|
||||
TB_ISBUTTONHIDDEN = WM_USER + 12;
|
||||
TB_ISBUTTONINDETERMINATE= WM_USER + 13;
|
||||
TB_ISBUTTONHIGHLIGHTED = WM_USER + 14;
|
||||
TB_SETSTATE = WM_USER + 17;
|
||||
TB_GETSTATE = WM_USER + 18;
|
||||
TB_ADDBITMAP = WM_USER + 19;
|
||||
TB_INSERTBUTTONA = WM_USER + 21;
|
||||
TB_DELETEBUTTON = WM_USER + 22;
|
||||
TB_GETBUTTON = WM_USER + 23;
|
||||
TB_BUTTONCOUNT = WM_USER + 24;
|
||||
|
||||
TB_CUSTOMIZE = WM_USER + 27;
|
||||
TB_ADDSTRINGA = WM_USER + 28;
|
||||
TB_GETITEMRECT = WM_USER + 29;
|
||||
TB_BUTTONSTRUCTSIZE = WM_USER + 30;
|
||||
TB_SETBUTTONSIZE = WM_USER + 31;
|
||||
TB_SETBITMAPSIZE = WM_USER + 32;
|
||||
TB_AUTOSIZE = WM_USER + 33;
|
||||
TB_GETTOOLTIPS = WM_USER + 35;
|
||||
TB_SETTOOLTIPS = WM_USER + 36;
|
||||
TB_SETPARENT = WM_USER + 37;
|
||||
TB_SETROWS = WM_USER + 39;
|
||||
TB_GETROWS = WM_USER + 40;
|
||||
TB_SETCMDID = WM_USER + 42;
|
||||
TB_CHANGEBITMAP = WM_USER + 43;
|
||||
TB_GETBITMAP = WM_USER + 44;
|
||||
TB_REPLACEBITMAP = WM_USER + 46;
|
||||
TB_SETINDENT = WM_USER + 47;
|
||||
TB_SETIMAGELIST = WM_USER + 48;
|
||||
TB_GETIMAGELIST = WM_USER + 49;
|
||||
TB_LOADIMAGES = WM_USER + 50;
|
||||
TB_GETRECT = WM_USER + 51;
|
||||
TB_SETHOTIMAGELIST = WM_USER + 52;
|
||||
TB_GETHOTIMAGELIST = WM_USER + 53;
|
||||
TB_SETDISABLEDIMAGELIST = WM_USER + 54;
|
||||
TB_GETDISABLEDIMAGELIST = WM_USER + 55;
|
||||
TB_SETSTYLE = WM_USER + 56;
|
||||
TB_GETSTYLE = WM_USER + 57;
|
||||
TB_GETBUTTONSIZE = WM_USER + 58;
|
||||
TB_SETBUTTONWIDTH = WM_USER + 59;
|
||||
TB_SETMAXTEXTROWS = WM_USER + 60;
|
||||
TB_GETTEXTROWS = WM_USER + 61;
|
||||
TB_GETBUTTONINFOW = WM_USER + 63;
|
||||
TB_SETBUTTONINFOW = WM_USER + 64;
|
||||
TB_GETBUTTONINFOA = WM_USER + 65;
|
||||
TB_SETBUTTONINFOA = WM_USER + 66;
|
||||
|
||||
TB_GETHOTITEM = WM_USER + 71;
|
||||
TB_SETHOTITEM = WM_USER + 72;
|
||||
|
||||
TB_ADDSTRINGW = WM_USER = 77;
|
||||
|
||||
|
||||
TB_INSERTBUTTON = TB_INSERTBUTTONA;
|
||||
TB_ADDSTRING = TB_ADDSTRINGA;
|
||||
TB_GETBUTTONINFO = TB_GETBUTTONINFOA;
|
||||
TB_SETBUTTONINFO = TB_SETBUTTONINFOA;
|
||||
|
||||
const
|
||||
TBN_First = 0-700;
|
||||
TBN_Last = 0-720;
|
||||
|
||||
TBN_BEGINDRAG = TBN_FIRST-1;
|
||||
TBN_ENDDRAG = TBN_FIRST-2;
|
||||
TBN_BEGINADJUST = TBN_FIRST-3;
|
||||
TBN_ENDADJUST = TBN_FIRST-4;
|
||||
TBN_RESET = TBN_FIRST-5;
|
||||
TBN_QUERYINSERT = TBN_FIRST-6;
|
||||
TBN_QUERYDELETE = TBN_FIRST-7;
|
||||
TBN_TOOLBARCHANGE = TBN_FIRST-8;
|
||||
TBN_CUSTHELP = TBN_FIRST-9;
|
||||
TBN_DROPDOWN = TBN_FIRST-10;
|
||||
TBN_CLOSEUP = TBN_FIRST-11;
|
||||
TBN_GETOBJECT = TBN_FIRST-12;
|
||||
|
||||
TBIF_IMAGE = $00000001;
|
||||
TBIF_TEXT = $00000002;
|
||||
TBIF_STATE = $00000004;
|
||||
TBIF_STYLE = $00000008;
|
||||
TBIF_LPARAM = $00000010;
|
||||
TBIF_COMMAND = $00000020;
|
||||
TBIF_SIZE = $00000040;
|
||||
|
||||
|
||||
type
|
||||
PTBButton = ^TTBButton;
|
||||
_TBBUTTON = packed record
|
||||
iBitmap: Integer;
|
||||
idCommand: Integer;
|
||||
fsState: Byte;
|
||||
fsStyle: Byte;
|
||||
bReserved: array[1..2] of Byte;
|
||||
dwData: Longint;
|
||||
iString: Integer;
|
||||
end;
|
||||
TTBButton = _TBBUTTON;
|
||||
|
||||
TBBUTTONINFOA = packed record
|
||||
cbSize: UINT;
|
||||
dwMask: DWORD;
|
||||
idCommand: Integer;
|
||||
iImage: Integer;
|
||||
fsState: Byte;
|
||||
fsStyle: Byte;
|
||||
cx: Word;
|
||||
lParam: DWORD;
|
||||
pszText: PAnsiChar;
|
||||
cchText: Integer;
|
||||
end;
|
||||
|
||||
TBBUTTONINFOW = packed record
|
||||
cbSize: UINT;
|
||||
dwMask: DWORD;
|
||||
idCommand: Integer;
|
||||
iImage: Integer;
|
||||
fsState: Byte;
|
||||
fsStyle: Byte;
|
||||
cx: Word;
|
||||
lParam: DWORD;
|
||||
pszText: PWideChar;
|
||||
cchText: Integer;
|
||||
end;
|
||||
TBBUTTONINFO = TBBUTTONINFOA;
|
||||
|
||||
PTBButtonInfoA = ^TTBButtonInfoA;
|
||||
PTBButtonInfoW = ^TTBButtonInfoW;
|
||||
|
||||
PTBButtonInfo = PTBButtonInfoA;
|
||||
|
||||
TTBButtonInfoA = TBBUTTONINFOA;
|
||||
TTBButtonInfoW = TBBUTTONINFOW;
|
||||
TTBButtonInfo = TTBButtonInfoA;
|
||||
|
||||
type
|
||||
PTBAddBitmap = ^TTBAddBitmap;
|
||||
tagTBADDBITMAP = packed record
|
||||
hInst: THandle;
|
||||
nID: UINT;
|
||||
end;
|
||||
TTBAddBitmap = tagTBADDBITMAP;
|
||||
|
||||
TBADDBITMAP = tagTBADDBITMAP;
|
||||
|
||||
type
|
||||
TBREPLACEBITMAP = packed record
|
||||
hInstOld: THandle;
|
||||
nIDOld: Cardinal;
|
||||
hInstNew: THandle;
|
||||
nIDNew: Cardinal;
|
||||
nButtons: Integer;
|
||||
end;
|
||||
PTBReplaceBitmap = ^TTBReplaceBitmap;
|
||||
TTBReplaceBitmap = TBREPLACEBITMAP;
|
||||
|
||||
tagNMTOOLBARA = packed record
|
||||
hdr: TNMHdr;
|
||||
iItem: Integer;
|
||||
tbButton: TTBButton;
|
||||
cchText: Integer;
|
||||
pszText: PAnsiChar;
|
||||
end;
|
||||
|
||||
tagNMTOOLBARW = packed record
|
||||
hdr: TNMHdr;
|
||||
iItem: Integer;
|
||||
tbButton: TTBButton;
|
||||
cchText: Integer;
|
||||
pszText: PWideChar;
|
||||
end;
|
||||
|
||||
tagNMTOOLBAR = tagNMTOOLBARA;
|
||||
PNMToolBarA = ^TNMToolBarA;
|
||||
PNMToolBarW = ^TNMToolBarW;
|
||||
PNMToolBar = PNMToolBarA;
|
||||
TNMToolBarA = tagNMTOOLBARA;
|
||||
TNMToolBarW = tagNMTOOLBARW;
|
||||
TNMToolBar = TNMToolBarA;
|
||||
|
||||
const
|
||||
|
||||
CCS_TOP = $00000001;
|
||||
CCS_NOMOVEY = $00000002;
|
||||
CCS_BOTTOM = $00000003;
|
||||
CCS_NORESIZE = $00000004;
|
||||
CCS_NOPARENTALIGN = $00000008;
|
||||
CCS_ADJUSTABLE = $00000020;
|
||||
CCS_NODIVIDER = $00000040;
|
||||
CCS_VERT = $00000080;
|
||||
CCS_LEFT = (CCS_VERT or CCS_TOP);
|
||||
CCS_RIGHT = (CCS_VERT or CCS_BOTTOM);
|
||||
CCS_NOMOVEX = (CCS_VERT or CCS_NOMOVEY);
|
||||
|
||||
ICC_LISTVIEW_CLASSES = $00000001;
|
||||
ICC_TREEVIEW_CLASSES = $00000002;
|
||||
ICC_BAR_CLASSES = $00000004;
|
||||
ICC_TAB_CLASSES = $00000008;
|
||||
ICC_UPDOWN_CLASS = $00000010;
|
||||
ICC_PROGRESS_CLASS = $00000020;
|
||||
ICC_HOTKEY_CLASS = $00000040;
|
||||
ICC_ANIMATE_CLASS = $00000080;
|
||||
ICC_WIN95_CLASSES = $000000FF;
|
||||
ICC_DATE_CLASSES = $00000100;
|
||||
ICC_USEREX_CLASSES = $00000200;
|
||||
ICC_COOL_CLASSES = $00000400;
|
||||
ICC_INTERNET_CLASSES = $00000800;
|
||||
ICC_PAGESCROLLER_CLASS = $00001000;
|
||||
ICC_NATIVEFNTCTL_CLASS = $00002000;
|
||||
vclGlobals, lMessages, Menus, ImgList, GraphType, Graphics, ToolWin, CommCtrl;
|
||||
|
||||
type
|
||||
{ TAlignment = Class(TWinControl)
|
||||
@ -381,7 +123,7 @@ type
|
||||
cdsFocused, cdsDefault, cdsHot, cdsMarked, cdsIndeterminate);
|
||||
|
||||
|
||||
|
||||
{TListView}
|
||||
TListItems = class; //forward declaration!
|
||||
TCustomListView = class; //forward declaration!
|
||||
TSortType = (stNone, stData, stText, stBoth);
|
||||
@ -395,12 +137,14 @@ type
|
||||
FData: Pointer;
|
||||
FImageIndex: Integer;
|
||||
FDestroying: Boolean;
|
||||
function GetState(const AIndex: Integer): Boolean;
|
||||
procedure SetState(const AIndex: Integer; const AState: Boolean);
|
||||
|
||||
procedure SetData(const AValue: Pointer);
|
||||
procedure SetImageIndex(const AValue: Integer);
|
||||
procedure SetCaption(const AValue : String);
|
||||
// Procedure SetSubItems(Value : TStrings);
|
||||
Function GetIndex : Integer;
|
||||
function GetIndex : Integer;
|
||||
protected
|
||||
Procedure ItemChanged(sender : TObject); //called by the onchange of the tstringlist in TListItem
|
||||
|
||||
@ -409,9 +153,13 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure Delete;
|
||||
property Caption : String read FCaption write SetCaption;
|
||||
property Cut: Boolean index 0 read GetState write SetState;
|
||||
property Data: Pointer read FData write SetData;
|
||||
property DropTarget: Boolean index 1 read GetState write SetState;
|
||||
property Focused: Boolean index 2 read GetState write SetState;
|
||||
property Index : Integer read GetIndex;
|
||||
property Owner : TListItems read FOwner;
|
||||
property Selected: Boolean index 3 read GetState write SetState;
|
||||
property SubItems : TStrings read FSubItems write FSubItems;//SetSubItems;
|
||||
property ImageIndex : Integer read FImageIndex write SetImageIndex default -1;
|
||||
end;
|
||||
@ -491,9 +239,14 @@ type
|
||||
property Items[const AIndex: Integer]: TListColumn read GetItem write SetItem; default;
|
||||
end;
|
||||
|
||||
|
||||
TItemChange = (ctText, ctImage, ctState);
|
||||
TViewStyle = (vsList,vsReport);
|
||||
|
||||
TLVChangeEvent = procedure(Sender: TObject; Item: TListItem; Change: TItemChange) of object;
|
||||
TLVColumnClickEvent = procedure(Sender: TObject; Column: TListColumn) of object;
|
||||
TLVColumnRClickEvent = procedure(Sender: TObject; Column: TListColumn; Point: TPoint) of object;
|
||||
TLVSelectItemEvent = procedure(Sender: TObject; Item: TListItem; Selected: Boolean) of object;
|
||||
|
||||
TCustomListView = class(TWinControl)
|
||||
private
|
||||
//FReadOnly : Boolean;
|
||||
@ -510,8 +263,12 @@ type
|
||||
FScrollBars: TScrollStyle;
|
||||
FScrolledLeft: integer; // horizontal scrolled pixels (hidden pixels at top)
|
||||
FScrolledTop: integer; // vertical scrolled pixels (hidden pixels at top)
|
||||
FSelected: TListItem; // temp copy of the selected item
|
||||
FLastHorzScrollInfo: TScrollInfo;
|
||||
FLastVertScrollInfo: TScrollInfo;
|
||||
FOnChange: TLVChangeEvent;
|
||||
FOnColumnClick: TLVColumnClickEvent;
|
||||
FOnSelectItem: TLVSelectItemEvent;
|
||||
function GetSelection: TListItem;
|
||||
procedure SetColumns(const AValue: TListColumns);
|
||||
procedure SetDefaultItemHeight(AValue: integer);
|
||||
@ -526,9 +283,13 @@ type
|
||||
procedure SetSortType(const AValue: TSortType);
|
||||
procedure SetViewStyle (const Avalue: TViewStyle);
|
||||
procedure UpdateScrollbars;
|
||||
procedure CNNotify(var AMessage: TLMNotify); message CN_NOTIFY;
|
||||
protected
|
||||
ParentWindow : TScrolledWindow;
|
||||
procedure Change(AItem: TListItem; AChange: Integer); dynamic;
|
||||
procedure ColClick(AColumn: TListColumn); dynamic;
|
||||
procedure Delete(Item : TListItem);
|
||||
procedure DoSelectItem(AItem: TListItem; ASelected: Boolean); dynamic;
|
||||
procedure InsertItem(Item : TListItem);
|
||||
function GetMaxScrolledLeft : Integer;
|
||||
function GetMaxScrolledTop : Integer;
|
||||
@ -555,6 +316,9 @@ type
|
||||
property SortType: TSortType read FSortType write SetSortType;
|
||||
property SortColumn: Integer read FSortColumn write SetSortColumn;
|
||||
property ViewStyle: TViewStyle read FViewStyle write SetViewStyle;
|
||||
property OnChange: TLVChangeEvent read FOnChange write FOnChange;
|
||||
property OnColumnClick: TLVColumnClickEvent read FOnColumnClick write FOnColumnClick;
|
||||
property OnSelectItem: TLVSelectItemEvent read FOnSelectItem write FOnSelectItem;
|
||||
public
|
||||
constructor Create(Aowner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -585,13 +349,16 @@ type
|
||||
property Visible;
|
||||
property ViewStyle;
|
||||
property OnMOuseMOve;
|
||||
property OnChange;
|
||||
property OnClick;
|
||||
property OnColumnClick;
|
||||
property OnDblClick;
|
||||
property OnMouseDown;
|
||||
property OnMOuseUp;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
property OnKeyDown;
|
||||
property OnSelectItem;
|
||||
end;
|
||||
|
||||
TProgressBarOrientation = (pbHorizontal, pbVertical, pbRightToLeft, pbTopDown);
|
||||
@ -1781,6 +1548,12 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.31 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.30 2002/03/25 17:59:19 lazarus
|
||||
GTK Cleanup
|
||||
Shane
|
||||
|
||||
@ -17,6 +17,7 @@ begin
|
||||
FSortColumn := 0;
|
||||
FImageChangeLink := TChangeLink.Create;
|
||||
FImageChangeLink.OnChange := @ImageChanged;
|
||||
FSelected := nil;
|
||||
Setbounds(2,2,300,300);
|
||||
end;
|
||||
|
||||
@ -32,10 +33,106 @@ Begin
|
||||
//notify the interface....
|
||||
RecreateWnd;
|
||||
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||
End;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView Change }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.Change(AItem: TListItem; AChange: Integer);
|
||||
var
|
||||
ItemChange: TItemChange;
|
||||
begin
|
||||
case AChange of
|
||||
LVIF_TEXT: ItemChange := ctText;
|
||||
LVIF_IMAGE: ItemChange := ctImage;
|
||||
LVIF_STATE: ItemChange := ctState;
|
||||
else
|
||||
Exit;
|
||||
end;
|
||||
if Assigned(FOnChange)
|
||||
then FOnChange(Self, AItem, ItemChange);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ColClick }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.ColClick(AColumn: TListColumn);
|
||||
begin
|
||||
if Assigned(FOnColumnClick) then FOnColumnClick(Self, AColumn)
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ItemChanged }
|
||||
{ TCustomListView CNNotify }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.CNNotify(var AMessage: TLMNotify);
|
||||
var
|
||||
n: Integer;
|
||||
nm: PNMListView;
|
||||
Item: TListItem;
|
||||
begin
|
||||
nm := PNMListView(AMessage.NMHdr);
|
||||
|
||||
case AMessage.NMHdr^.code of
|
||||
// HDN_TRACK:
|
||||
// NM_CUSTOMDRAW:
|
||||
// LVN_BEGINDRAG:
|
||||
LVN_DELETEITEM: begin
|
||||
//don'tcall delete yet, there is no sulution available when we have deleted the item first
|
||||
end;
|
||||
LVN_DELETEALLITEMS: begin
|
||||
end;
|
||||
// LVN_GETDISPINFO:
|
||||
// LVN_ODCACHEHINT:
|
||||
// LVN_ODFINDITEM:
|
||||
// LVN_ODSTATECHANGED:
|
||||
// LVN_BEGINLABELEDIT:
|
||||
// LVN_ENDLABELEDIT:
|
||||
LVN_COLUMNCLICK: begin
|
||||
ColClick(Columns[nm^.iSubItem]);
|
||||
end;
|
||||
LVN_INSERTITEM: begin
|
||||
// see delete comment
|
||||
end;
|
||||
LVN_ITEMCHANGING: begin
|
||||
//Check
|
||||
end;
|
||||
LVN_ITEMCHANGED: begin
|
||||
Item := Items[nm^.iItem];
|
||||
Change(Item, nm^.uChanged);
|
||||
if (nm^.uChanged = LVIF_STATE)
|
||||
then begin
|
||||
if (nm^.uOldState and LVIS_SELECTED) <> (nm^.uNewState and LVIS_SELECTED)
|
||||
then begin
|
||||
// select state changed
|
||||
if (nm^.uNewState and LVIS_SELECTED) = 0
|
||||
then begin
|
||||
if FSelected = Item
|
||||
then FSelected := nil;
|
||||
DoSelectItem(Item, False);
|
||||
end
|
||||
else begin
|
||||
FSelected := Item;
|
||||
DoSelectItem(Item, True);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
// LVN_GETINFOTIP:
|
||||
// NM_CLICK:
|
||||
// NM_RCLICK:
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView DoSelectItem }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCustomListView.DoSelectItem(AItem: TListItem; ASelected: Boolean);
|
||||
begin
|
||||
if Assigned(FOnSelectItem) then FOnSelectItem(Self, AItem, ASelected);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ItemChanged }
|
||||
{------------------------------------------------------------------------------}
|
||||
Procedure TCustomListView.ItemChanged(Index : Integer); //called by TListItems
|
||||
Begin
|
||||
@ -45,7 +142,7 @@ Begin
|
||||
End;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ItemChanged }
|
||||
{ TCustomListView ItemChanged }
|
||||
{------------------------------------------------------------------------------}
|
||||
Procedure TCustomListView.ItemDeleted(Index : Integer); //called by TListItems
|
||||
Begin
|
||||
@ -53,8 +150,6 @@ Begin
|
||||
CNSendMessage(LM_LV_DELETEITEM,self,@Index);
|
||||
End;
|
||||
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCustomListView ItemAdded }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -140,7 +235,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
function TCustomListView.GetSelection: TListItem;
|
||||
begin
|
||||
Result := nil;
|
||||
Result := FSelected;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -333,6 +428,12 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.16 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.15 2002/03/23 15:49:22 lazarus
|
||||
MWE: Fixed more compatebility issues (Sort, SelectedItem)
|
||||
|
||||
|
||||
@ -87,9 +87,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem GetState }
|
||||
{------------------------------------------------------------------------------}
|
||||
function TListItem.GetState(const AIndex: Integer): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem SetState }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TListItem.SetState(const AIndex: Integer; const AState: Boolean);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.9 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.8 2002/03/24 16:38:01 lazarus
|
||||
MWE:
|
||||
* Fixed bug on ListItems.Delete
|
||||
|
||||
@ -249,6 +249,12 @@ function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.22 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.21 2002/03/08 16:16:55 lazarus
|
||||
MG: fixed parser of end blocks in initialization section added label sections
|
||||
|
||||
|
||||
@ -176,44 +176,6 @@ begin
|
||||
msg.Unused := 0;
|
||||
|
||||
Result := DeliverPostMessage(Data, MSG);
|
||||
|
||||
// Result := DeliverMessage(Data, msg) = 0;
|
||||
|
||||
(*
|
||||
|
||||
//----------------- Is this still used ??? ---------------
|
||||
Mess.msg := LM_EXPOSEEVENT;
|
||||
// Mess.msg := LM_PAINT;
|
||||
Widget2 := gtk_Object_get_data(pgtkObject(widget),'Owner');
|
||||
If Widget2 = nil then
|
||||
PixMap := gtk_object_get_data(PgtkObject(widget),'Pixmap')
|
||||
else
|
||||
PixMap := gtk_object_get_data(PgtkObject(widget2),'Pixmap');
|
||||
|
||||
If PixMap = nil then begin
|
||||
Assert(False, 'Trace:Could not find PixMap!!!!!!!!!!!!');
|
||||
Exit;
|
||||
end;
|
||||
|
||||
fWindow := pGtkWidget(widget)^.window;
|
||||
|
||||
|
||||
gdk_draw_pixmap(fwindow,GetPen(pixmap,TColortoTgdkColor(clGray)),
|
||||
pixmap,
|
||||
Event^.Area.x,Event^.Area.y,
|
||||
Event^.Area.x,Event^.Area.y,
|
||||
Event^.Area.Width, Event^.Area.Height);
|
||||
|
||||
{Assert(False, 'Trace:X,Y,Width,Height = '+Inttostr(Event^.Area.x)+','+
|
||||
Inttostr(Event^.Area.y)+','+
|
||||
Inttostr(Event^.Area.Width)+','+
|
||||
Inttostr(Event^.Area.Height));
|
||||
}
|
||||
|
||||
Result := DeliverMessage(Data, Mess);
|
||||
//-----------------------------------------
|
||||
|
||||
*)
|
||||
end;
|
||||
|
||||
function GTKKeyUpDown(Widget: PGtkWidget; Event : pgdkeventkey;
|
||||
@ -1578,6 +1540,8 @@ writeln('[ClipboardSelectionLostOwnershipHandler] ',ClipboardTypeName[ClipboardT
|
||||
end;
|
||||
|
||||
|
||||
{$I gtkDragCallback.inc}
|
||||
{$I gtkListViewCallback.inc}
|
||||
|
||||
|
||||
{$IFDEF ASSERT_IS_ON}
|
||||
@ -1585,13 +1549,16 @@ end;
|
||||
{$C-}
|
||||
{$ENDIF}
|
||||
|
||||
{$I gtkDragCallback.inc}
|
||||
|
||||
|
||||
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.65 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.64 2002/03/25 17:59:20 lazarus
|
||||
GTK Cleanup
|
||||
Shane
|
||||
|
||||
@ -29,8 +29,12 @@ uses Classes, vclGlobals, LCLType;
|
||||
|
||||
const
|
||||
|
||||
// Commands sent to the interface units
|
||||
//-------------
|
||||
// Commands SENT TO the interface units
|
||||
// add also a description to a message at the end of this unit
|
||||
// here are no defines of messages send to the interface
|
||||
// These are declared in a later section
|
||||
//-------------
|
||||
LM_ComUser = $1000;
|
||||
LM_Create = LM_ComUser+1;
|
||||
LM_SetLabel = LM_ComUser+2;
|
||||
@ -95,10 +99,46 @@ LM_SETSHORTCUT = LM_COMUSER+61;
|
||||
|
||||
LM_SETGEOMETRY = LM_COMUSER+62;
|
||||
|
||||
LM_GETITEMS = LM_COMUSER+63;
|
||||
LM_GETITEMINDEX = LM_COMUSER+64;
|
||||
LM_SETITEMINDEX = LM_COMUSER+65;
|
||||
LM_GETSELTEXT = LM_COMUSER+66;
|
||||
LM_SETSELTEXT = LM_COMUSER+67;
|
||||
LM_GETSELSTART = LM_COMUSER+68;
|
||||
LM_SETSELSTART = LM_COMUSER+69;
|
||||
LM_GETSELLEN = LM_COMUSER+70;
|
||||
LM_SETSELLEN = LM_COMUSER+71;
|
||||
LM_GETLIMITTEXT = LM_COMUSER+72;
|
||||
LM_SETLIMITTEXT = LM_COMUSER+73;
|
||||
LM_SORT = LM_COMUSER+74;
|
||||
LM_GETSELCOUNT = LM_COMUSER+75;
|
||||
LM_GETSEL = LM_COMUSER+76;
|
||||
LM_SETSEL = LM_COMUSER+77;
|
||||
LM_SETSELMODE = LM_COMUSER+78;
|
||||
LM_SETBORDER = LM_COMUSER+79;
|
||||
|
||||
// TListView
|
||||
LM_LV_FIRST = LM_COMUSER+80;
|
||||
LM_LV_ADDITEM = LM_LV_FIRST+1;
|
||||
LM_LV_CHANGEITEM = LM_LV_FIRST+2;
|
||||
LM_LV_DELETEITEM = LM_LV_FIRST+3;
|
||||
LM_LV_LAST = LM_LV_FIRST+9; // LM_COMUSER+89
|
||||
|
||||
// TComboBox
|
||||
LM_CB_FIRST = LM_LV_LAST+1; // LM_COMUSER+90
|
||||
LM_CB_GETCOUNT = LM_CB_FIRST+1;
|
||||
LM_CB_GETTEXT = LM_CB_FIRST+2;
|
||||
LM_CB_ADDTEXT = LM_CB_FIRST+3;
|
||||
LM_CB_LAST = LM_CB_FIRST+9; // LM_COMUSER+99
|
||||
|
||||
//-------------
|
||||
//end of messages that are sent to the interface
|
||||
//-------------
|
||||
|
||||
|
||||
{Windows Compatability}
|
||||
//-------------
|
||||
// Windows Compatability}
|
||||
//-------------
|
||||
{ System Menu Commands }
|
||||
SC_SIZE = 61440;
|
||||
SC_MOVE = 61456;
|
||||
@ -120,6 +160,7 @@ LM_SETGEOMETRY = LM_COMUSER+62;
|
||||
SC_MONITORPOWER = 61808;
|
||||
SC_CONTEXTHELP = 61824;
|
||||
SC_SEPARATOR = 61455;
|
||||
|
||||
|
||||
//-------------
|
||||
// Messages
|
||||
@ -178,6 +219,7 @@ LM_SYSCHAR = $0106;
|
||||
LM_KEYLAST = $0108;
|
||||
|
||||
LM_COMMAND = $0111;
|
||||
LM_SYSCOMMAND = $0112;
|
||||
|
||||
LM_HSCROLL = $0114;
|
||||
LM_VSCROLL = $0115;
|
||||
@ -208,12 +250,18 @@ LM_DROPFILES = $0233;
|
||||
|
||||
LM_PARENTNOTIFY = $0210;
|
||||
|
||||
//Calendar
|
||||
|
||||
//-------------
|
||||
// End of Windows Compatability and messages
|
||||
//-------------
|
||||
|
||||
|
||||
//-------------
|
||||
// lcl messages
|
||||
|
||||
//
|
||||
// This should be a list of LCL specific messages
|
||||
// RECEIVED from the interface, here are no defines
|
||||
// of messages send to the interface
|
||||
//-------------
|
||||
LM_USER = $400; // MWE: changed from $100 to $400 since they were in the windows range
|
||||
WM_USER = LM_USER;
|
||||
LM_DESTROY = LM_User+2;
|
||||
@ -257,23 +305,6 @@ LM_CANCEL_CLICKED = LM_USER+37;
|
||||
LM_TIMER = LM_USER+40;
|
||||
//LM_MOUSEBTNPRESS = LM_USER+41;
|
||||
//LM_MOUSEBTNRELEASE = LM_USER+42;
|
||||
LM_GETITEMS = LM_USER+43;
|
||||
LM_GETITEMINDEX = LM_USER+44;
|
||||
LM_SETITEMINDEX = LM_USER+45;
|
||||
LM_GETSELTEXT = LM_USER+46;
|
||||
LM_SETSELTEXT = LM_USER+47;
|
||||
LM_GETSELSTART = LM_USER+48;
|
||||
LM_SETSELSTART = LM_USER+49;
|
||||
LM_GETSELLEN = LM_USER+50;
|
||||
LM_SETSELLEN = LM_USER+51;
|
||||
LM_GETLIMITTEXT = LM_USER+52;
|
||||
LM_SETLIMITTEXT = LM_USER+53;
|
||||
LM_SORT = LM_USER+54;
|
||||
LM_GETSELCOUNT = LM_USER+55;
|
||||
LM_GETSEL = LM_USER+56;
|
||||
LM_SETSEL = LM_USER+57;
|
||||
LM_SETSELMODE = LM_USER+58;
|
||||
LM_SETBORDER = LM_USER+59;
|
||||
LM_EXIT = LM_USER+60;
|
||||
LM_SCREENINIT = LM_USER+61;
|
||||
LM_CLOSEQUERY = LM_USER+62;
|
||||
@ -284,23 +315,9 @@ LM_MONTHCHANGED = LM_USER+65;
|
||||
LM_YEARCHANGED = LM_USER+66;
|
||||
LM_DAYCHANGED = LM_USER+67;
|
||||
|
||||
//TListView
|
||||
LM_LV_ADDITEM = LM_USER+68;
|
||||
LM_LV_CHANGEITEM = LM_USER + 69;
|
||||
LM_LV_DELETEITEM = LM_USER + 70;
|
||||
|
||||
LM_CB_FIRST = LM_USER+100;
|
||||
LM_CB_GETCOUNT = LM_CB_FIRST+1;
|
||||
LM_CB_GETTEXT = LM_CB_FIRST+2;
|
||||
LM_CB_ADDTEXT = LM_CB_FIRST+3;
|
||||
|
||||
LM_CB_LAST = LM_CB_FIRST+10; //LM_USER+110
|
||||
|
||||
|
||||
|
||||
LM_UNKNOWN = LM_User+99;
|
||||
|
||||
LM_SYSCOMMAND = $0112;
|
||||
|
||||
type
|
||||
|
||||
@ -731,7 +748,8 @@ TLMShortCut = packed record
|
||||
NewModifier : TShiftState;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
function GetMessageName(const AMessage: Integer): String;
|
||||
|
||||
|
||||
@ -800,6 +818,12 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 2002/03/27 00:33:54 lazarus
|
||||
MWE:
|
||||
* Cleanup in lmessages
|
||||
* Added Listview selection and notification events
|
||||
+ introduced commctrl
|
||||
|
||||
Revision 1.22 2002/03/16 21:40:54 lazarus
|
||||
MG: reduced size+move messages between lcl and interface
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user