TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap

git-svn-id: trunk@5181 -
This commit is contained in:
mattias 2004-02-08 11:31:32 +00:00
parent b18c387c58
commit c111d6709d
10 changed files with 107 additions and 55 deletions

View File

@ -575,19 +575,19 @@ begin
itmFileNewUnit := TMenuItem.Create(Self);
itmFileNewUnit.Name:='itmFileNewUnit';
itmFileNewUnit.Caption := lisMenuNewUnit;
itmFileNewUnit.Bitmap:=LoadPixmap('menu_new');
itmFileNewUnit.Bitmap.LoadFromLazarusResource('menu_new');
mnuFile.Add(itmFileNewUnit);
itmFileNewForm := TMenuItem.Create(Self);
itmFileNewForm.Name:='itmFileNewForm';
itmFileNewForm.Caption := lisMenuNewForm;
itmFileNewForm.Bitmap:=LoadPixmap('menu_new');
itmFileNewForm.Bitmap.LoadFromLazarusResource('menu_new');
mnuFile.Add(itmFileNewForm);
itmFileNewOther := TMenuItem.Create(Self);
itmFileNewOther.Name:='itmFileNewOther';
itmFileNewOther.Caption := lisMenuNewOther;
itmFileNewOther.Bitmap:=LoadPixmap('menu_new');
itmFileNewOther.Bitmap.LoadFromLazarusResource('menu_new');
mnuFile.Add(itmFileNewOther);
mnuFile.Add(CreateMenuSeparator);
@ -595,13 +595,13 @@ begin
itmFileOpen := TMenuItem.Create(Self);
itmFileOpen.Name:='itmFileOpen';
itmFileOpen.Caption := lisMenuOpen;
itmFileOpen.Bitmap:=LoadPixmap('menu_open');
itmFileOpen.Bitmap.LoadFromLazarusResource('menu_open');
mnuFile.Add(itmFileOpen);
itmFileRevert := TMenuItem.Create(Self);
itmFileRevert.Name:='itmFileRevert';
itmFileRevert.Caption := lisMenuRevert;
itmFileRevert.Bitmap:=LoadPixmap('menu_undo');
itmFileRevert.Bitmap.LoadFromLazarusResource('menu_undo');
mnuFile.Add(itmFileRevert);
itmFileRecentOpen := TMenuItem.Create(Self);
@ -612,19 +612,19 @@ begin
itmFileSave := TMenuItem.Create(Self);
itmFileSave.Name:='itmFileSave';
itmFileSave.Caption := lisMenuSave;
itmFileSave.Bitmap:=LoadPixmap('menu_save');
itmFileSave.Bitmap.LoadFromLazarusResource('menu_save');
mnuFile.Add(itmFileSave);
itmFileSaveAs := TMenuItem.Create(Self);
itmFileSaveAs.Name:='itmFileSaveAs';
itmFileSaveAs.Caption := lisMenuSaveAs;
itmFileSaveAs.Bitmap:=LoadPixmap('menu_save');
itmFileSaveAs.Bitmap.LoadFromLazarusResource('menu_save');
mnuFile.Add(itmFileSaveAs);
itmFileSaveAll := TMenuItem.Create(Self);
itmFileSaveAll.Name:='itmFileSaveAll';
itmFileSaveAll.Caption := lisMenuSaveAll;
itmFileSaveAll.Bitmap:=LoadPixmap('menu_save');
itmFileSaveAll.Bitmap.LoadFromLazarusResource('menu_save');
mnuFile.Add(itmFileSaveAll);
itmFileClose := TMenuItem.Create(Self);
@ -659,13 +659,13 @@ begin
itmEditUndo := TMenuItem.Create(Self);
itmEditUndo.Name:='itmEditUndo';
itmEditUndo.Caption := lisMenuUndo;
itmEditUndo.Bitmap:=LoadPixmap('menu_undo');
itmEditUndo.Bitmap.LoadFromLazarusResource('menu_undo');
mnuEdit.Add(itmEditUndo);
itmEditRedo := TMenuItem.Create(Self);
itmEditRedo.Name:='itmEditRedo';
itmEditRedo.Caption := lisMenuRedo;
itmEditRedo.Bitmap:=LoadPixmap('menu_redo');
itmEditRedo.Bitmap.LoadFromLazarusResource('menu_redo');
mnuEdit.Add(itmEditRedo);
mnuEdit.Add(CreateMenuSeparator);
@ -673,19 +673,19 @@ begin
itmEditCut := TMenuItem.Create(Self);
itmEditCut.Name:='itmEditCut';
itmEditCut.Caption := lisMenuCut;
itmEditCut.Bitmap:=LoadPixmap('menu_cut');
itmEditCut.Bitmap.LoadFromLazarusResource('menu_cut');
mnuEdit.Add(itmEditCut);
itmEditCopy := TMenuItem.Create(Self);
itmEditCopy.Name:='itmEditCopy';
itmEditCopy.Caption := lisMenuCopy;
itmEditCopy.Bitmap:=LoadPixmap('menu_copy');
itmEditCopy.Bitmap.LoadFromLazarusResource('menu_copy');
mnuEdit.Add(itmEditCopy);
itmEditPaste := TMenuItem.Create(Self);
itmEditPaste.Name:='itmEditPaste';
itmEditPaste.Caption := lisMenuPaste;
itmEditPaste.Bitmap:=LoadPixmap('menu_paste');
itmEditPaste.Bitmap.LoadFromLazarusResource('menu_paste');
mnuEdit.Add(itmEditPaste);
mnuEdit.Add(CreateMenuSeparator);
@ -693,13 +693,13 @@ begin
itmEditIndentBlock := TMenuItem.Create(Self);
itmEditIndentBlock.Name:='itmEditIndentBlock';
itmEditIndentBlock.Caption := lisMenuIndentSelection;
itmEditIndentBlock.Bitmap:=LoadPixmap('menu_indent');
itmEditIndentBlock.Bitmap.LoadFromLazarusResource('menu_indent');
mnuEdit.Add(itmEditIndentBlock);
itmEditUnindentBlock := TMenuItem.Create(Self);
itmEditUnindentBlock.Name:='itmEditUnindentBlock';
itmEditUnindentBlock.Caption := lisMenuUnindentSelection;
itmEditUnindentBlock.Bitmap:=LoadPixmap('menu_unindent');
itmEditUnindentBlock.Bitmap.LoadFromLazarusResource('menu_unindent');
mnuEdit.Add(itmEditUnindentBlock);
itmEditEncloseBlock := TMenuItem.Create(Self);
@ -1038,19 +1038,19 @@ begin
itmViewDebugWindows := TMenuItem.Create(Self);
itmViewDebugWindows.Name := 'itmViewDebugWindows';
itmViewDebugWindows.Caption := lisMenuDebugWindows;
itmViewDebugWindows.Bitmap:=LoadPixmap('menu_debugger');
itmViewDebugWindows.Bitmap.LoadFromLazarusResource('menu_debugger');
mnuView.Add(itmViewDebugWindows);
itmViewWatches := TMenuItem.Create(Self);
itmViewWatches.Name:='itmViewWatches';
itmViewWatches.Caption := lisMenuViewWatches;
itmViewWatches.Bitmap:=LoadPixmap('menu_watches');
itmViewWatches.Bitmap.LoadFromLazarusResource('menu_watches');
itmViewDebugWindows.Add(itmViewWatches);
itmViewBreakPoints := TMenuItem.Create(Self);
itmViewBreakPoints.Name:='itmViewBreakPoints';
itmViewBreakPoints.Caption := lisMenuViewBreakPoints;
itmViewBreakPoints.Bitmap:=LoadPixmap('menu_breakpoints');
itmViewBreakPoints.Bitmap.LoadFromLazarusResource('menu_breakpoints');
itmViewDebugWindows.Add(itmViewBreakPoints);
itmViewLocals := TMenuItem.Create(Self);
@ -1061,13 +1061,13 @@ begin
itmViewCallStack := TMenuItem.Create(Self);
itmViewCallStack.Name:='itmViewCallStack';
itmViewCallStack.Caption := lisMenuViewCallStack;
itmViewCallStack.Bitmap:=LoadPixmap('menu_callstack');
itmViewCallStack.Bitmap.LoadFromLazarusResource('menu_callstack');
itmViewDebugWindows.Add(itmViewCallStack);
itmViewDebugOutput := TMenuItem.Create(Self);
itmViewDebugOutput.Name:='itmViewDebugOutput';
itmViewDebugOutput.Caption := lisMenuViewDebugOutput;
itmViewDebugOutput.Bitmap:=LoadPixmap('menu_debugoutput');
itmViewDebugOutput.Bitmap.LoadFromLazarusResource('menu_debugoutput');
itmViewDebugWindows.Add(itmViewDebugOutput);
end;
@ -1088,7 +1088,7 @@ begin
itmProjectOpen := TMenuItem.Create(Self);
itmProjectOpen.Name:='itmProjectOpen';
itmProjectOpen.Caption := lisMenuOpenProject;
itmProjectOpen.Bitmap:=LoadPixmap('menu_openproject');
itmProjectOpen.Bitmap.LoadFromLazarusResource('menu_openproject');
mnuProject.Add(itmProjectOpen);
itmProjectRecentOpen := TMenuItem.Create(Self);
@ -1118,7 +1118,7 @@ begin
itmProjectInspector := TMenuItem.Create(Self);
itmProjectInspector.Name:='itmProjectInspector';
itmProjectInspector.Caption := lisMenuProjectInspector;
itmProjectInspector.Bitmap:=LoadPixmap('menu_projectinspector');
itmProjectInspector.Bitmap.LoadFromLazarusResource('menu_projectinspector');
{$IFNDEF DisablePkgs}
mnuProject.Add(itmProjectInspector);
{$ENDIF}
@ -1150,7 +1150,7 @@ begin
itmProjectOptions := TMenuItem.Create(Self);
itmProjectOptions.Name:='itmProjectOptions';
itmProjectOptions.Caption := lisMenuProjectOptions;
itmProjectOptions.Bitmap:=LoadPixmap('menu_projectoptions');
itmProjectOptions.Bitmap.LoadFromLazarusResource('menu_projectoptions');
mnuProject.Add(itmProjectOptions);
end;
@ -1159,13 +1159,13 @@ begin
itmRunMenuBuild := TMenuItem.Create(Self);
itmRunMenuBuild.Name:='itmRunMenuBuild';
itmRunMenuBuild.Caption := lisMenuBuild;
itmRunMenuBuild.Bitmap:=LoadPixmap('menu_build');
itmRunMenuBuild.Bitmap.LoadFromLazarusResource('menu_build');
mnuRun.Add(itmRunMenuBuild);
itmRunMenuBuildAll := TMenuItem.Create(Self);
itmRunMenuBuildAll.Name:='itmRunMenuBuildAll';
itmRunMenuBuildAll.Caption := lisMenuBuildAll;
itmRunMenuBuildAll.Bitmap:=LoadPixmap('menu_buildall');
itmRunMenuBuildAll.Bitmap.LoadFromLazarusResource('menu_buildall');
mnuRun.Add(itmRunMenuBuildAll);
itmRunMenuAbortBuild := TMenuItem.Create(Self);
@ -1183,26 +1183,26 @@ begin
itmRunMenuRun := TMenuItem.Create(Self);
itmRunMenuRun.Name:='itmRunMenuRun';
itmRunMenuRun.Caption := lisMenuProjectRun;
itmRunMenuRun.Bitmap:=LoadPixmap('menu_run');
itmRunMenuRun.Bitmap.LoadFromLazarusResource('menu_run');
mnuRun.Add(itmRunMenuRun);
itmRunMenuPause := TMenuItem.Create(Self);
itmRunMenuPause.Name:='itmRunMenuPause';
itmRunMenuPause.Caption := lisMenuPause;
itmRunMenuPause.Enabled := false;
itmRunMenuPause.Bitmap:=LoadPixmap('menu_pause');
itmRunMenuPause.Bitmap.LoadFromLazarusResource('menu_pause');
mnuRun.Add(itmRunMenuPause);
itmRunMenuStepInto := TMenuItem.Create(Self);
itmRunMenuStepInto.Name:='itmRunMenuStepInto';
itmRunMenuStepInto.Caption := lisMenuStepInto;
itmRunMenuStepInto.Bitmap:=LoadPixmap('menu_stepinto');
itmRunMenuStepInto.Bitmap.LoadFromLazarusResource('menu_stepinto');
mnuRun.Add(itmRunMenuStepInto);
itmRunMenuStepOver := TMenuItem.Create(Self);
itmRunMenuStepOver.Name:='itmRunMenuStepOver';
itmRunMenuStepOver.Caption := lisMenuStepOver;
itmRunMenuStepOver.Bitmap:=LoadPixmap('menu_stepover');
itmRunMenuStepOver.Bitmap.LoadFromLazarusResource('menu_stepover');
mnuRun.Add(itmRunMenuStepOver);
itmRunMenuRunToCursor := TMenuItem.Create(Self);
@ -1250,7 +1250,7 @@ begin
itmPkgOpenPackage := TMenuItem.Create(Self);
itmPkgOpenPackage.Name:='itmPkgOpenPackage';
itmPkgOpenPackage.Caption := lisMenuOpenPackage;
itmPkgOpenPackage.Bitmap:=LoadPixmap('pkg_package');
itmPkgOpenPackage.Bitmap.LoadFromLazarusResource('pkg_package');
{$IFNDEF DisablePkgs}
mnuComponents.Add(itmPkgOpenPackage);
{$ENDIF}
@ -1258,7 +1258,7 @@ begin
itmPkgOpenPackageFile := TMenuItem.Create(Self);
itmPkgOpenPackageFile.Name:='itmPkgOpenPackageFile';
itmPkgOpenPackageFile.Caption := lisMenuOpenPackageFile;
itmPkgOpenPackageFile.Bitmap:=LoadPixmap('pkg_package');
itmPkgOpenPackageFile.Bitmap.LoadFromLazarusResource('pkg_package');
{$IFNDEF DisablePkgs}
mnuComponents.Add(itmPkgOpenPackageFile);
{$ENDIF}
@ -1266,7 +1266,7 @@ begin
itmPkgOpenRecent := TMenuItem.Create(Self);
itmPkgOpenRecent.Name:='itmPkgOpenRecent';
itmPkgOpenRecent.Caption := lisMenuOpenRecentPkg;
itmPkgOpenRecent.Bitmap:=LoadPixmap('pkg_package');
itmPkgOpenRecent.Bitmap.LoadFromLazarusResource('pkg_package');
{$IFNDEF DisablePkgs}
mnuComponents.Add(itmPkgOpenRecent);
{$ENDIF}
@ -1278,7 +1278,7 @@ begin
itmPkgAddCurUnitToPkg := TMenuItem.Create(Self);
itmPkgAddCurUnitToPkg.Name:='itmPkgAddCurUnitToPkg';
itmPkgAddCurUnitToPkg.Caption := lisMenuAddCurUnitToPkg;
itmPkgAddCurUnitToPkg.Bitmap:=LoadPixmap('pkg_addunittopackage');
itmPkgAddCurUnitToPkg.Bitmap.LoadFromLazarusResource('pkg_addunittopackage');
{$IFNDEF DisablePkgs}
mnuComponents.Add(itmPkgAddCurUnitToPkg);
{$ENDIF}
@ -1290,7 +1290,7 @@ begin
itmPkgPkgGraph := TMenuItem.Create(Self);
itmPkgPkgGraph.Name:='itmPkgPkgGraph';
itmPkgPkgGraph.Caption := lisMenuPackageGraph;
itmPkgPkgGraph.Bitmap:=LoadPixmap('pkg_packagegraph');
itmPkgPkgGraph.Bitmap.LoadFromLazarusResource('pkg_packagegraph');
{$IFNDEF DisablePkgs}
mnuComponents.Add(itmPkgPkgGraph);
{$ENDIF}
@ -1361,7 +1361,7 @@ begin
itmToolBuildLazarus := TMenuItem.Create(Self);
itmToolBuildLazarus.Name:='itmToolBuildLazarus';
itmToolBuildLazarus.Caption := lisMenuBuildLazarus;
itmToolBuildLazarus.Bitmap:=LoadPixmap('menu_buildlazarus');
itmToolBuildLazarus.Bitmap.LoadFromLazarusResource('menu_buildlazarus');
mnuTools.Add(itmToolBuildLazarus);
itmToolConfigureBuildLazarus := TMenuItem.Create(Self);
@ -1375,31 +1375,31 @@ begin
itmEnvGeneralOptions := TMenuItem.Create(Self);
itmEnvGeneralOptions.Name:='itmEnvGeneralOptions';
itmEnvGeneralOptions.Caption := lisMenuGeneralOptions;
itmEnvGeneralOptions.Bitmap:=LoadPixmap('menu_environmentoptions');
itmEnvGeneralOptions.Bitmap.LoadFromLazarusResource('menu_environmentoptions');
mnuEnvironment.Add(itmEnvGeneralOptions);
itmEnvEditorOptions := TMenuItem.Create(Self);
itmEnvEditorOptions.Name:='itmEnvEditorOptions';
itmEnvEditorOptions.Caption := lisMenuEditorOptions;
itmEnvEditorOptions.Bitmap:=LoadPixmap('menu_editoroptions');
itmEnvEditorOptions.Bitmap.LoadFromLazarusResource('menu_editoroptions');
mnuEnvironment.Add(itmEnvEditorOptions);
itmEnvDebuggerOptions := TMenuItem.Create(Self);
itmEnvDebuggerOptions.Name:='itmEnvDebuggerOptions';
itmEnvDebuggerOptions.Caption := lisMenDebuggerOptions;
// itmEnvDebuggerOptions.Bitmap:=LoadPixmap('menu_editoroptions');
// itmEnvDebuggerOptions.Bitmap.LoadFromLazarusResource('menu_editoroptions');
mnuEnvironment.Add(itmEnvDebuggerOptions);
itmEnvCodeToolsOptions := TMenuItem.Create(Self);
itmEnvCodeToolsOptions.Name:='itmEnvCodeToolsOptions';
itmEnvCodeToolsOptions.Caption := lisMenuCodeToolsOptions;
itmEnvCodeToolsOptions.Bitmap:=LoadPixmap('menu_codetoolsoptions');
itmEnvCodeToolsOptions.Bitmap.LoadFromLazarusResource('menu_codetoolsoptions');
mnuEnvironment.Add(itmEnvCodeToolsOptions);
itmEnvCodeToolsDefinesEditor := TMenuItem.Create(Self);
itmEnvCodeToolsDefinesEditor.Name:='itmEnvCodeToolsDefinesEditor';
itmEnvCodeToolsDefinesEditor.Caption := lisMenuCodeToolsDefinesEditor;
itmEnvCodeToolsDefinesEditor.Bitmap:=LoadPixmap('menu_codetoolsdefineseditor');
itmEnvCodeToolsDefinesEditor.Bitmap.LoadFromLazarusResource('menu_codetoolsdefineseditor');
mnuEnvironment.Add(itmEnvCodeToolsDefinesEditor);
mnuEnvironment.Add(CreateMenuSeparator);

