AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt

git-svn-id: trunk@3496 -
This commit is contained in:
lazarus 2002-10-10 13:29:08 +00:00
parent c813ca6960
commit 35fd64f0b5
7 changed files with 86 additions and 34 deletions

View File

@ -263,12 +263,13 @@ const
(mrYes, mrNo, mrOK, mrCAncel, mrAbort, mrRetry, mrIgnore, mrAll,
mrNoToAll, mrYesToAll, 0);
type
PCharArray32x32 = Array [0..36] of PChar;
var
mtImages : Array [TMsgDlgType] of PCharArray32x32;
mbImages : array [TMsgDlgBtn] of PCharArray;
mtImages : Array [TMsgDlgType] of Longint = (
idDialogWarning, idDialogError, idDialogInfo, idDialogConfirm,
idDialogInfo);
mbImages : array [TMsgDlgBtn] of longint = (
idButtonYes, idButtonNo, idButtonOK, idButtonCancel, idButtonAbort,
idButtonRetry, idButtonIgnore, idButtonAll,idButtonAll, idButtonAll,
idButtonHelp);
{$I commondialog.inc}
@ -280,34 +281,10 @@ begin
end;
{$I fontdialog.inc}
{$I messagedialogpixmaps.inc}
{$I messagedialogs.inc}
procedure InitImages;
begin
mbImages[mbYes] := IMGOK_Check;
mbImages[mbNo] := IMGCancel_X;
mbImages[mbOK] := IMGOK_Check;
mbImages[mbCancel] := IMGCancel_X;
mbImages[mbAbort] := IMGCancel_X;
mbImages[mbRetry] := IMGClose;
mbImages[mbIgnore] := IMGClose;
mbImages[mbAll] := IMGAll_Check;
mbImages[mbNoToAll]:= IMGAll_Check;
mbImages[mbYesToAll]:= IMGAll_Check;
mbImages[mbHelp] := IMGHELP;
mtImages [MtWarning ] := IMGWarning;
mtImages [MtError ] := IMGError;
mtImages [MtInformation ] := IMGInfo;
mtImages [MtConfirmation] := IMGConfirmation;
mtImages [MtCustom ] := IMGInfo;
end;
initialization
InitImages;
finalization
end.
@ -315,6 +292,9 @@ end.
{ =============================================================================
$Log$
Revision 1.19 2002/10/10 13:29:08 lazarus
AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt
Revision 1.18 2002/09/27 20:52:21 lazarus
MWE: Applied patch from "Andrew Johnson" <aj_genius@hotmail.com>

View File

@ -100,7 +100,7 @@ Begin
if Glyph <> nil then Glyph.free;
Bitmap1 := TBitmap.Create;
Bitmap1.Handle := CreatePixmapIndirect(@BitBtnImages[FKInd], ColorToRGB(clBtnFace));
Bitmap1.Handle := LoadStockPixmap(BitBtnImages[Value]);
Caption := BitBtnCaption[fKind];

View File

@ -12,6 +12,9 @@
* *
*****************************************************************************
}
type
PCharArray32x32 = Array [0..36] of PChar;
const
IMGInfo : PCharArray32x32 =

View File

@ -245,7 +245,7 @@ begin
FDlgType := value;
FBitmap.Free;
FBitmap := TBitmap.Create;
FBitmap.Handle := CreatePixmapIndirect(@mtImages[FDlgType], ColorToRGB(clBtnFace));
FBitmap.Handle := LoadStockPixmap(mtImages[FDlgType]);
if DefaultCaption then
Caption := cMtCaption[FDlgType];
end;
@ -376,8 +376,7 @@ begin
Layout := blGlyphLeft;
// ToDo: when TBitmap streaming is working, load image from resource
aBitmap := TBitmap.Create;
aBitmap.Handle := CreatePixmapIndirect(@mbImages [curBtn],
ColorToRGB(clBtnFace));
aBitmap.Handle := LoadStockPixmap(mbImages[curBtn]);
Glyph := aBitmap;
ModalResult := cMbResult[curBtn];
Caption := cMbCaption[curBtn];
@ -597,6 +596,9 @@ end;
{
$Log$
Revision 1.15 2002/10/10 13:29:08 lazarus
AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt
Revision 1.14 2002/09/27 20:52:23 lazarus
MWE: Applied patch from "Andrew Johnson" <aj_genius@hotmail.com>

View File

@ -28,7 +28,41 @@
// {$DEFINE ASSERT_IS_ON}
{$EndIf}
Function TGnomeObject.LoadStockPixmap(StockID: longint) : HBitmap;
var
Pixmap : PGDIObject;
StockName : PChar;
begin
Case StockID Of
idButtonOk : StockName := GNOME_STOCK_BUTTON_OK;
idButtonCancel : StockName := GNOME_STOCK_BUTTON_CANCEL;
idButtonYes : StockName := GNOME_STOCK_BUTTON_YES;
idButtonNo : StockName := GNOME_STOCK_BUTTON_NO;
idButtonHelp : StockName := GNOME_STOCK_BUTTON_HELP;
idButtonAbort : StockName := GNOME_STOCK_BUTTON_CANCEL;
idButtonClose : StockName := GNOME_STOCK_PIXMAP_QUIT;
else begin
Result := inherited LoadStockPixmap(StockID);
exit;
end;
end;
Pixmap := NewGDIObject(gdiBitmap);
With Pixmap^ do begin
GDIBitmapType := gbPixmap;
gnome_stock_pixmap_gdk(STOCKName, nil, @GDIPixmapObject, @GDIBitmapMaskObject);
end;
Result := HBitmap(Pixmap);
end;
{$IfDef ASSERT_IS_ON}
{$UNDEF ASSERT_IS_ON}
{$C-}
{$EndIf}
{
$Log$
Revision 1.2 2002/10/10 13:29:08 lazarus
AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt
}

View File

@ -18,3 +18,12 @@
*****************************************************************************
}
Function LoadStockPixmap(StockID: longint) : HBitmap; override;
{
$Log$
Revision 1.2 2002/10/10 13:29:08 lazarus
AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt
}

View File

@ -1144,6 +1144,27 @@ const
STOCK_LAST = 19;
//==============================================
// Stock Pixmap Types
//==============================================
idButtonBase = 0;
idButtonOk = idButtonBase + 1;
idButtonCancel = idButtonBase + 2;
idButtonHelp = idButtonBase + 3;
idButtonYes = idButtonBase + 4;
idButtonNo = idButtonBase + 5;
idButtonClose = idButtonBase + 6;
idButtonAbort = idButtonBase + 7;
idButtonRetry = idButtonBase + 8;
idButtonIgnore = idButtonBase + 9;
idButtonAll = idButtonBase + 10;
idDialogBase = $FF;
idDialogWarning = idDialogBase + 1;
idDialogError = idDialogBase + 2;
idDialogInfo = idDialogBase + 3;
idDialogConfirm = idDialogBase + 4;
//==============================================
// SystemMetrics constants
//==============================================
@ -1598,6 +1619,9 @@ end.
{
$Log$
Revision 1.20 2002/10/10 13:29:08 lazarus
AJ: added LoadStockPixmap routine & minor fixes to/for GNOMEInt
Revision 1.19 2002/10/04 14:24:14 lazarus
MG: added DrawItem to TComboBox/TListBox