{ @abstract(This unit contains the base class for all visible controls.)
@author(Tomas Krysl (tk@tkweb.eu))
@created(18 Sep 2009)
@lastmod(20 Jun 2010)
This unit implements the base class TKCustomControl for all visible controls
from the KControls Development Suite.
Copyright © 2009 Tomas Krysl (tk@@tkweb.eu)
License:
This code is distributed as a freeware. You are free to use it as part
of your application for any purpose including freeware, commercial and
shareware applications. The origin of this source code must not be
misrepresented; you must not claim your authorship. You may modify this code
solely for your own purpose. Please feel free to contact the author if you
think your changes might be useful for other users. You may distribute only
the original package. The author accepts no liability for any damage
that may result from using this code. }
unit KControls;
{$include kcontrols.inc}
{$WEAKPACKAGEUNIT ON}
interface
uses
{$IFDEF FPC}
LCLType, LCLIntf, LMessages, LCLProc, LResources,
{$ELSE}
Windows, Messages,
{$ENDIF}
SysUtils, Classes, Graphics, Controls, Forms, KFunctions
{$IFDEF USE_THEMES}
, Themes
{$IFNDEF FPC}
, UxTheme
{$ENDIF}
{$ENDIF}
;
type
{ This array serves as storage place for all colors. }
TKColorArray = array of TColor;
{ Declares possible indexes e.g. for the @link(TKPreviewColors.Color) property. }
TKPreviewColorIndex = Integer;
{ Declares print options - possible values for the @link(TKPrintPageSetup.Options) property. }
TKPrintOption = (
{ If there are more printed copies these will be collated. }
poCollate,
{ The printed shape will be scaled to fit on page. }
poFitToPage,
{ Every even page will be printed with mirrored (swapped) margins. }
poMirrorMargins,
{ Page numbers will be added to the bottom of each printed page. }
poPageNumbers,
{ Paints the selection in control's specific manner. }
poPaintSelection,
{ Title will be printed to the top of each printed page. }
poTitle,
{ Color page will be printed instead of B/W page. }
poUseColor
);
{ Print options can be arbitrary combined. }
TKPrintOptions = set of TKPrintOption;
{ Declares possible values for the @link(TKPrintPageSetup.Range) property. }
TKPrintRange = (
{ All pages will be printed. }
prAll,
{ Only selected block will be printed. }
prSelectedOnly,
{ Only given range of pages will be printed. }
prRange
);
{ Declares measurement units for KControls printing system. }
TKPrintUnits = (
{ Corresponding value is given in millimeters. }
puMM,
{ Corresponding value is given in centimeters. }
puCM,
{ Corresponding value is given in inches. }
puInch,
{ Corresponding value is given in hundredths of inches. }
puHundredthInch
);
const
{ Default value for the @link(TKCustomControl.BorderStyle) property. }
cBorderStyleDef = bsSingle;
{ Minimum for the @link(TKPrintPageSetup.Copies) property }
cCopiesMin = 1;
{ Maximum for the @link(TKPrintPageSetup.Copies) property }
cCopiesMax = 1000;
{ Default value for the @link(TKPrintPageSetup.Copies) property }
cCopiesDef = 1;
{ Default value for the @link(TKPrintPageSetup.MarginBottom) property }
cMarginBottomDef = 2.0;
{ Default value for the @link(TKPrintPageSetup.MarginLeft) property }
cMarginLeftDef = 1.5;
{ Default value for the @link(TKPrintPageSetup.MarginRight) property }
cMarginRightDef = 1.5;
{ Default value for the @link(TKPrintPageSetup.MarginTop) property }
cMarginTopDef = 1.8;
{ Default value for the @link(TKPrintPageSetup.Options) property. }
cOptionsDef = [poFitToPage, poPageNumbers, poUseColor];
{ Default value for the @link(TKPrintPageSetup.Options) property. }
cRangeDef = prAll;
{ Minimum for the @link(TKPrintPageSetup.Scale) property }
cScaleDef = 100;
{ Maximum for the @link(TKPrintPageSetup.Scale) property }
cScaleMin = 10;
{ Default value for the @link(TKPrintPageSetup.Scale) property }
cScaleMax = 500;
{ Default value for the @link(TKPrintPageSetup.Units) property. }
cUnitsDef = puCM;
{ Default value for the @link(TKPreviewColors.Paper) color property. }
cPaperDef = clWhite;
{ Default value for the @link(TKPreviewColors.BkGnd) color property. }
cBkGndDef = clAppWorkSpace;
{ Default value for the @link(TKPreviewColors.Border) color property. }
cBorderDef = clBlack;
{ Default value for the @link(TKPreviewColors.SelectedBorder) color property. }
cSelectedBorderDef = clNavy;
{ Index for the @link(TKPreviewColors.Paper) property. }
ciPaper = TKPreviewColorIndex(0);
{ Index for the @link(TKPreviewColors.BkGnd) property. }
ciBkGnd = TKPreviewColorIndex(1);
{ Index for the @link(TKPreviewColors.Border) property. }
ciBorder = TKPreviewColorIndex(2);
{ Index for the @link(TKPreviewColors.SelectedBorder) property. }
ciSelectedBorder = TKPreviewColorIndex(3);
{ Maximum color array index }
ciPreviewColorsMax = ciSelectedBorder;
{ Constant for control scrollbars. It means: Leave that scrollbar untouched. }
cScrollNoAction = -1;
{ Constant for control scrollbars. It means: Use given Delta to update scrollbar. }
cScrollDelta = -2;
{ Internal flag for TKPrintPreview. }
cPF_Dragging = $00000001;
{ Internal flag for TKPrintPreview. }
cPF_UpdateRange = $00000002;
type
{ Declares possible values for the @link(ScaleMode) property }
TKPreviewScaleMode = (
{ Apply scale defined by the @link(Scale) property }
smScale,
{ Scale the page so that it horizontally fits to the window client area }
smPageWidth,
{ Scale the page so that it fits to the window client area }
smWholePage);
{ @abstract(Declares @link(TKPrintPreview.OnChanged) event handler)