View File

@ -720,6 +720,7 @@ var
var
Bits: PByte;
Header: TBitmapHeader;
StreamSize: longint;
{$ENDIF}
begin
{$IFNDEF DisableFPImage}
@ -739,7 +740,6 @@ begin
try
Bits:=nil;
FillBitmapInfo(Handle, Bits, Header);
DoWriteSize(Header);
WriteBitmapHeader(Header);
WriteColorMap(Header);
WritePixels(Bits, Header);
@ -750,6 +750,10 @@ begin
MemStream:=nil;
FImage.SaveStreamType:=bnWinBitmap;
// copy savestream to destination stream
if WriteSize then begin
StreamSize:=FImage.SaveStream.Size;
DestStream.WriteBuffer(StreamSize, SizeOf(StreamSize));
end;
Stream.CopyFrom(FImage.SaveStream,FImage.SaveStream.Size);
finally
ReallocMem(Bits, 0);
@ -1038,6 +1042,9 @@ end;
{ =============================================================================
$Log$
Revision 1.61 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.60 2004/02/07 20:25:37 mattias
fixed saving custom TBitBtn kind

View File

@ -74,7 +74,7 @@ end;
function TCustomCheckGroup.GetCheckEnabled(Index: integer): boolean;
begin
if (Index < -1) or (Index >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Index,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,FItems.Count]);
Result:=TCheckBox(FButtonList[Index]).Enabled;
end;
@ -82,14 +82,14 @@ procedure TCustomCheckGroup.SetCheckEnabled(Index: integer;
const AValue: boolean);
begin
if (Index < -1) or (Index >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Index,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,FItems.Count]);
TCheckBox(FButtonList[Index]).Enabled:=AValue;
end;
function TCustomCheckGroup.GetChecked(Index: integer): boolean;
begin
if (Index < -1) or (Index >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Index,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,FItems.Count]);
Result:=TCheckBox(FButtonList[Index]).Checked;
end;
@ -132,7 +132,7 @@ end;
procedure TCustomCheckGroup.SetChecked(Index: integer; const AValue: boolean);
begin
if (Index < -1) or (Index >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Index,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,FItems.Count]);
TCheckBox(FButtonList[Index]).Checked:=AValue;
end;
@ -256,6 +256,9 @@ end;
{
$Log$
Revision 1.4 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.3 2003/12/21 16:01:58 mattias
workaround for inherited bug in fpc 1.9

View File

@ -419,7 +419,7 @@ end;
procedure TCustomListBox.SetItemIndex(Val : integer);
begin
if (Val >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Val,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Val,FItems.Count]);
if Val<0 then Val:=-1;
//writeln('[TCustomListBox.SetItemIndex] A ',FItems.ClassName,' ',Val);
FItemIndex:=Val;
@ -435,7 +435,7 @@ procedure TCustomListBox.CheckIndex(const AIndex: Integer);
begin
if (AIndex < 0)
or (AIndex >= Items.Count)
then raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName, AIndex, Items.Count]);
then raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName, AIndex, Items.Count]);
end;
{------------------------------------------------------------------------------

View File

@ -234,7 +234,7 @@ begin
FItemIndex:=Value
else begin
if (Value < -1) or (Value >= FItems.Count) then
raise Exception.CreateFmt(rsIndexOutOfRange,[ClassName,Value,FItems.Count]);
raise Exception.CreateFmt(rsIndexOutOfBounds,[ClassName,Value,FItems.Count]);
if (HandleAllocated) then
begin
@ -395,6 +395,9 @@ end;
{
$Log$
Revision 1.26 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.25 2003/12/21 16:01:58 mattias
workaround for inherited bug in fpc 1.9

View File

@ -335,6 +335,14 @@ begin
Result := FItems.Count;
end;
function TMenuItem.GetBitmap: TBitmap;
begin
if FBitmap=nil then
FBitmap:=TBitmap.Create;
FBitmap.Transparent:=True;
Result:=FBitmap;
end;
{------------------------------------------------------------------------------
Function: TMenuItem.GetHandle
Params: none
@ -358,7 +366,7 @@ end;
function TMenuItem.GetItem(Index: Integer): TMenuItem;
begin
if FItems = nil then
raise EMenuError.CreateFmt(rsIndexOutOfRange,[ClassName,Index,0]);
raise EMenuError.CreateFmt(rsIndexOutOfBounds,[ClassName,Index,0]);
Result := TMenuItem(FItems[Index]);
end;
@ -385,6 +393,12 @@ begin
Result := FParent;
end;
function TMenuItem.IsBitmapStored: boolean;
begin
Result:=(FBitmap<>nil) and (not FBitmap.Empty)
and (FBitmap.Width>0) and (FBitmap.Height>0);
end;
{------------------------------------------------------------------------------
function TMenuItem.IsCaptionStored: boolean;
@ -718,6 +732,11 @@ begin
Items[I].Free;
end;
function TMenuItem.HasBitmap: boolean;
begin
Result:=FBitmap<>nil;
end;
{------------------------------------------------------------------------------
function TMenuItem.IsCheckItem: boolean;
@ -805,7 +824,12 @@ end;
procedure TMenuItem.SetBitmap(const AValue: TBitmap);
begin
if FBitmap=AValue then exit;
FBitmap:=AValue;
if AValue<>nil then begin
Bitmap.Assign(AValue);
end else begin
FBitmap.Free;
FBitmap:=nil;
end;
if HandleAllocated then RecreateHandle;
MenuChanged(False);
end;
@ -1118,6 +1142,9 @@ end;
{ =============================================================================
$Log$
Revision 1.51 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.50 2004/02/05 09:45:33 mattias
implemented Actions for TSpeedButton, TMenuItem, TCheckBox
@ -1299,6 +1326,9 @@ end;
$Log$
Revision 1.51 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.50 2004/02/05 09:45:33 mattias
implemented Actions for TSpeedButton, TMenuItem, TCheckBox

View File

@ -924,7 +924,7 @@ end;
function TTreeNode.GetItems(AnIndex: Integer): TTreeNode;
begin
if (AnIndex<0) or (AnIndex>=Count) then
TreeNodeErrorFmt(rssIndexOutOfBounds,[ClassName, AnIndex, Count]);
TreeNodeErrorFmt(rsIndexOutOfBounds,[ClassName, AnIndex, Count]);
Result:=FItems[AnIndex];
{Result := GetFirstChild;
while (Result <> nil) and (Index > 0) do
@ -938,7 +938,7 @@ end;
procedure TTreeNode.SetItems(AnIndex: Integer; AValue: TTreeNode);
begin
if (AnIndex<0) or (AnIndex>=Count) then
TreeNodeErrorFmt(rssIndexOutOfBounds, [ClassName, AnIndex, Count]);
TreeNodeErrorFmt(rsIndexOutOfBounds, [ClassName, AnIndex, Count]);
Items[AnIndex].Assign(AValue);
end;

View File

@ -3907,7 +3907,7 @@ begin
Width:=0;
Height:=0;
if LCLMenuItem=nil then exit;
if LCLMenuItem.Bitmap<>nil then
if LCLMenuItem.HasBitmap then
GetGdkPixmapFromGraphic(LCLMenuItem.Bitmap,IconImg,IconMask,Width,Height);
end;
@ -6307,6 +6307,9 @@ end;
{ =============================================================================
$Log$
Revision 1.258 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.257 2004/02/07 18:04:14 mattias
fixed grids OnDrawCells

View File

@ -165,7 +165,7 @@ ResourceString
rsAControlCanNotHaveItselfAsParent = 'A control can''t have itself as parent';
lisLCLResourceSNotFound = 'Resource %s not found';
rsErrorCreatingDeviceContext = 'Error creating device context for %s.%s';
rssIndexOutOfBounds = '%s Index %d out of bounds 0-%d';
rsIndexOutOfBounds = '%s Index %d out of bounds 0-%d';
rsUnknownPictureExtension = 'Unknown picture extension';
rsUnsupportedClipboardFormat = 'Unsupported clipboard format: %s';
rsGroupIndexCannotBeLessThanPrevious = 'GroupIndex cannot be less than a '

View File

@ -119,10 +119,12 @@ type
FShowAlwaysCheckable: boolean;
FSubMenuImages: TCustomImageList;
FVisible: Boolean;
function GetBitmap: TBitmap;
function GetCount: Integer;
function GetItem(Index: Integer): TMenuItem;
function GetMenuIndex: Integer;
function GetParent: TMenuItem;
function IsBitmapStored: boolean;
function IsCaptionStored: boolean;
function IsCheckedStored: boolean;
function IsEnabledStored: boolean;
@ -198,6 +200,7 @@ type
procedure Remove(Item: TMenuItem);
function IsInMenuBar: boolean; virtual;
procedure Clear;
function HasBitmap: boolean;
public
property Count: Integer read GetCount;
property Handle: HMenu read GetHandle write FHandle;
@ -215,7 +218,7 @@ type
property Default: Boolean read FDefault write SetDefault default False;
property Enabled: Boolean read FEnabled write SetEnabled
stored IsEnabledStored default True;
property Bitmap: TBitmap read FBitmap write SetBitmap;
property Bitmap: TBitmap read GetBitmap write SetBitmap stored IsBitmapStored;
property GroupIndex: Byte read FGroupIndex write SetGroupIndex default 0;
property HelpContext: THelpContext read FHelpContext write FHelpContext
stored IsHelpContextStored default 0;
@ -404,6 +407,9 @@ end.
{
$Log$
Revision 1.63 2004/02/08 11:31:32 mattias
TMenuItem.Bitmap is now auto created on read. Added TMenuItem.HasBitmap
Revision 1.62 2004/02/05 09:45:33 mattias
implemented Actions for TSpeedButton, TMenuItem, TCheckBox