RxFPC:replase button icon in RxDateEdit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6164 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2018-02-01 08:47:24 +00:00
parent c5b3e83d2a
commit 749f1cd764
3 changed files with 58 additions and 43 deletions

View File

@ -37,7 +37,7 @@ interface
uses
Classes, SysUtils, LCLType, LMessages, Graphics, MaskEdit, Controls, EditBtn,
rxpickdate, rxdateutil;
LCLVersion, rxpickdate, rxdateutil;
type
{ TCustomDateEdit }
@ -114,6 +114,7 @@ type
procedure EditKeyDown(var Key: word; Shift: TShiftState); override;
procedure EditKeyPress( var Key: char); override;
function GetDefaultGlyph: TBitmap; override;
function GetDefaultGlyphName: String; override;
function CreatePopupForm:TPopupCalendar;
procedure DoEnter; override;
@ -152,6 +153,8 @@ type
{ TRxDateEdit }
TRxDateEdit = class(TCustomRxDateEdit)
protected
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
property PopupVisible;
@ -180,7 +183,7 @@ type
property Glyph;
property MaxLength;
property NotInThisMonthColor;
property NumGlyphs;
property NumGlyphs default {$IF lcl_fullversion >= 1090000} 1 {$ELSE} 2 {$ENDIF};
property OKCaption;
property ParentFont;
property ParentShowHint;
@ -223,6 +226,7 @@ type
function PaintComboEdit(Editor: TCustomMaskEdit; const AText: string;
AAlignment: TAlignment; StandardPaint: Boolean;
var ACanvas: TControlCanvas; var Message: TLMPaint): Boolean;
function EditorTextMargins(Editor: TCustomMaskEdit): TPoint;
implementation
@ -374,6 +378,16 @@ end;
{ TRxDateEdit }
procedure TRxDateEdit.Loaded;
begin
inherited Loaded;
{$IF lcl_fullversion >= 1090000}
{ if Assigned(Glyph)
and (Glyph.Equals(RxDateGlyph)) then}
NumGlyphs:=1;
{$ENDIF}
end;
constructor TRxDateEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
@ -398,15 +412,6 @@ begin
UpdateMask;
end;
{
function TCustomRxDateEdit.GetCalendarStyle: TCalendarStyle;
begin
if FPopup <> nil then
Result := csPopup
else
Result := csDialog;
end;
}
function TCustomRxDateEdit.GetDate: TDateTime;
begin
if DefaultToday then Result := SysUtils.Date
@ -699,11 +704,6 @@ begin
if Focused then inherited SelectAll;
end;
end;
{ FPopup.Show(AOrigin);
SetWindowPos(Handle, HWND_TOP, Origin.X, Origin.Y, 0, 0,
SWP_NOACTIVATE or SWP_SHOWWINDOW or SWP_NOSIZE);
Visible := True;}
end;
procedure TCustomRxDateEdit.ApplyDate(Value: TDateTime);
@ -849,16 +849,32 @@ begin
end;
end;
function TCustomRxDateEdit.GetDefaultGlyph: TBitmap;
var
R: TRect;
B: TCustomBitmap;
begin
{$IF lcl_fullversion < 01090000}
Result := nil;
{$ELSE}
Result := DateGlyph;
{$ENDIF}
end;
function TCustomRxDateEdit.GetDefaultGlyphName: String;
begin
{$IFDEF LINUX}
Result:='picDateEdit';
{$IF lcl_fullversion < 01090000}
{$IFDEF LINUX}
Result:='picDateEdit';
{$ELSE}
{$IFDEF WINDOWS}
Result:='picDateEdit';
{$ELSE}
Result:='';
{$ENDIF}
{$ENDIF}
{$ELSE}
{$IFDEF WINDOWS}
Result:='picDateEdit';
{$ELSE}
Result:='';
{$ENDIF}
Result:=ResBtnCalendar
{$ENDIF}
end;
@ -893,23 +909,13 @@ begin
ControlState := ControlState + [csCreating];
try
UpdateFormat;
(*
{$IFDEF DEFAULT_POPUP_CALENDAR}
FPopup := CreatePopupCalendar(Self {$IFDEF USED_BiDi}, BiDiMode {$ENDIF});
FPopup.OnCloseUp := @PopupCloseUp;
FPopup.Color := FPopupColor;
FPopup.Visible:=false;
{$ELSE}
FPopup:=nil;
{$ENDIF DEFAULT_POPUP_CALENDAR}
*)
FPopup:=nil;
// GlyphKind := gkDefault; { force update }
finally
ControlState := ControlState - [csCreating];
end;
// Glyph:=LoadBitmapFromLazarusResource('picDateEdit');
{$IF lcl_fullversion < 01090000}
NumGlyphs := 2;
{$ENDIF}
end;
destructor TCustomRxDateEdit.Destroy;

