Module cSigCJColorPicker.pkg

     1//==============================================================================
     2// Project      : SigCj - VDF Classes for Codejock
     3// File         : cSigCJColorPicker.pkg
     4// Description  : VDF Class for Codejock control
     5//
     6// Revision     : $Rev: 675 $
     7//                $Date: 2011-02-23 10:51:39 -0500 (Wed, 23 Feb 2011) $
     8//                $Author: martin $ Martin Pincott
     9//
    10// Requirements : Visual DataFlex 12.1+
    11//                Codejock SuitePro - Version 12.0.0+
    12//
    13// Copyright    : (c) 2008 VDF SIG UK
    14//                Visual DataFlex Special Interest Group UK.
    15//                http://www.vdfsig.co.uk/
    16//                dev@vdfsig.co.uk
    17//
    18//                This file is part of SigCj.
    19//
    20//                SigCj is free software: you can redistribute it and/or modify
    21//                it under the terms of the GNU Lesser General Public License
    22//                as published by the Free Software Foundation, either version
    23//                2.1 of the License, or (at your option) any later version.
    24//
    25//                SigCj is distributed in the hope that it will be useful, but
    26//                WITHOUT ANY WARRANTY; without even the implied warranty of
    27//                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    28//                GNU Lesser General Public License for more details.
    29//
    30//                If you have the complete SigCj workspace then a copy of the
    31//                GNU Lesser General Public License is in the Docs folder. If
    32//                not, see <http://www.gnu.org/licenses/>.
    33//
    34//==============================================================================
    35// Contributions
    36// =============
    37//
    38// When       Who          What
    39// ========== ============ =====================================================
    40// 2009-01-09 Nick Wright  Added Full Class Support - Original Implementation
    41//
    42//==============================================================================
    43
    44Use SigCjW_Controls.pkg
    45Use cSigCJMethods_Mixin.pkg
    46Use StdFont.pkg
    47
    48//Appearance
    49{ OverrideProperty=Label_Col_Offset          DesignTime=False }
    50{ OverrideProperty=Label_Justification_Mode  DesignTime=False }
    51{ OverrideProperty=Label_Row_Offset          DesignTime=False }
    52{ OverrideProperty=piMinSize                 DesignTime=False }
    53{ OverrideProperty=Border_Style              DesignTime=False }
    54{ OverrideProperty=Color                     DesignTime=False }
    55{ OverrideProperty=TextColor                 DesignTime=False }
    56{ OverrideProperty=Visible_State             DesignTime=False }
    57//Behaviour
    58{ OverrideProperty=Attach_Parent_State       DesignTime=False }
    59{ OverrideProperty=Block_Mouse_State         DesignTime=False }
    60{ OverrideProperty=Client_Area_State         DesignTime=False }
    61{ OverrideProperty=Delegation_Mode           DesignTime=False }
    62{ OverrideProperty=Focus_Mode                DesignTime=False }
    63{ OverrideProperty=pbBindValue               DesignTime=False }
    64{ OverrideProperty=peAutoCreate              DesignTime=False }
    65{ OverrideProperty=peNeighborhood            DesignTime=False }
    66{ OverrideProperty=Popup_State               DesignTime=False }
    67{ OverrideProperty=Ring_State                DesignTime=False }
    68{ OverrideProperty=Scope_State               DesignTime=False }
    69{ OverrideProperty=Search_Case               DesignTime=False }
    70{ OverrideProperty=Skip_State                DesignTime=False }
    71
    72{ OverrideProperty=Help_Id                   DesignTime=False }
    73{ OverrideProperty=Help_Keyword              DesignTime=False }
    74{ OverrideProperty=psHtmlHelpTopic           DesignTime=False }
    75{ OverrideProperty=Status_Help               DesignTime=False }
    76{ OverrideProperty=Use_Parent_Status_Help    DesignTime=False }
    77{ OverrideProperty=psLicenseKey              DesignTime=False }
    78{ OverrideProperty=psProgID                  DesignTime=False }
    79Class cSigCJColorPicker is a cSigCjComColorPicker
    80    Import_Class_Protocol cSigCJMethods_Mixin
    81
    82    Procedure Construct_Object
    83        Forward Send Construct_Object
    84
    85        { DesignTime=False }
    86        Property OLE_Color Private_piDefaultColor clBlack
    87
    88        { DesignTime=False }
    89        Property OLE_Color Private_piSelectedColor clBlack
    90
    91        { DesignTime=False }
    92        Property OLE_Color Private_piBackColor clBlack // to see back Color turn off transparent_state
    93
    94        { DesignTime=False }
    95        Property String Private_psCaption ''
    96
    97        { DesignTime=False }
    98        Property Boolean Private_pbEnabled True
    99
   100        { DesignTime=False }
   101        Property Boolean Private_pbTransparent True // this gives a smooth edge by hiding back Color
   102
   103        { DesignTime=False }
   104        Property Boolean Private_pbFlatStyle False
   105
   106        { DesignTime=False }
   107        Property Boolean Private_pbUseVisualStyle True
   108
   109        { DesignTime=False }
   110        Property Integer Private_peAppearance OLExtpAppearanceStandard
   111
   112        { DesignTime=False }
   113        Property Boolean Private_pbShowAutomaticColor True
   114
   115        { DesignTime=False }
   116        Property Boolean Private_pbShowMoreColors True
   117
   118        // Font Properties
   119        { DesignTime=False }
   120        Property Boolean Private_pbBold False
   121
   122        { DesignTime=False }
   123        Property Boolean Private_pbItalic False
   124
   125        { DesignTime=False }
   126        Property Boolean Private_pbStrikethrough False
   127
   128        { DesignTime=False }
   129        Property Boolean Private_pbUnderline False
   130
   131        { DesignTime=False }
   132        Property String Private_psFontName "MS Sans Serif"
   133
   134        { DesignTime=False }
   135        Property Number Private_pnFontSize 8.25
   136
   137        { DesignTime=False }
   138        Property Handle Private_hoFont  (Create(Self, U_cComStdFont))
   139    End_Procedure
   140
   141    Procedure OnCreate
   142        Handle hoFont
   143
   144        Forward Send OnCreate
   145
   146        Set peAppearance            to (Private_peAppearance(Self))
   147        Set piBackColor             to (Private_piBackColor(Self))
   148        Set psCaption               to (Private_psCaption(Self))
   149        Set piDefaultColor          to (Private_piDefaultColor(Self))
   150        Set pbEnabled_state         to (Private_pbEnabled(Self))
   151        Set pbFlatStyle             to (Private_pbFlatStyle(Self))
   152        Set piSelectedColor         to (Private_piSelectedColor(Self))
   153        Set pbShowAutomaticColor    to (Private_pbShowAutomaticColor(Self))
   154        Set pbShowMoreColors        to (Private_pbShowMoreColors(Self))
   155        Set pbTransparent_State     to (Private_pbTransparent(Self))
   156        Set pbUseVisualStyle        to (Private_pbUseVisualStyle(Self))
   157
   158        //Connect the OCX and dataflex FONT objects and set defaults
   159        Get Private_hoFont   to hoFont
   160        Set pvComObject      of hoFont to (ComFont(Self))
   161        Set ComBold          of hoFont to (Private_pbBold(Self))
   162        Set ComItalic        of hoFont to (Private_pbItalic(Self))
   163        Set ComStrikethrough of hoFont to (Private_pbStrikethrough(Self))
   164        Set ComUnderline     of hoFont to (Private_pbUnderline(Self))
   165        Set ComName          of hoFont to (Private_psFontName(Self))
   166        Set ComSize          of hoFont to (Private_pnFontSize(Self))
   167    End_Procedure
   168
   169    //-------------------------------------------------------------------------
   170
   171    { MethodType=Property Category="Font" InitialValue=False }
   172    Procedure Set pbBold Boolean bState
   173        Set SigCJProperty Set_Private_pbBold Set_ComBold (Private_hoFont(Self)) to bState
   174    End_Procedure
   175
   176    Function pbBold Returns Boolean
   177        Function_Return (SigCJProperty(Self, Get_Private_pbBold, Get_ComBold, Private_hoFont(Self)))
   178    End_Function
   179
   180    //-------------------------------------------------------------------------
   181
   182    { MethodType=Property Category="Font" InitialValue=False }
   183    Procedure Set pbItalic Boolean bState
   184        Set SigCJProperty Set_Private_pbItalic Set_ComItalic (Private_hoFont(Self)) to bState
   185    End_Procedure
   186
   187    Function pbItalic Returns Boolean
   188        Function_Return (SigCJProperty(Self, Get_Private_pbItalic, Get_ComItalic, Private_hoFont(Self)))
   189    End_Function
   190
   191    //-------------------------------------------------------------------------
   192
   193    { MethodType=Property Category="Font" InitialValue=False }
   194    Procedure Set pbStrikethrough Boolean bState
   195        Set SigCJProperty Set_Private_pbStrikethrough Set_ComStrikethrough (Private_hoFont(Self)) to bState
   196    End_Procedure
   197
   198    Function pbStrikethrough Returns Boolean
   199        Function_Return (SigCJProperty(Self, Get_Private_pbStrikethrough, Get_ComStrikethrough, Private_hoFont(Self)))
   200    End_Function
   201
   202    //-------------------------------------------------------------------------
   203
   204    { MethodType=Property Category="Font" InitialValue=False }
   205    Procedure Set pbUnderline Boolean bState
   206        Set SigCJProperty Set_Private_pbUnderline Set_ComUnderline (Private_hoFont(Self)) to bState
   207    End_Procedure
   208
   209    Function pbUnderline Returns Boolean
   210        Function_Return (SigCJProperty(Self, Get_Private_pbUnderline, Get_ComUnderline, Private_hoFont(Self)))
   211    End_Function
   212
   213    //-------------------------------------------------------------------------
   214
   215    { MethodType=Property Category="Font" InitialValue="MS Sans Serif" }
   216    Procedure Set psFontName String sName
   217        Set SigCJProperty Set_Private_psFontName Set_ComName (Private_hoFont(Self)) to sName
   218    End_Procedure
   219
   220    Function psFontName Returns String
   221        Function_Return (SigCJProperty(Self, Get_Private_psFontName, Get_ComName, Private_hoFont(Self)))
   222    End_Function
   223
   224    //-------------------------------------------------------------------------
   225
   226    { MethodType=Property Category="Font" InitialValue=8.25 }
   227    Procedure Set pnFontSize Number nSize
   228        Set SigCJProperty Set_Private_pnFontSize Set_ComSize (Private_hoFont(Self)) to nSize
   229    End_Procedure
   230
   231    Function pnFontSize Returns Number
   232        Function_Return (SigCJProperty(Self, Get_Private_pnFontSize, Get_ComSize, Private_hoFont(Self)))
   233    End_Function
   234
   235    //--------------------------------------------------------------------------------------------------
   236
   237    { MethodType=Property Category="CodeJock" PropertyType=Color InitialValue=clBlack }
   238    Procedure Set piDefaultColor OLE_Color iColor
   239        Set SigCJProperty Set_Private_piDefaultColor Set_ComDefaultColor  to iColor
   240    End_Procedure
   241
   242    Function piDefaultColor Returns OLE_Color
   243        Function_Return (SigCJProperty(Self, Get_Private_piDefaultColor, Get_ComDefaultColor ))
   244    End_Function
   245
   246    //--------------------------------------------------------------------------------------------------
   247
   248    { MethodType=Property Category="CodeJock" PropertyType=Color InitialValue=clBlack }
   249    Procedure Set piSelectedColor OLE_Color iColor
   250        Set SigCJProperty Set_Private_piSelectedColor Set_ComSelectedColor  to iColor
   251    End_Procedure
   252
   253    Function piSelectedColor Returns OLE_Color
   254        Function_Return (SigCJProperty(Self, Get_Private_piSelectedColor, Get_ComSelectedColor ))
   255    End_Function
   256
   257    //--------------------------------------------------------------------------------------------------
   258
   259    { MethodType=Property Category="Appearance" PropertyType=Color InitialValue=clBlack }
   260    Procedure Set piBackColor OLE_Color iColor
   261        Set SigCJProperty Set_Private_piBackColor Set_ComBackColor  to iColor
   262    End_Procedure
   263
   264    Function piBackColor Returns OLE_Color
   265        Function_Return (SigCJProperty(Self, Get_Private_piBackColor, Get_ComBackColor ))
   266    End_Function
   267
   268    //--------------------------------------------------------------------------------------------------
   269
   270    { MethodType=Property Category="CodeJock" InitialValue="" }
   271    Procedure Set psCaption String sCaption
   272        Set SigCJProperty Set_Private_psCaption Set_ComCaption  to sCaption
   273    End_Procedure
   274
   275    Function psCaption Returns String
   276        Function_Return (SigCJProperty(Self, Get_Private_psCaption, Get_ComCaption ))
   277    End_Function
   278
   279    //--------------------------------------------------------------------------------------------------
   280
   281    { MethodType=Property Category="Appearance" InitialValue=True }
   282    Procedure Set pbEnabled_State Boolean bState
   283        Set SigCJProperty Set_Private_pbEnabled Set_ComEnabled to bState
   284    End_Procedure
   285
   286    Function pbEnabled_State Returns Boolean
   287        Function_Return (SigCJProperty(Self, Get_Private_pbEnabled, Get_ComEnabled))
   288    End_Function
   289
   290    //--------------------------------------------------------------------------------------------------
   291
   292    { MethodType=Property Category="Appearance" InitialValue=True }
   293    Procedure Set pbTransparent_State Boolean bState
   294        Set SigCJProperty Set_Private_pbTransparent Set_ComTransparent to bState
   295    End_Procedure
   296
   297    Function pbTransparent_State Returns Boolean
   298        Function_Return (SigCJProperty(Self, Get_Private_pbTransparent, Get_ComTransparent))
   299    End_Function
   300
   301    //-------------------------------------------------------------------------
   302
   303    { MethodType=Property Category="CodeJock" InitialValue=False }
   304    Procedure Set pbFlatStyle Boolean bState
   305        Set SigCJProperty Set_Private_pbFlatStyle Set_ComFlatStyle to bState
   306    End_Procedure
   307
   308    Function pbFlatStyle Returns Boolean
   309        Function_Return (SigCJProperty(Self, Get_Private_pbFlatStyle, Get_ComFlatStyle ))
   310    End_Function
   311
   312    //-------------------------------------------------------------------------
   313
   314    { MethodType=Property Category="CodeJock" InitialValue=True }
   315    Procedure Set pbUseVisualStyle Boolean bState
   316        Set SigCJProperty Set_Private_pbUseVisualStyle Set_ComUseVisualStyle to bState
   317    End_Procedure
   318
   319    Function pbUseVisualStyle Returns Boolean
   320        Function_Return (SigCJProperty(Self, Get_Private_pbUseVisualStyle, Get_ComUseVisualStyle ))
   321    End_Function
   322
   323    //-------------------------------------------------------------------------
   324
   325    #IF (SigCj_Codejock_Version < 150001) 
   326        { MethodType=Property Category="CodeJock" InitialValue=OLExtpAppearanceStandard }
   327        { EnumList="OLExtpAppearanceStandard, OLExtpAppearanceFlat, OLExtpAppearanceUltraFlat, OLExtpAppearanceOffice2000, OLExtpAppearanceOffice2000, OLExtpAppearanceOffice2003, OLExtpAppearanceOffice2007" }
   328    #ELSE    
   329        { MethodType=Property Category="CodeJock" InitialValue=OLExtpAppearanceStandard }
   330        { EnumList="OLExtpAppearanceStandard, OLExtpAppearanceFlat, OLExtpAppearanceUltraFlat, OLExtpAppearanceOffice2000, OLExtpAppearanceOffice2000, OLExtpAppearanceOffice2003, OLExtpAppearanceResource" }
   331    #ENDIF 
   332    Procedure Set peAppearance Integer eAppearance
   333        Set SigCJProperty Set_Private_peAppearance Set_ComAppearance to eAppearance
   334    End_Procedure
   335
   336    Function peAppearance Returns Integer
   337        Function_Return (SigCJProperty(Self, Get_Private_peAppearance, Get_ComAppearance ))
   338    End_Function
   339
   340    //--------------------------------------------------------------------------------------------------
   341
   342    { MethodType=Property Category="CodeJock" InitialValue=True }
   343    Procedure Set pbShowAutomaticColor  Boolean bState
   344        Set SigCJProperty Set_Private_pbShowAutomaticColor Set_ComShowAutomaticColor to bState
   345    End_Procedure
   346
   347    Function pbShowAutomaticColor Returns Boolean
   348        Function_Return (SigCJProperty(Self, Get_Private_pbShowAutomaticColor, Get_ComShowAutomaticColor))
   349    End_Function
   350
   351    //--------------------------------------------------------------------------------------------------
   352
   353    { MethodType=Property Category="CodeJock" InitialValue=True }
   354    Procedure Set pbShowMoreColors  Boolean bState
   355        Set SigCJProperty Set_Private_pbShowMoreColors Set_ComShowMoreColors to bState
   356    End_Procedure
   357
   358    Function pbShowMoreColors Returns Boolean
   359        Function_Return (SigCJProperty(Self, Get_Private_pbShowMoreColors, Get_ComShowMoreColors))
   360    End_Function
   361
   362    //--------------------------------------------------------------------------------------------------
   363
   364    // EVENTS
   365
   366    //--------------------------------------------------------------------------------------------------
   367
   368    // Hook for OnClick
   369    Procedure OnClick
   370    End_Procedure
   371
   372    Procedure OnComClick
   373        Send OnClick
   374    End_Procedure
   375
   376    //Standardised Hook for OnMouseDown
   377    Procedure OnMouseDown Integer eButton Integer x Integer y Integer fKeys
   378    End_Procedure
   379
   380    Procedure OnComMouseDown Short llButton Short llShift OLE_XPOS_PIXELS llx OLE_YPOS_PIXELS lly
   381        Send OnMouseDown llButton llx lly llShift
   382    End_Procedure
   383
   384    // Hook for OnMouseMove
   385    Procedure OnMouseMove Integer eButton Integer x Integer y Integer fKeys
   386    End_Procedure
   387
   388    Procedure OnComMouseMove Short llButton Short llShift OLE_XPOS_PIXELS llx OLE_YPOS_PIXELS lly
   389        Send OnMouseMove llbutton llx lly llShift
   390    End_Procedure
   391
   392    //Standardised Hook for OnMouseUp
   393    Procedure OnMouseUp Integer eButton Integer x Integer y Integer fKeys
   394    End_Procedure
   395
   396    Procedure OnComMouseUp Short llButton Short llShift OLE_XPOS_PIXELS llx OLE_YPOS_PIXELS lly
   397        Send OnMouseUp llButton llx lly llShift
   398    End_Procedure
   399
   400    // Hook for OnKeyDown
   401    Procedure OnKeyDown Short ByRef llKeyCode Short llShift
   402    End_Procedure
   403
   404    Procedure OnComKeyDown Short ByRef llKeyCode Short llShift
   405        Send OnKeyDown (&llKeyCode) llShift
   406    End_Procedure
   407
   408    // Hook for OnKeyPress
   409    Procedure OnKeyPress Short ByRef llKeyAscii
   410    End_Procedure
   411
   412    Procedure OnComKeyPress Short ByRef llKeyAscii
   413        Send OnKeyPress (&llKeyAscii)
   414    End_Procedure
   415
   416    // Hook for OnKeyUp
   417    Procedure OnKeyUp Short ByRef llKeyCode Short llShift
   418    End_Procedure
   419
   420    Procedure OnComKeyUp Short ByRef llKeyCode Short llShift
   421        Send onkeyup (&llKeyCode) llShift
   422    End_Procedure
   423End_Class
   424
   425//==============================================================================
   426//End of Package - cSigCJColorPicker.pkg
   427//==============================================================================
   428