home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Freeware / Programare / alite / D5 / sConst.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-06-25  |  14.4 KB  |  424 lines

  1. // Unit sConst contains the basic types, constants and variables, used in AlphaControls
  2. unit sConst;
  3. {$I sDefs.inc}
  4.  
  5. interface
  6.  
  7. uses Graphics, Messages, Windows, comctrls, ExtCtrls, controls, classes, Buttons;
  8.  
  9. type
  10.   TAOR = array of Windows.TRect;
  11.   TsDisabledGlyphKind = set of (dgBlended, dgGrayed);
  12.   TsDisabledKind = set of (dkBlended, dkGrayed);
  13.   TsCollectionNotification = (cnAdded, cnExtracting, cnDeleting);
  14.  
  15. // Scrollbars HitTest results
  16. const
  17.   HTSB_LEFT_BUTTON = 100;
  18.   HTSB_RIGHT_BUTTON = 101;
  19.   HTSB_TOP_BUTTON = 102;
  20.   HTSB_BOTTOM_BUTTON = 103;
  21.   HTSB_H_SCROLL = 104;
  22.   HTSB_HB_SCROLL = 105;
  23.   HTSB_V_SCROLL = 106;
  24.   HTSB_VB_SCROLL = 107;
  25.  
  26.   { WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes for MDI form}
  27.   HTCHILDCLOSE       = 101;
  28.   HTCHILDMAX         = 102;
  29.   HTCHILDMIN         = 103; 
  30.  
  31.   NoColorSelected = TColor($FF000000);
  32.   
  33. var
  34.   ThemeLoading : boolean = False;
  35.  
  36. type
  37.  
  38.   TsSkinName = string;
  39.   TsDirectory = string;
  40.   TsSkinSection = string;
  41.  
  42.   TsPredefinedBorders = (pdBorder1, pdBorder2, pdBorder3, pdBorder4, pdBorder5, pdBorder6, pdCustom);
  43.  
  44.   TFadeDirection = (fdNone, fdUp, fdDown);
  45.  
  46.   TCacheInfo = record
  47.     Bmp : Graphics.TBitmap;
  48.     X : integer;
  49.     Y : integer;
  50.     Ready : boolean;
  51.   end;
  52.  
  53.   TsHackedControl = class(TControl)
  54.   public
  55.     procedure WndProc(var Message: TMessage); override;
  56.     procedure Invalidate; override;
  57.     property ParentColor;
  58.     property Color;
  59.     property PopupMenu;
  60.   end;
  61.  
  62.   // Definition for IDE property editor
  63.   TsGradientData = string[255];
  64.   // Border styles for SStyle editors
  65.   TsEditorBevel = (ebNone, ebRaised, ebLowered, ebAsTopBorder, ebAsBottomBorder);
  66.   // Border styles for SStyle controls
  67.   TsControlBevel = (cbNone, cbRaisedSoft, cbLoweredSoft, cbRaisedHard, cbLoweredHard);
  68.  
  69.   TsButtonStyle = (sbNone, sbFlat, sbNormal);
  70.   { Styles of hints - (hsSimply, hsExtended, hsEllipse, hsStandard, hsNone)}
  71.   TsHintStyle = (hsSimply, hsComics, hsEllipse, hsBalloon, hsStandard, hsNone);
  72.   TsHintsPredefinitions = (shSimply, shGradient, shTransparent, shEllipse, shBalloon, shComicsGradient, shComicsTransparent, shStandard, shNone, shCustom);
  73.   { Layouts for controls captions - (sclLeft, sclTopLeft, sclTopCenter, sclTopRight). Used in TsStyle pack}
  74.   TsCaptionLayout = (sclLeft, sclTopLeft, sclTopCenter, sclTopRight);
  75.   { Layouts for TsRadioButtons and TsCheckButtons - (calLeft, calRight). Used in TsStyle pack}
  76.   TCheckAreaLayout = (calLeft, calRight);
  77.   { Background styles - (bgsNone, bgsImage, bgsGradient, bgsTransparent)}
  78.   TBgStyle = (bgsNone, bgsImage, bgsGradient, bgsTransparent);
  79.   { Shapes of the shadows (ssRectangle, ssEllipse). Used in TsStyle pack}
  80.   TsShadowingShape = (ssRectangle, ssEllipse);
  81.   { Types of the gradients painting - (gtTopBottom, gtLeftRight, gtAsBorder)}
  82.   TGradientTypes = (gtTopBottom, gtLeftRight, gtAsBorder);
  83.   { Set selection modes for controls - (msBorder, msColor);//, msShadow)}
  84.   TModeSelection = set of (msBorder, msColor);//, msShadow);
  85.   { Style of borders painting - (bsRaised, bsLowered, bsFlat1, bsFlat2)}
  86.   TsBorderStyle = (bsRaised, bsLowered, bsFlat1, bsFlat2);
  87.   { Mode of the gradient width calculations. When gmFixed - width of gradient fixed. If gmPersent - width of gradient as percent from width of control}
  88.   TsGradientMode = (//gmAuto,  // width of both gradient established for control complete having filled
  89.                     gmFixed,   // width established in pixels
  90.                     gmPercent);// width established in percents of control size
  91.   { Set of days of week. Used in TsStyle pack}
  92.   TDaysOfWeek = set of TCalDayOfWeek;
  93.   { Order of date representation - (doMDY, doDMY, doYMD). Used in TsStyle pack}
  94.   TDateOrder = (doMDY, doDMY, doYMD);
  95.   { Set of control sides - (sdLeft, sdTop, sdRight, sdBottom, sdTL, sdTR, sdBL, sdBR). Used in TsStyle pack}
  96.   TsSide = (sdLeft, sdTop, sdRight, sdBottom, sdTL, sdTR, sdBL, sdBR);
  97.   { Set of window_show types. Used in TsStyle pack}
  98.   TsWindowShowMode = (soHide, soNormal, soShowMinimized, soMaximize, soShowNoActivate,
  99.                   soShow, soMinimize, soShowMinNoActive, soShowNA, soRestore, soDefault);
  100.   { Set of popup window alignes - (pwaRight, pwaLeft). Used in TsStyle pack}
  101.   TPopupWindowAlign = (pwaRight, pwaLeft);
  102.   { Set of button glyph kindes - (gkCustom, gkDefault, gkDropDown, gkEllipsis). Used in TsStyle pack}
  103.   TGlyphKind = (gkCustom, gkDefault, gkDropDown, gkEllipsis);
  104.   TsWhatOperate = (swoForm, swoApplication);
  105.  
  106.   { Local definition of TRect}
  107.   TsRect = TRect;
  108.   { Record, that have some ways for color representation : TColor, four bytes or integer)}
  109.   TsColor = record
  110.     case integer of
  111.       0  : (C : TColor);
  112.       1  : (R, G, B, A : Byte);
  113.       2  : (I : integer);
  114.     end;
  115.  
  116.   { Pointer to @link(TPoints)}
  117.   PPoints = ^TPoints;
  118.   { Array of TPoint}
  119.   TPoints = array[0..0] of TPoint;
  120.  
  121.   TsRGB = packed record
  122.     B: Byte;
  123.     G: Byte;
  124.     R: Byte;
  125.   end;
  126.   PRGBArray = ^TRGBArray;
  127.   TRGBArray = array[0..100000] of TsRGB;
  128.  
  129.   TsRGBA = packed record
  130.     B: Byte;
  131.     G: Byte;
  132.     R: Byte;
  133.     A: Byte;
  134.   end;
  135.   PRGBAArray = ^TRGBAArray;
  136.   TRGBAArray = array[0..100000] of TsRGBA;
  137.  
  138.   { Set of 1..100}
  139.   TPercent = 0..100;
  140.   { Set of SStyle controls codes (1..255)}
  141.   TsCodes = set of 1..255;//[COC_TsEdit..COC_Unknown]
  142.  
  143. var
  144.   EmptyCI : TCacheInfo;
  145.  
  146. const
  147.  
  148.   // Borders
  149.   aPredefinedBorders : array [0..6] of TsPredefinedBorders = (pdBorder1, pdBorder2, pdBorder3, pdBorder4, pdBorder5, pdBorder6, pdCustom);
  150.   // Internal constant for border paitning
  151.   BevSoftness = 0.5;
  152.   // Array of @link(TsBorderStyle)
  153.   BevelsArray : array [0..3] of TsBorderStyle = (bsRaised, bsLowered, bsFlat1, bsFlat2);
  154.   // Array of @link(TPanelBevel)
  155.   PanelBevels : array [0..3] of TPanelBevel = (bvNone, bvLowered, bvRaised, bvSpace);
  156.   // Array of border styles for SStyle editors
  157.   aEditorBevels : array [0..4] of TsEditorBevel = (ebNone, ebRaised, ebLowered, ebAsTopBorder, ebAsBottomBorder);
  158.   // Array of border styles for SStyle controls
  159.   aControlBevels : array [0..4] of TsControlBevel = (cbNone, cbRaisedSoft, cbLoweredSoft, cbRaisedHard, cbLoweredHard);
  160.   // Array of @link(TsHintStyle)
  161.   aHintStyles : array [0..5] of TsHintStyle = (hsSimply, hsComics, hsEllipse, hsBalloon, hsStandard, hsNone);
  162.   // Array of @link(TBgStyle)
  163.   aBGStyles   : array [0..3] of TBgStyle = (bgsNone, bgsImage, bgsGradient, bgsTransparent);
  164.   // Array of @link(TGradientTypes)
  165.   aGradLayouts : array [0..2] of TGradientTypes = (gtTopBottom, gtLeftRight, gtAsBorder);
  166.   aGlyphLayouts : array [0..3] of TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
  167.   // Array of boolean strings - ('False', 'True')
  168.   Bool : array [0..1] of string = ('False', 'True');
  169.   // Array of TAlignment
  170.   TextAligns : array [0..2] of TAlignment = (taLeftJustify, taCenter, taRightJustify);
  171.   asHintsPredefinitions : array [0..9] of TsHintsPredefinitions = (shSimply, shGradient, shTransparent, shEllipse, shBalloon, shComicsGradient, shComicsTransparent, shStandard, shNone, shCustom);
  172.   // Null date
  173.   NullDate: TDateTime = 0;
  174.  
  175.   COC_TsCustom              = 1;
  176.   COC_TsSpinEdit            = 2;
  177.  
  178.   COC_TsEdit                = 3;
  179.   COC_TsCustomMaskEdit      = 4;
  180.   COC_TsMemo                = 7;
  181.   COC_TsCustomListBox       = 8;
  182.   COC_TsListBox             = 8;
  183.  
  184.   COC_TsColorBox            = 9;
  185.   COC_TsListView            = 10;
  186.  
  187.   COC_TsCustomComboBox      = 11;
  188.   COC_TsIBComboBox          = 12;
  189.   COC_TsComboBox            = 13;
  190.   COC_TsADOComboBox         = 14;
  191.   COC_TsBDEComboBox         = 15;
  192.   COC_TsComboBoxEx          = 18;
  193.  
  194.   COC_TsCheckedControl      = 31;
  195.   COC_TsCheckBox            = 32;
  196.   COC_TsDBCheckBox          = 32;
  197.   COC_TsRadioButton         = 33;
  198.  
  199.   COC_TsCurrencyEdit        = 41;
  200.  
  201.   COC_TsPanel               = 51;
  202.   COC_TsContainer           = 52;
  203.   COC_TsGlassPanel          = 53;
  204.   COC_TsToolBar             = 54;
  205.   COC_TsTransparentPanel    = 55;
  206.   COC_TsDragBar             = 56;
  207.   COC_TsTabSheet            = 57;
  208.   COC_TsScrollBox           = 58;
  209.   COC_TsCustomPanel         = 68;
  210.   COC_TsGrip                = 73;
  211.   COC_TsGroupBox            = 74;
  212.   COC_TsSplitter            = 75;
  213.  
  214.   // DB-aware controls
  215.   COC_TsDBEdit              = 76;
  216.   COC_TsDBMemo              = 78;
  217.   COC_TsDBComboBox          = 81;
  218.   COC_TsDBLookupComboBox    = 82;
  219.   COC_TsDBListBox           = 83;
  220.   COC_TsDBLookupListBox     = 84;
  221.   // -------------- >>
  222.  
  223.   COC_TsButtonControl       = 91;
  224.   COC_TsSpeedButton         = 92;
  225.   COC_TsButton              = 93;
  226.   COC_TsBitButton           = 94;
  227.   COC_TsColorSelect         = 95;
  228.   COC_TsTreeView            = 96;
  229.  
  230.   { @EXCLUDE}
  231.   COC_TsBevel               = 110;
  232.  
  233. {!  COC_TsImage               = 701;}
  234.  
  235.   { @EXCLUDE}
  236.   COC_TsCustomComboEdit     = 131;
  237.   { @EXCLUDE}
  238.   COC_TsFileDirEdit         = 132;
  239.   { @EXCLUDE}
  240.   COC_TsFilenameEdit        = 133;
  241.   { @EXCLUDE}
  242.   COC_TsDirectoryEdit       = 134;
  243.   { @EXCLUDE}
  244.   COC_TsCustomDateEdit      = 137;
  245.   { @EXCLUDE}
  246.   COC_TsComboEdit           = 138;
  247.   { @EXCLUDE}
  248.   COC_TsDateEdit            = 140;
  249.  
  250.   { @EXCLUDE}
  251.   COC_TsPageControl         = 141;
  252.   COC_TsScrollBar           = 142;
  253.   COC_TsTabControl          = 141;
  254.  
  255.   { @EXCLUDE}
  256.   COC_TsStatusBar           = 151;
  257.  
  258.   { @EXCLUDE}
  259.   COC_TsGauge               = 161;
  260.   { @EXCLUDE}
  261.   COC_TsTrackBar            = 165;
  262.  
  263.   { @EXCLUDE}
  264.   COC_TsHintManager         = 211;
  265.  
  266.  
  267.   COC_TsCustomMenuManager   = 221;
  268.   COC_TsMenuManager         = 222;
  269.   COC_TsSkinProvider        = 224;
  270.   COC_TsMDIForm             = 225;
  271.  
  272.   COC_Unknown               = 250;
  273.  
  274.   // Codes of SStyle components, who don't have shadow
  275.   sNoShadow : TsCodes = [COC_TsStatusBar, COC_TsGroupBox, COC_TsBevel,
  276.                          COC_TsTabSheet, COC_TsPageControl
  277.                         ];
  278.  
  279.   // Codes of SStyle components, who have sBackgrounds
  280.   sHaveBG :   TsCodes = [COC_TsPanel..COC_TsCustomPanel,
  281.                          COC_TsStatusBar,
  282.                          COC_TsGauge,
  283.                          COC_TsTrackBar,
  284.                          COC_TsPageControl,
  285.                          COC_TsButtonControl..COC_TsColorSelect
  286.                         ];
  287.  
  288.   // Codes of SStyle components, who can be parent
  289.   sCanBeParent : TsCodes = [COC_TsPanel..COC_TsCustomPanel,
  290.                              COC_TsStatusBar
  291.                            ];
  292.   // Codes of SStyle components, who have simple(rectangular) region
  293.   sSimplyRegion : TsCodes = [COC_TsRadioButton, COC_TsCheckBox, COC_TsTrackBar,
  294.                              COC_TsComboBox, COC_TsListView, COC_TsStatusBar,
  295.                              COC_TsTreeView, COC_TsGauge
  296.                             ];
  297.   // Codes of SStyle components, who can be parent
  298.   sCanBeRounded : TsCodes = [1 .. 140, 150 .. 200
  299.                             ];
  300.  
  301.   // Codes of SStyle components, who don't catch mouse events
  302.   sForbidMouse : TsCodes = [COC_TsPanel..COC_TsGroupBox, COC_TsBevel, COC_TsPageControl..COC_TsGauge];
  303.  
  304.   { @EXCLUDE Colors}
  305.   clInfoBk16         = TColor($02E1FFFF);
  306.   { @EXCLUDE}
  307.   clNone16           = TColor($02FFFFFF);
  308.  
  309.   { @EXCLUDE Red}
  310.   scDarkRed          = TColor(Longint($00292163));
  311.   { @EXCLUDE}
  312.   scRed              = TColor(Longint($009C9ADA));
  313.   { @EXCLUDE}
  314.   scLightRed         = TColor(Longint($00DAD9F2));
  315.   { @EXCLUDE Orange}
  316.   scDarkOrange       = TColor(Longint($00094D71));
  317.   { @EXCLUDE}
  318.   scOrange           = TColor(Longint($009AC1E2));
  319.   { @EXCLUDE}
  320.   scLightOrange      = TColor(Longint($00ECE8F7));
  321.   { @EXCLUDE Yellow}
  322.   scDarkYellow       = TColor(Longint($002C848D));
  323.   { @EXCLUDE}
  324.   scYellow           = TColor(Longint($00B6DBDC));
  325.   { @EXCLUDE}
  326.   scLightYellow      = TColor(Longint($00ECFFFF));
  327.   { @EXCLUDE Green}
  328.   scDarkGreen        = TColor(Longint($00385937));
  329.   { @EXCLUDE}
  330.   scGreen            = TColor(Longint($00ACC4AE));
  331.   { @EXCLUDE}
  332.   scLightGreen       = TColor(Longint($00DEF5E1));
  333.   { @EXCLUDE Sky}
  334.   scDarkSky          = TColor(Longint($007D6B42));
  335.   { @EXCLUDE}
  336.   scSky              = TColor(Longint($00C0B798));
  337.   { @EXCLUDE}
  338.   scLightSky         = TColor(Longint($00E2E0D3));
  339.   { @EXCLUDE Blue}
  340.   scDarkBlue         = TColor(Longint($007D5415));
  341.   { @EXCLUDE}
  342.   scBlue             = TColor(Longint($00CFB78F));
  343.   { @EXCLUDE}
  344.   scLightBlue        = TColor(Longint($00EFEDE4));
  345.   { @EXCLUDE Violet}
  346.   scDarkViolet       = TColor(Longint($006C4124));
  347.   { @EXCLUDE}
  348.   scViolet           = TColor(Longint($00D8BDBA));
  349.   { @EXCLUDE}
  350.   scLightViolet      = TColor(Longint($00E9DAD8));
  351.   { @EXCLUDE Brown}
  352.   scDarkBrown        = TColor(Longint($00375C82));
  353.   { @EXCLUDE}
  354.   scBrown            = TColor(Longint($00AEBDC6));
  355.   { @EXCLUDE}
  356.   scLightBrown       = TColor(Longint($00DDE3E6));
  357.   { @EXCLUDE Kaki}
  358.   scDarkKaki         = TColor(Longint($00395E55));
  359.   { @EXCLUDE}
  360.   scKaki             = TColor(Longint($00B0CECB));
  361.   { @EXCLUDE}
  362.   scLightKaki        = TColor(Longint($00D9ECEC));
  363.  
  364.   { @EXCLUDE Types of sStyle}
  365.   tos_SPASSIVEPAINTSTYLE    = -2;
  366.   tos_SIMPLYSTYLE           =  1;
  367.   tos_SEDITSTYLE            =  1;
  368.   tos_SPAINTSTYLE           =  1;
  369.   tos_SPASSIVEBGSTYLE       = 12;
  370.   tos_SACTIVEBGSTYLE        = 13;
  371.   tos_SCUSTOMSTYLE          = 14;
  372.   tos_SSTYLE                = 15;
  373.   tos_SSTYLEDB              = 16;
  374.  
  375.   tos_COMMONDATA            = -2;
  376.  
  377. //  sEditors : integer = [COC_TsStatusBar, COC_TsGroupBox, COC_TsBevel,
  378.  
  379.  
  380. var
  381.   FooterColor : TsColor;
  382. {$IFDEF RUNIDEONLY}
  383.   { @EXCLUDE}
  384.   sTerminated         : boolean = False;
  385. const
  386. {$IFDEF SINGLE}
  387.   {$IFDEF TSHINTS}
  388.   { @EXCLUDE}
  389.     sIsRUNIDEONLYMessage = 'This version of sHintManager is trial. For purchase of the fully functional version please come to the http://www.alphaskins.com. Thanks!';
  390.   {$ELSE}
  391.   { @EXCLUDE}
  392.     sIsRUNIDEONLYMessage = 'This version of sMenuManager is trial. For purchase of the fully functional version please come to the http://www.alphaskins.com. Thanks!';
  393.   {$ENDIF}
  394. {$ELSE}
  395.   { @EXCLUDE}
  396.   sIsRUNIDEONLYMessage = 'This version of AlphaControls is trial. For purchase of the fully functional version please come to the http://www.alphaskins.com. Thanks!';
  397. {$ENDIF}
  398. {$ENDIF}
  399.  
  400. implementation
  401.  
  402. procedure TsHackedControl.Invalidate;
  403. begin
  404.   inherited Invalidate;
  405. end;
  406.  
  407. procedure TsHackedControl.WndProc(var Message: TMessage);
  408. begin
  409.   inherited;
  410. end;
  411.  
  412. initialization
  413.   FooterColor.C := $00DAC8A9;
  414.   
  415.   EmptyCI.Ready := False;
  416.   EmptyCI.Bmp := nil;
  417.  
  418. finalization
  419.  
  420.  
  421. end.
  422.  
  423.  
  424.