⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvtfdays.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
    FLiveTimer: Boolean;

    FMouseMovePt: TPoint;
    FMouseMoveState: TShiftState;

    procedure SetDateFormat(const Value: string); override;
    procedure ReqSchedNotification(Schedule: TJvTFSched); override;
    procedure RelSchedNotification(Schedule: TJvTFSched); override;
    procedure CreateParams(var Params: TCreateParams); override;

    function GetFocusedSchedule: TJvTFSched;
    procedure SetSelAppt(Value: TJvTFAppt);
   //procedure SetGroupTitles; dynamic;
   //procedure ReorderCols;

   // All painting routines
    procedure Paint; override;
    procedure DrawDataCell(ACanvas: TCanvas; ColIndex, RowIndex: Integer);
    procedure DrawEmptyColHdr(ACanvas: TCanvas);
    procedure DrawAppt(ACanvas: TCanvas; Col: Integer; Appt: TJvTFAppt;
      StartRow, EndRow: Integer);
    procedure DrawApptDetail(ACanvas: TCanvas; ARect: TRect; Appt: TJvTFAppt;
      Selected: Boolean; Col, StartRow, EndRow: Integer);
    procedure DrawApptBar(ACanvas: TCanvas; Appt: TJvTFAppt; BarRect: TRect;
      Col, StartRow, EndRow: Integer);
    function CalcTimeStampRect(Appt: TJvTFAppt; BarRect: TRect;
      Col, StartRow, EndRow: Integer): TRect;
    procedure DrawTimeStamp(ACanvas: TCanvas; TimeStampRect: TRect);
    procedure DrawPics(ACanvas: TCanvas; var ARect: TRect; Appt: TJvTFAppt);
    procedure CreatePicDrawList(ARect: TRect; Appt: TJvTFAppt; DrawList: TList);
    procedure FilterPicDrawList(ARect: TRect; DrawList: TList;
      var PicsHeight: Integer);
    procedure ClearPicDrawList(DrawList: TList);
    procedure DrawListPics(ACanvas: TCanvas; var ARect: TRect; DrawList: TList);
    procedure DrawGrabLines(ACanvas: TCanvas; LineTop, LineLeft,
      LineRight: Integer);
    procedure DrawGrabHandle(ACanvas: TCanvas; ARect: TRect;
      AAppt: TJvTFAppt; TopHandle: Boolean);
    procedure DrawCorner(ACanvas: TCanvas; Corner: TJvTFDaysCorner);
    procedure DrawRowHdr(ACanvas: TCanvas; Index: Integer);
   //procedure DrawColHdr(ACanvas: TCanvas; Index: Integer);
    function GetTallestColTitle(ACanvas: TCanvas): Integer;

    procedure GetApptDrawInfo(DrawInfo: TJvTFDaysApptDrawInfo;
      AAppt: TJvTFAppt; Attr: TJvTFDaysApptAttr);

    {$IFDEF Jv_TIMEBLOCKS}
   // ok to REPLACE old DrawFrame
    procedure DrawFrame(ACanvas: TCanvas; ARect: TRect; Draw3D: Boolean;
      FrameColour: TColor);
    {$ELSE}
    // obsolete
    //procedure DrawFrame(ACanvas: TCanvas; ARect: TRect; Draw3D: Boolean);
    {$ENDIF Jv_TIMEBLOCKS}

    procedure DrawAppts(ACanvas: TCanvas; DrawAll: Boolean);
    procedure AdjustForMargins(var ARect: TRect);
    procedure CanDrawWhat(ACanvas: TCanvas; ApptRect: TRect; PicsHeight: Integer;
      var CanDrawText, CanDrawPics: Boolean);
    procedure ManualFocusRect(ACanvas: TCanvas; ARect: TRect);
   // Fancy painting routines
    procedure DrawFancyRowHdrs(ACanvas: TCanvas);
    procedure DrawMinor(ACanvas: TCanvas; ARect: TRect; RowNum: Integer;
      const LabelStr: string; TickLength: Integer; Selected: Boolean);
    function GetMinorLabel(RowNum: Integer): string;
    function GetMinorTickLength: Integer; virtual;
    function GetMajorTickLength: Integer; virtual;
    procedure DrawGroupHdrs(ACanvas: TCanvas);
   //procedure DrawGroupHdr(ACanvas: TCanvas; ACol: Integer);
    procedure DrawColGroupHdr(ACanvas: TCanvas; Index: Integer;
      IsGroupHdr: Boolean);

    {$IFDEF Jv_TIMEBLOCKS}
   // ok
    procedure DrawBlockHdr(ACanvas: TCanvas; BlockIndex: Integer);
   // ok
    procedure FillBlockHdrDeadSpace(ACanvas: TCanvas);
   // REMOVE, replaced by CalcTextPos in JvTFUtils
   //procedure CalcTextPos(var ARect: TRect; aAngle: Integer; aTxt: string);
   // REMOVE, replaced by DrawAngleText in JvTFUtils
   //procedure DrawAngleText(ACanvas: TCanvas; ARect: TRect; aAngle: Integer;
    //aTxt: string);
    {$ENDIF Jv_TIMEBLOCKS}

   // message handlers
    procedure Resize; override;

    procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
    procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR;
    procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
    procedure CMDesignHitTest(var Msg: TCMDesignHitTest); message CM_DESIGNHITTEST;
    procedure CNRequestRefresh(var Msg: TCNRequestRefresh); message CN_REQUESTREFRESH;
    procedure WMTimer(var Msg: TWMTimer); message WM_TIMER;

    procedure CMFontChanged(var Msg: TMessage); message CM_FONTCHANGED;
    procedure CMEnabledChanged(var Msg: TMessage); message CM_ENABLEDCHANGED;
    procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;

   // internal routines
    procedure Loaded; override;
    procedure RefreshControl; override;
    procedure UpdateDesigner;

   // scroll bar stuff
    procedure CheckSBParams;
    procedure ScrollBarScroll(Sender: TObject; ScrollCode: TScrollCode;
      var ScrollPos: Integer);
    property VisibleScrollBars: TJvTFVisibleScrollBars read FVisibleScrollBars
      write SetTFVisibleScrollBars;

   // mouse routines
    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
      X, Y: Integer); override;
    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
    procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
      X, Y: Integer); override;
    procedure DblClick; override;
    procedure DoApptHint(GridCoord: TJvTFDaysCoord);
    procedure DoCellHint(GridCoord: TJvTFDaysCoord);

   // Drag/Drop routines
    procedure DoStartDrag(var DragObject: TDragObject); override;
    procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
      var Accept: Boolean); override;
    procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
    procedure DropAppt(DragInfo: TJvTFDragInfo; X, Y: Integer);

    procedure BeginDragging(Coord: TJvTFDaysCoord; DragWhat: TJvTFDaysState;
      Appt: TJvTFAppt);
    procedure DrawDrag(Coord: TJvTFDaysCoord; AAppt: TJvTFAppt; Clear: Boolean);
    procedure ContinueDragging(Coord: TJvTFDaysCoord; Appt: TJvTFAppt);
    procedure EndDragging(Coord: TJvTFDaysCoord; Appt: TJvTFAppt);
    function CanDragWhat(Coord: TJvTFDaysCoord): TJvTFDaysState;
    procedure CalcSizeEndTime(Appt: TJvTFAppt; var NewEndDT: TDateTime);
    procedure CalcMoveStartEnd(Appt: TJvTFAppt; Coord: TJvTFDaysCoord;
      KeepDates, KeepTimes: Boolean; var StartDT, EndDT: TDateTime);

    procedure KillAutoScrollTimer;

    procedure EnsureCol(ACol: Integer);
    procedure EnsureRow(ARow: Integer);

   // navigation
    procedure KeyDown(var Key: Word; Shift: TShiftState); override;
    procedure KeyPress(var Key: Char); override;
    procedure DoInsertSchedule; dynamic;
    procedure DoInsertAppt; dynamic;
    procedure DoDeleteAppt; dynamic;
    procedure DoDeleteSchedule; dynamic;
