tvplanit: Replace TVpMonthView's updown control by 4 speedbuttons for navigation to prev/next month/year, issue #39035.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8387 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-12 21:52:15 +00:00
parent 6a2e34537d
commit ea7af462bb
2 changed files with 88 additions and 55 deletions

View File

@ -633,6 +633,7 @@ var
HeadStrLen : Integer;
dayHeadHeight: Integer;
R: TRect;
txtstart: Integer;
begin
RenderCanvas.Brush.Color := HeadAttrColor;
dayHeadHeight := TVpMonthViewOpener(FMonthView).mvDayHeadHeight;
@ -659,10 +660,27 @@ begin
{ Position the spinner }
with TVpMonthViewOpener(FMonthView) do begin
mvSpinButtons.Height := dayHeadHeight - 3;
mvSpinButtons.Width := mvSpinButtons.Height * 2;
mvSpinButtons.Left := TextMargin;
mvSpinButtons.Top := HeadRect.Top + (dayHeadHeight - mvSpinButtons.Height) div 2 + 1;
FPrevYearBtn.Height := dayHeadHeight - 3;
FPrevYearBtn.Width := FPrevYearBtn.Height;
FPrevYearBtn.Left := TextMargin;
FPrevYearBtn.Top := HeadRect.Top + (dayHeadHeight - FPrevYearBtn.Height) div 2 + 1;
FPrevMonthBtn.Height := FPrevYearBtn.Height;
FPrevMonthBtn.Width := FPrevYearBtn.Height;
FPrevMonthBtn.Left := FPrevYearBtn.Left + FPrevYearBtn.Width;
FPrevMonthBtn.Top := FPrevYearBtn.Top;
FNextMonthBtn.Height := FPrevYearBtn.Height;
FNextMonthBtn.Width := FPrevYearBtn.Height;
FNextMonthBtn.Left := FPrevMonthBtn.Left + FPrevMonthBtn.Width;
FNextMonthBtn.Top := FPrevYearBtn.Top;
FNextYearBtn.Height := FPrevYearBtn.Height;
FNextYearBtn.Width := FPrevYearBtn.Height;
FNextYearBtn.Left := FNextMonthBtn.Left + FNextMonthBtn.Width;
FNextYearBtn.Top := FPrevYearBtn.Top;
txtStart := FNextYearBtn.Left + FNextYearBtn.Width + TextMargin;
end;
{ Acquire startdate and end date }
@ -706,8 +724,8 @@ begin
TPSTextOut(
RenderCanvas,
Angle,
RenderIn,
RealLeft + TVpMonthViewOpener(FMonthView).mvSpinButtons.Width + TextMargin * 2,
RenderIn, // Viewport
txtstart, // Horizontal text position, after the spin buttons
HeadTextRect.Top, // this vertical position is already centered
HeadStr
);