View File

@ -878,7 +878,6 @@ type
procedure RemoveTools(ATools:TRxDBGridAbstractTools);
procedure OnDataSetScrolled(aDataSet:TDataSet; Distance: Integer);
function GetFieldDisplayText(AField:TField; ACollumn:TRxColumn):string;
procedure FillFilterData;
protected
FRxDbGridLookupComboEditor: TCustomControl;
@ -895,6 +894,7 @@ type
procedure AdjustEditorBounds(NewCol,NewRow:Integer); override;
procedure LinkActive(Value: Boolean); override;
function GetFieldDisplayText(AField:TField; ACollumn:TRxColumn):string;
procedure DefaultDrawCellA(aCol, aRow: integer; aRect: TRect;
aState: TGridDrawState);
procedure DefaultDrawTitle(aCol, aRow: integer; aRect: TRect;
@ -910,6 +910,8 @@ type
procedure DrawRow(ARow: Integer); override;
procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override;
procedure DrawFooterRows; virtual;
procedure DrawCellBitmap(RxColumn: TRxColumn; aRect: TRect;
aState: TGridDrawState; AImageIndex: integer); virtual;
procedure DoTitleClick(ACol: longint; ACollumn: TRxColumn; Shift: TShiftState); virtual;
procedure MouseMove(Shift: TShiftState; X, Y: integer); override;
@ -919,8 +921,6 @@ type
procedure KeyPress(var Key: char); override;
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
function CreateColumns: TGridColumns; override;
procedure DrawCellBitmap(RxColumn: TRxColumn; aRect: TRect;
aState: TGridDrawState; AImageIndex: integer); virtual;
procedure SetEditText(ACol, ARow: longint; const Value: string); override;
procedure ColRowMoved(IsColumn: boolean; FromIndex, ToIndex: integer); override;
@ -5424,8 +5424,11 @@ begin
aRect.Top := (aRect.Top + aRect.Bottom - H) div 2;
aRect.Bottom := aRect.Top + H;
end;
{$IFDEF lcl_version < '1.9.0.0'}
RxColumn.ImageList.StretchDraw(Canvas, AImageIndex, aRect);
{$ELSE}
RxColumn.ImageList.Draw(Canvas, aRect.Left, aRect.Top, AImageIndex);
{$ENDIF}
end;
procedure TRxDBGrid.SetEditText(ACol, ARow: longint; const Value: string);

View File

@ -123,6 +123,9 @@ end;
{ TRxColInfo }
Type
THackRxDBGrid = class(TRxDBGrid);
constructor TRxColInfo.Create;
begin
inherited Create;
@ -380,21 +383,24 @@ begin
TfrMemoView(View).FillColor:=C;
end;
S:= FDataField.DisplayText; //F.Col.Field.DisplayText;
{ S:= FDataField.DisplayText; //F.Col.Field.DisplayText;
if Assigned(FDataCollumn) and (FDataCollumn.KeyList.Count > 0) and (FDataCollumn.PickList.Count > 0) then
begin
J := FDataCollumn.KeyList.IndexOf(S);
if (J >= 0) and (J < FDataCollumn.PickList.Count) then
S := FDataCollumn.PickList[j];
end
else
else}
if (rxpoHideZeroValues in FOptions) and Assigned(FDataField) and (FDataField.DataType in [ftSmallint, ftInteger, ftWord,
ftFloat, ftCurrency, ftLargeint]) and (FDataField.AsFloat = 0) then
S:='';
S:=''
else
S:=THackRxDBGrid(RxDBGrid).GetFieldDisplayText(FDataField, FDataCollumn);
Memo[0] := S;
TfrMemoView(View).Alignment:=FDataCollumn.Alignment;
end else
end
else
if Copy(S, 1, 7) = 'Header_' then
begin
TfrMemoView(View).Alignment:=F.Col.Title.Alignment;