//     procedure DoNavigate; virtual;

    function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
    function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
    procedure DestroyApptNotification(AAppt: TJvTFAppt); override;
    procedure Navigate(AControl: TJvTFControl; SchedNames: TStringList;
      Dates: TJvTFDateList); override;

    procedure DoEnter; override;
    procedure DoExit; override;

   // Selection methods
    function GetSelStart: TPoint;
    function GetSelEnd: TPoint;
    procedure SetSelStart(Value: TPoint);
    procedure SetSelEnd(Value: TPoint);
    procedure QuickEntry(Key: Char); virtual;

    {$IFDEF Jv_TIMEBLOCKS}
   // ok
    procedure EnsureBlockRules(GridGran, BlockGran: Integer; DayStart: TTime);
   // ok
    function ValidateBlockRules(GridGran, BlockGran: Integer;
      DayStart: TTime): Boolean;
    {$ENDIF Jv_TIMEBLOCKS}
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;

    function GetTFHintClass: TJvTFHintClass; dynamic;

   // move grab handles
    function GetTopGrabHandleRect(Col: Integer; Appt: TJvTFAppt): TRect;
   // move grab handles
    function GetBottomGrabHandleRect(Col: Integer; Appt: TJvTFAppt): TRect;
    function PtInTopHandle(APoint: TPoint; Col: Integer; Appt: TJvTFAppt): Boolean;
    function PtInBottomHandle(APoint: TPoint; Col: Integer; Appt: TJvTFAppt): Boolean;

   // grid region functions
    function GetAdjClientRect: TRect;
    function GetDataAreaRect: TRect;
    function GetDataWidth: Integer;
    function GetDataHeight: Integer;
    function PtToCell(X, Y: Integer): TJvTFDaysCoord;
    function CellRect(Col, Row: Integer): TRect;
    function VirtualCellRect(Col, Row: Integer): TRect;
    function GetApptRect(Col: Integer; Appt: TJvTFAppt): TRect;
    function LocateDivCol(X, TotalWidth, SegCount: Integer): Integer;
    function CalcGroupHdrHeight: Integer;
    function CalcGroupColHdrsHeight: Integer;
    function VirtualGroupHdrRect(Col: Integer): TRect;
    procedure GetGroupStartEndCols(Col: Integer; var StartCol, EndCol: Integer);

    {$IFDEF Jv_TIMEBLOCKS}
   // ok
    function RowToTimeBlock(ARow: Integer): Integer;
   // ok
    procedure GetTimeBlockStartEnd(ATimeBlock: Integer; var BlockStart,
      BlockEnd: Integer);
   // ok
    function CalcBlockHdrWidth: Integer;
   // ok
    function CalcBlockRowHdrsWidth: Integer;
   // ok
    procedure GetBlockStartEndRows(Row: Integer; var StartRow, EndRow: Integer);
   // ok
    function VirtualBlockHdrRect(Row: Integer): TRect;
    {$ENDIF Jv_TIMEBLOCKS}

   // editor management routines
    procedure EditAppt(Col: Integer; Appt: TJvTFAppt);
    procedure FinishEditAppt;
    function Editing: Boolean;
    function CanEdit: Boolean; dynamic;

   // grid layout routines
    function RowsPerHour: Integer;
    function RowCount: Integer;
    function PossVisibleRows: Integer;
    function VisibleRows: Integer;
    function FullVisibleRows: Integer;
    function VisibleCols: Integer;
    function FullVisibleCols: Integer;
    function RowToTime(RowNum: Integer): TTime;
    function TimeToRow(ATime: TTime): Integer;
    procedure TimeToTop(ATime: TTime);
    function AdjustEndTime(ATime: TTime): TTime; dynamic;
    function RowStartsHour(RowNum: Integer): Boolean;
    function RowEndsHour(RowNum: Integer): Boolean;
    function RowEndTime(RowNum: Integer): TTime;

    function RowToHour(RowNum: Integer): Word;
    function HourStartRow(Hour: Word): Integer;
    function HourEndRow(Hour: Word): Integer;

    property State: TJvTFDaysState read FState;
    function BottomRow: Integer;
    function RightCol: Integer;
    property SelAppt: TJvTFAppt read FSelAppt write SetSelAppt;
    property FocusedSchedule: TJvTFSched read GetFocusedSchedule;

    procedure DragDrop(Source: TObject; X, Y: Integer); override;
    procedure CalcStartEndRows(AAppt: TJvTFAppt; SchedDate: TDate;
      var StartRow, EndRow: Integer);

    {$IFDEF Jv_TIMEBLOCKS}
   // ok
    function IsWeekend(ColIndex: Integer): Boolean;
    {$ENDIF Jv_TIMEBLOCKS}

   // date navigation methods
    procedure PrevDate;
    procedure NextDate;
    procedure GotoDate(aDate: TDate);
    procedure ScrollDays(NumDays: Integer);
    procedure ScrollMonths(NumMonths: Integer);
    procedure ScrollYears(NumYears: Integer);

    procedure ReleaseSchedule(const SchedName: string; SchedDate: TDate); override;
    procedure RowInView(ARow: Integer);
    procedure ColInView(ACol: Integer);

   // selection properties and methods
    property FocusedCol: Integer read GetFocusedCol write SetFocusedCol;
    property FocusedRow: Integer read GetFocusedRow write SetFocusedRow;
    property SelStart: TPoint read GetSelStart write SetSelStart;
    property SelEnd: TPoint read GetSelEnd write SetSelEnd;
    function CellIsSelected(ACell: TPoint): Boolean;
    function ColIsSelected(ACol: Integer): Boolean;
    function RowIsSelected(ARow: Integer): Boolean;
    procedure ClearSelection;
    function ValidSelection: Boolean;
    procedure SelFirstAppt;
    procedure SelPrevAppt;
    procedure SelNextAppt;
    procedure SelLastAppt;
    procedure SelFirstApptNextCol;
    procedure SelFirstApptPrevCol;
    procedure ApptInView(AAppt: TJvTFAppt; ACol: Integer);
    procedure SelApptCell(AAppt: TJvTFAppt; ACol: Integer);
    function GroupHdrIsSelected(ACol: Integer): Boolean;

    {$IFDEF Jv_TIMEBLOCKS}
    // ok
    function BlockHdrIsSelected(ARow: Integer): Boolean;
    {$ENDIF Jv_TIMEBLOCKS}

    function EnumSelCells: TDynPointArray;
    function EnumSelCols: TDynIntArray;
    function EnumSelRows: TDynIntArray;

    function GetApptDispColor(Appt: TJvTFAppt; Selected: Boolean): TColor;
  published
    property DitheredBackground: Boolean read FDitheredBackground write SetDitheredBackground default True;
    property BorderStyle: TBorderStyle read FBorderStyle write SetBorderStyle default bsSingle;
    // grid layout properties
    property AutoSizeCols: Boolean read FAutoSizeCols write SetAutoSizeCols default True;
    property Granularity: Integer read FGranularity write SetGranularity default 30;
    property ColHdrHeight: Integer read FColHdrHeight write SetColHdrHeight default 25;
    property Cols: TJvTFDaysCols read FCols write SetCols;
    property DefColWidth: Integer read FDefColWidth write FDefColWidth default 100;
    property MinColWidth: Integer read FMinColWidth write SetMinColWidth default AbsMinColWidth;
    property MinRowHeight: Integer read FMinRowHeight write SetMinRowHeight default 12;
    property Options: TJvTFDaysOptions read FOptions write SetOptions
      default [agoSizeCols, agoSizeRows, agoSizeColHdr, agoSizeRowHdr,
      agoSizeAppt, agoMoveAppt, agoEditing, agoShowPics,
      agoShowText, agoShowApptHints, agoQuickEntry, agoShowSelHint];
    property RowHdrWidth: Integer read FRowHdrWidth write SetRowHdrWidth default 50;
    property RowHeight: Integer read FRowHeight write SetRowHeight default 19;
    property ShowFocus:Boolean read FShowFocus write SetShowFocus default True;
    property Template: TJvTFDaysTemplate read FTemplate write FTemplate;
    property Grouping: TJvTFDaysGrouping read FGrouping write SetGrouping;
    property GroupHdrHeight: Integer read FGroupHdrHeight write SetGroupHdrHeight default 25;

    property GridStartTime: TTime read FGridStartTime write SetGridStartTime;
    property GridEndTime: TTime read FGridEndTime write SetGridEndTime;

    {$IFDEF Jv_TIMEBLOCKS}
   // ok
    property TimeBlocks: TJvTFDaysTimeBlocks read FTimeBlocks write SetTimeBlocks;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -