home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WCOLRDLG.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  5KB  |  146 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. #ifndef _WCOLRDLG_HPP_INCLUDED
  12. #define _WCOLRDLG_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,8);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WCOLOR_HPP_INCLUDED
  20. #  include "wcolor.hpp"
  21. #endif
  22. #ifndef _WCOMDLG_HPP_INCLUDED
  23. #  include "wcomdlg.hpp"
  24. #endif
  25. #ifndef _WARRAY_HPP_INCLUDED
  26. #  include "warray.hpp"
  27. #endif
  28.  
  29. typedef WArray< WColor >        WColorArray;
  30.  
  31. //
  32. // ColorDialog styles
  33. //
  34.  
  35. typedef WULong WCDStyle;
  36.  
  37. #define WCDSRGBInit               ((WCDStyle)0x00000001L) // CC_RGBINIT
  38. #define WCDSFullOpen              ((WCDStyle)0x00000002L) // CC_FULLOPEN
  39. #define WCDSPreventFullOpen       ((WCDStyle)0x00000004L) // CC_PREVENTFULLOPEN
  40. #define WCDSShowHelp              ((WCDStyle)0x00000008L) // CC_SHOWHELP
  41. #define WCDSEnableHook            ((WCDStyle)0x00000010L) // CC_ENABLEHOOK
  42. #define WCDSEnableTemplate        ((WCDStyle)0x00000020L) // CC_ENABLETEMPLATE
  43. #define WCDSEnableTemplateHandle  ((WCDStyle)0x00000040L) // CC_ENABLETEMPLATEHANDLE
  44. #define WCDSSolidColor            ((WCDStyle)0x00000080L) // CC_SOLIDCOLOR
  45. #define WCDSAnyColor              ((WCDStyle)0x00000100L) // CC_ANYCOLOR
  46.  
  47. // WColorDialog
  48. //
  49. //    Used to display color dialog.
  50.  
  51. class WCMCLASS WColorDialog : public WCommonDialog {
  52.     WDeclareSubclass( WColorDialog, WCommonDialog );
  53.  
  54.     public:
  55.  
  56.         /*******************************************************
  57.          * Constructors and Destructors
  58.          *******************************************************/
  59.  
  60.         WColorDialog();
  61.  
  62.         ~WColorDialog();
  63.  
  64.         /*******************************************************
  65.          * Properties
  66.          *******************************************************/
  67.  
  68.         // Color
  69.  
  70.         WColor GetColor() const;
  71.         WBool SetColor( const WColor & color );
  72.  
  73.         // CustomColorList
  74.         //
  75.         //    Set the list of colors to use in the custom color
  76.         //    section of the dialog.  The list of colors is an
  77.         //    array of 16 WColor objects.  The colors will be
  78.         //    modified as necessary and so must be read-write.
  79.  
  80.         #define WCD_NUM_COLORS 16
  81.  
  82.         WColorArray GetCustomColorList() const;
  83.         WBool SetCustomColorList( const WColorArray & list );
  84.  
  85.         // Style
  86.         //
  87.         //    Set the styles used by the file dialog.  Note that
  88.         //    the WCDSEnableHook style will ALWAYS be enabled.
  89.  
  90.         WCDStyle GetStyle() const;
  91.         WBool SetStyle( WCDStyle style );
  92.  
  93.         /*******************************************************
  94.          * Methods
  95.          *******************************************************/
  96.  
  97.         // ChangeStyle
  98.         //
  99.         //    Use to turn a specific style on or off.
  100.  
  101.         WBool ChangeStyle( WCDStyle style, WBool on );
  102.  
  103.         // Prompt
  104.         //
  105.         //    Display the dialog and wait for it to be dismissed.
  106.         //    The first form uses the current settings.  The second
  107.         //    is a convenience function.
  108.  
  109.         WBool Prompt();
  110.  
  111.         WBool Prompt( WWindow * owner, const WChar * title );
  112.  
  113.         /************************************************************
  114.          * Notifications
  115.          ************************************************************/
  116.  
  117.         void OnDialogInitialize( WWindowHandle hWnd, WWindowHandle focus );
  118.  
  119.         /************************************************************
  120.          * Others
  121.          ************************************************************/
  122.  
  123.     private:
  124.  
  125.         void * PackCC();
  126.         WBool UnpackCC( WBool ok );
  127.  
  128.         /************************************************************
  129.          * Data members
  130.          ************************************************************/
  131.  
  132.     private:
  133.  
  134.         void *          _cc;
  135.         WULong          _customColors[ 16 ];
  136.         WColorArray     _colorList;
  137.         WColor          _color;
  138. };
  139.  
  140. #ifndef _WNO_PRAGMA_PUSH
  141. #pragma enum pop;
  142. #pragma pack(pop);
  143. #endif
  144.  
  145. #endif // _WCOLRDLG_HPP_INCLUDED
  146.