mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 05:39:14 +02:00
Added TImage class
Shane git-svn-id: trunk@554 -
This commit is contained in:
parent
b036c95a80
commit
ea61035ca8
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -209,6 +209,7 @@ images/components/tibdatabase.ico -text svneol=native#image/x-icon
|
|||||||
images/components/tibdatabase.xpm -text svneol=native#image/x-xpixmap
|
images/components/tibdatabase.xpm -text svneol=native#image/x-xpixmap
|
||||||
images/components/tibquery.ico -text svneol=native#image/x-icon
|
images/components/tibquery.ico -text svneol=native#image/x-icon
|
||||||
images/components/tibquery.xpm -text svneol=native#image/x-xpixmap
|
images/components/tibquery.xpm -text svneol=native#image/x-xpixmap
|
||||||
|
images/components/timage.xpm -text svneol=native#image/x-xpixmap
|
||||||
images/components/tlabel.ico -text svneol=unset#image/x-icon
|
images/components/tlabel.ico -text svneol=unset#image/x-icon
|
||||||
images/components/tlabel.xpm -text svneol=native#image/x-xpixmap
|
images/components/tlabel.xpm -text svneol=native#image/x-xpixmap
|
||||||
images/components/tlistbox.ico -text svneol=unset#image/x-icon
|
images/components/tlistbox.ico -text svneol=unset#image/x-icon
|
||||||
@ -372,6 +373,7 @@ lcl/include/graphiccontrol.inc svneol=native#text/pascal
|
|||||||
lcl/include/graphicsobject.inc svneol=native#text/pascal
|
lcl/include/graphicsobject.inc svneol=native#text/pascal
|
||||||
lcl/include/hintwindow.inc svneol=native#text/pascal
|
lcl/include/hintwindow.inc svneol=native#text/pascal
|
||||||
lcl/include/hkeys.inc svneol=native#text/pascal
|
lcl/include/hkeys.inc svneol=native#text/pascal
|
||||||
|
lcl/include/image.inc svneol=native#text/pascal
|
||||||
lcl/include/imglist.inc svneol=native#text/pascal
|
lcl/include/imglist.inc svneol=native#text/pascal
|
||||||
lcl/include/interfacebase.inc svneol=native#text/pascal
|
lcl/include/interfacebase.inc svneol=native#text/pascal
|
||||||
lcl/include/listitem.inc svneol=native#text/pascal
|
lcl/include/listitem.inc svneol=native#text/pascal
|
||||||
|
@ -303,7 +303,7 @@ begin
|
|||||||
,TListBox,TRadioButton,TComboBox,TScrollBar,TGroupBox,TToggleBox]);
|
,TListBox,TRadioButton,TComboBox,TScrollBar,TGroupBox,TToggleBox]);
|
||||||
RegisterComponents('Additional','Buttons',[TBitBtn,TSpeedButton]);
|
RegisterComponents('Additional','Buttons',[TBitBtn,TSpeedButton]);
|
||||||
RegisterComponents('Additional','ExtCtrls',[TNoteBook,TPaintBox
|
RegisterComponents('Additional','ExtCtrls',[TNoteBook,TPaintBox
|
||||||
,TBevel,TRadioGroup]);
|
,TBevel,TRadioGroup,TImage]);
|
||||||
RegisterComponents('Additional','ComCtrls',[TStatusBar,TListView
|
RegisterComponents('Additional','ComCtrls',[TStatusBar,TListView
|
||||||
,TProgressBar,TToolBar,TTrackbar]);
|
,TProgressBar,TToolBar,TTrackbar]);
|
||||||
|
|
||||||
|
28
images/components/timage.xpm
Normal file
28
images/components/timage.xpm
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *timage[]={
|
||||||
|
"20 20 5 1",
|
||||||
|
"c c #0058c0",
|
||||||
|
"b c #008000",
|
||||||
|
". c #a8dcff",
|
||||||
|
"# c #ffff00",
|
||||||
|
"a c #ffffff",
|
||||||
|
"....................",
|
||||||
|
"....................",
|
||||||
|
".#....#.............",
|
||||||
|
"..#..#......a.a.aa..",
|
||||||
|
"...##.......a..a..a.",
|
||||||
|
"...##........a.aa...",
|
||||||
|
"..#..#............a.",
|
||||||
|
".#....#.............",
|
||||||
|
"....................",
|
||||||
|
"....................",
|
||||||
|
"....................",
|
||||||
|
"...................b",
|
||||||
|
"..................bb",
|
||||||
|
"cccccccccccccccccbbb",
|
||||||
|
"ccccccccccccccccbbbb",
|
||||||
|
"cccccccccccccccbbbbb",
|
||||||
|
"ccccccccccccccbbbbbb",
|
||||||
|
"cccccccccccccbbbbbbb",
|
||||||
|
"ccccccccccccbbbbbbbb",
|
||||||
|
"cccccccccccbbbbbbbbb"};
|
@ -571,6 +571,18 @@
|
|||||||
+' N ",'#10'"N N N N N N N N N N N N N ",'#10'" '
|
+' N ",'#10'"N N N N N N N N N N N N N ",'#10'" '
|
||||||
+' N "};'#10
|
+' N "};'#10
|
||||||
);
|
);
|
||||||
|
LazarusResources.Add('timage','XPM',
|
||||||
|
'/* XPM */'#10'static char *timage[]={'#10'"20 20 5 1",'#10'"c c #0058c0",'
|
||||||
|
+#10'"b c #008000",'#10'". c #a8dcff",'#10'"# c #ffff00",'#10'"a c #ffffff'
|
||||||
|
+'",'#10'"....................",'#10'"....................",'#10'".#....#.'
|
||||||
|
+'............",'#10'"..#..#......a.a.aa..",'#10'"...##.......a..a..a.",'
|
||||||
|
+#10'"...##........a.aa...",'#10'"..#..#............a.",'#10'".#....#.....'
|
||||||
|
+'........",'#10'"....................",'#10'"....................",'#10'"'
|
||||||
|
+'....................",'#10'"...................b",'#10'"................'
|
||||||
|
+'..bb",'#10'"cccccccccccccccccbbb",'#10'"ccccccccccccccccbbbb",'#10'"cccc'
|
||||||
|
+'cccccccccccbbbbb",'#10'"ccccccccccccccbbbbbb",'#10'"cccccccccccccbbbbbbb'
|
||||||
|
+'",'#10'"ccccccccccccbbbbbbbb",'#10'"cccccccccccbbbbbbbbb"};'#10
|
||||||
|
);
|
||||||
LazarusResources.Add('tlabel','XPM',
|
LazarusResources.Add('tlabel','XPM',
|
||||||
'/* XPM */'#10'static char * tlabel_xpm[] = {'#10'"17 12 35 1",'#10'" '#9
|
'/* XPM */'#10'static char * tlabel_xpm[] = {'#10'"17 12 35 1",'#10'" '#9
|
||||||
+'c None",'#10'".'#9'c #000000",'#10'"+'#9'c #030303",'#10'"@'#9'c #060606'
|
+'c None",'#10'".'#9'c #000000",'#10'"+'#9'c #030303",'#10'"@'#9'c #060606'
|
||||||
|
@ -382,6 +382,8 @@ type
|
|||||||
FSubItems: TStrings;
|
FSubItems: TStrings;
|
||||||
//FIndex : Integer;
|
//FIndex : Integer;
|
||||||
FCaption : String;
|
FCaption : String;
|
||||||
|
FImageIndex: Integer;
|
||||||
|
procedure SetImageIndex(const AValue: Integer);
|
||||||
Procedure SetCaption(const Value : String);
|
Procedure SetCaption(const Value : String);
|
||||||
// Procedure SetSubItems(Value : TStrings);
|
// Procedure SetSubItems(Value : TStrings);
|
||||||
Function GetIndex : Integer;
|
Function GetIndex : Integer;
|
||||||
@ -396,6 +398,7 @@ type
|
|||||||
property Index : Integer read GetIndex;
|
property Index : Integer read GetIndex;
|
||||||
property Owner : TListItems read FOwner;
|
property Owner : TListItems read FOwner;
|
||||||
property SubItems : TStrings read FSubItems write FSubItems;//SetSubItems;
|
property SubItems : TStrings read FSubItems write FSubItems;//SetSubItems;
|
||||||
|
property ImageIndex : Integer read FImageIndex write SetImageIndex default -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TListItems = class(TPersistent)
|
TListItems = class(TPersistent)
|
||||||
@ -470,6 +473,8 @@ type
|
|||||||
FSorted : Boolean;
|
FSorted : Boolean;
|
||||||
FSortColumn : Integer;
|
FSortColumn : Integer;
|
||||||
FMultiSelect: Boolean;
|
FMultiSelect: Boolean;
|
||||||
|
FImageList: TImageList;
|
||||||
|
procedure SetImageList(const AValue: TImageList);
|
||||||
procedure SetMultiSElect(const AValue: Boolean);
|
procedure SetMultiSElect(const AValue: Boolean);
|
||||||
procedure SetItems(Value : TListItems);
|
procedure SetItems(Value : TListItems);
|
||||||
protected
|
protected
|
||||||
@ -492,6 +497,7 @@ type
|
|||||||
property Sorted : Boolean read FSorted write SetSorted;
|
property Sorted : Boolean read FSorted write SetSorted;
|
||||||
property SortColumn : Integer read FSortColumn write SetSortColumn;
|
property SortColumn : Integer read FSortColumn write SetSortColumn;
|
||||||
property MultiSelect : Boolean read FMultiSelect write SetMultiSelect default False;
|
property MultiSelect : Boolean read FMultiSelect write SetMultiSelect default False;
|
||||||
|
property ImageList : TImageList read FImageList write SetImageList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TListView = class(TCustomListView)
|
TListView = class(TCustomListView)
|
||||||
@ -1013,6 +1019,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.11 2001/12/21 18:16:59 lazarus
|
||||||
|
Added TImage class
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.10 2001/12/19 21:36:05 lazarus
|
Revision 1.10 2001/12/19 21:36:05 lazarus
|
||||||
Added MultiSelect to TListView
|
Added MultiSelect to TListView
|
||||||
Shane
|
Shane
|
||||||
|
@ -41,7 +41,7 @@ interface
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, Controls, stdCtrls, vclGlobals, lMessages;
|
SysUtils, Classes, Controls, stdCtrls, vclGlobals, lMessages,Graphics;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ workaround problem with fcl }
|
{ workaround problem with fcl }
|
||||||
@ -237,6 +237,23 @@ type
|
|||||||
// property OnStartDrag;
|
// property OnStartDrag;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TImage = class(TGraphicControl)
|
||||||
|
private
|
||||||
|
FPicture: TPicture;
|
||||||
|
procedure SetPicture(const AValue: TPicture);
|
||||||
|
Procedure PictureChanged(SEnder : TObject);
|
||||||
|
protected
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
Property Align;
|
||||||
|
property Picture : TPicture read FPicture write SetPicture;
|
||||||
|
property Visible;
|
||||||
|
property OnCLick;
|
||||||
|
property OnMouseDown;
|
||||||
|
property OnMouseMove;
|
||||||
|
property OnMouseUp;
|
||||||
|
end;
|
||||||
TBevelStyle=(bsLowered, bsRaised);
|
TBevelStyle=(bsLowered, bsRaised);
|
||||||
TBevelShape=(bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine, bsRightLine);
|
TBevelShape=(bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine, bsRightLine);
|
||||||
TBevel=Class(TGraphicControl)
|
TBevel=Class(TGraphicControl)
|
||||||
@ -320,7 +337,7 @@ TCN_SELCHANGE = TCN_FIRST - 1;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses Graphics, interfaces;
|
uses interfaces;
|
||||||
|
|
||||||
{$I page.inc}
|
{$I page.inc}
|
||||||
{$I customnotebook.inc}
|
{$I customnotebook.inc}
|
||||||
@ -330,11 +347,17 @@ implementation
|
|||||||
{$I customradiogroup.inc}
|
{$I customradiogroup.inc}
|
||||||
{$I radiogroup.inc}
|
{$I radiogroup.inc}
|
||||||
{$I bevel.inc}
|
{$I bevel.inc}
|
||||||
|
{$I image.inc}
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.15 2001/12/21 18:16:59 lazarus
|
||||||
|
Added TImage class
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.14 2001/11/05 18:18:19 lazarus
|
Revision 1.14 2001/11/05 18:18:19 lazarus
|
||||||
added popupmenu+arrows to notebooks, added target filename
|
added popupmenu+arrows to notebooks, added target filename
|
||||||
|
|
||||||
|
@ -732,6 +732,10 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.18 2001/12/21 18:16:59 lazarus
|
||||||
|
Added TImage class
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.17 2001/11/12 22:12:57 lazarus
|
Revision 1.17 2001/11/12 22:12:57 lazarus
|
||||||
MG: fixed parser: multiple brackets, nil, string[]
|
MG: fixed parser: multiple brackets, nil, string[]
|
||||||
|
|
||||||
|
@ -345,6 +345,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.12 2001/12/21 18:16:59 lazarus
|
||||||
|
Added TImage class
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.11 2001/10/10 17:55:04 lazarus
|
Revision 1.11 2001/10/10 17:55:04 lazarus
|
||||||
MG: fixed caret lost, gtk cleanup, bracket lvls, bookmark saving
|
MG: fixed caret lost, gtk cleanup, bracket lvls, bookmark saving
|
||||||
|
|
||||||
|
@ -133,3 +133,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomListView.SetImageList(const AValue: TImageList);
|
||||||
|
begin
|
||||||
|
if AValue <> FImageList then
|
||||||
|
Begin
|
||||||
|
FImageList := AValue;
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
21
lcl/include/image.inc
Normal file
21
lcl/include/image.inc
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{ TImage }
|
||||||
|
|
||||||
|
constructor TImage.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fCompStyle := csImage;
|
||||||
|
FPicture := TPicture.Create;
|
||||||
|
FPicture.OnChange := @PictureChanged;
|
||||||
|
Setbounds(0,0,100,100);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TImage.SetPicture(const AValue: TPicture);
|
||||||
|
begin
|
||||||
|
FPicture.Assign(AValue); //the onchange of the picture gets called and notifies that something changed.
|
||||||
|
end;
|
||||||
|
|
||||||
|
Procedure TImage.PictureChanged(Sender : TObject);
|
||||||
|
begin
|
||||||
|
CNSendMessage(LM_SETPROPERTIES,self,nil);
|
||||||
|
end;
|
||||||
|
|
@ -63,4 +63,13 @@ begin
|
|||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TListItem.SetImageIndex(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if AValue <> FImageIndex then
|
||||||
|
Begin
|
||||||
|
FImageIndex := AValue;
|
||||||
|
ItemChanged(self);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@ constructor TPaintBox.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
ControlStyle := ControlStyle + [csReplicatable];
|
ControlStyle := ControlStyle + [csReplicatable];
|
||||||
Width := 105;
|
setbounds(0,0,105,105);
|
||||||
Height := 105;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPaintBox.Paint;
|
procedure TPaintBox.Paint;
|
||||||
|
@ -2277,6 +2277,9 @@ PGtkCList(PGtkFileSelection(P)^.file_list),GTK_SELECTION_MULTIPLE);
|
|||||||
gtk_widget_show(p);
|
gtk_widget_show(p);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
csImage : Begin
|
||||||
|
p := gtk_image_new(nil,nil);
|
||||||
|
end;
|
||||||
csLabel :
|
csLabel :
|
||||||
begin
|
begin
|
||||||
P := gtk_label_new(StrTemp);
|
P := gtk_label_new(StrTemp);
|
||||||
@ -3006,6 +3009,7 @@ var
|
|||||||
ColName : String;
|
ColName : String;
|
||||||
pColName : PChar;
|
pColName : PChar;
|
||||||
pRowText : PChar;
|
pRowText : PChar;
|
||||||
|
Image : PgdkImage;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result := 0; // default if nobody sets it
|
result := 0; // default if nobody sets it
|
||||||
@ -3172,7 +3176,16 @@ begin
|
|||||||
|
|
||||||
gtk_clist_thaw(PgtkCList(Handle));
|
gtk_clist_thaw(PgtkCList(Handle));
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
csImage: Begin
|
||||||
|
//Image changed.
|
||||||
|
Widget := PgtkWidget(PdeviceContext(TBitmap(sender).handle));
|
||||||
|
Image := gdk_image_get(pgtkWidget(widget)^.window,0,0,widget^.allocation.width,widget^.allocation.height);
|
||||||
|
if Handle = nil then
|
||||||
|
TWinControl(sender).Handle := THandle(gtk_image_new(Image,nil))
|
||||||
|
else
|
||||||
|
gtk_image_set(PgtkImage(handle),Image,nil);
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
Assert (true, Format ('WARNING:[TgtkObject.SetProperties] failed for %s', [Sender.ClassName]));
|
Assert (true, Format ('WARNING:[TgtkObject.SetProperties] failed for %s', [Sender.ClassName]));
|
||||||
end;
|
end;
|
||||||
@ -3627,6 +3640,10 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.95 2001/12/21 18:17:00 lazarus
|
||||||
|
Added TImage class
|
||||||
|
Shane
|
||||||
|
|
||||||
Revision 1.94 2001/12/20 19:11:23 lazarus
|
Revision 1.94 2001/12/20 19:11:23 lazarus
|
||||||
Changed the delay for the hints from 100 miliseconds to 500. I'm hoping this reduces the crashing for some people until I determine the problem.
|
Changed the delay for the hints from 100 miliseconds to 500. I'm hoping this reduces the crashing for some people until I determine the problem.
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user