home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WMENUITM.HPP < prev    next >
C/C++ Source or Header  |  1996-12-03  |  5KB  |  163 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. /*************************************************************************
  12.  *
  13.  * WMenuItem -- Wrapper for the Windows 95 Menu item control.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *      Click --
  19.  *
  20.  *      Select --
  21.  *
  22.  *       MeasureItem --
  23.  *
  24.  *       DrawItem --
  25.  *
  26.  *************************************************************************/
  27.  
  28. #ifndef _WMENUITM_HPP_INCLUDED
  29. #define _WMENUITM_HPP_INCLUDED
  30.  
  31. #ifndef _WNO_PRAGMA_PUSH
  32. #pragma pack(push,8);
  33. #pragma enum int;
  34. #endif
  35.  
  36. #ifndef _WOBJECT_HPP_INCLUDED
  37. #  include "wobject.hpp"
  38. #endif
  39. #ifndef _WSTRING_HPP_INCLUDED
  40. #  include "wstring.hpp"
  41. #endif
  42. #ifndef _WMENU_HPP_INCLUDED
  43. #  include "wmenu.hpp"
  44. #endif
  45.  
  46. class WMenuItem;
  47.  
  48. enum WMenuItemType {
  49.     WTextMenuItem               = 0x0000,
  50.     WBitmapMenuItem             = 0x0040,
  51.     WOwnerDrawnMenuItem         = 0x0100,
  52. };
  53.  
  54. class WCMCLASS WMenuItem : public WMenuObject {
  55.     WDeclareSubclass( WMenuItem, WMenuObject );
  56.  
  57.     public:
  58.  
  59.         /**********************************************************
  60.          * Constructors and Destructors
  61.          *********************************************************/
  62.  
  63.         WMenuItem();
  64.         WMenuItem( WUShort id, const WChar *text=NULL,
  65.                    const WChar *htext=NULL,
  66.                    WMenuItemType type=WTextMenuItem );
  67.     
  68.         ~WMenuItem();
  69.  
  70.         /**********************************************************
  71.          * Properties
  72.          *********************************************************/
  73.  
  74.         // Bitmap
  75.  
  76.         WBitmap GetBitmap() const;
  77.         WBool   SetBitmap( const WBitmap & bitmap );
  78.  
  79.         // CheckedBitmap
  80.  
  81.         WBitmap GetCheckedBitmap() const;
  82.         WBool   SetCheckedBitmap( const WBitmap & bitmap );
  83.  
  84.         // Checked
  85.  
  86.         WBool GetChecked() const;
  87.         WBool SetChecked( WBool checked, WBool exclusive=FALSE );
  88.  
  89.         // Default
  90.         //
  91.         //    If TRUE, the menu item is displayed as the default menu
  92.         //    item (bolded under Win95).
  93.  
  94.         WBool GetDefault() const;
  95.         WBool SetDefault( WBool isDefault );
  96.  
  97.         // Enabled
  98.  
  99.         WBool GetEnabled() const;
  100.         WBool SetEnabled( WBool enabled, WBool grayIfDisabled=TRUE );
  101.  
  102.         // Grayed
  103.  
  104.         WBool GetGrayed() const;
  105.         WBool SetGrayed( WBool grayed );
  106.  
  107.         // Type
  108.  
  109.         WMenuItemType GetType() const;
  110.         WBool         SetType( WMenuItemType type );
  111.  
  112.         // UncheckedBitmap
  113.  
  114.         WBitmap GetUncheckedBitmap() const;
  115.         WBool   SetUncheckedBitmap( const WBitmap & bitmap );
  116.  
  117.         /**********************************************************
  118.          * Methods
  119.          *********************************************************/
  120.  
  121.         // OnClick
  122.  
  123.         virtual WBool OnClick();
  124.  
  125.         // OnSelected
  126.  
  127.         virtual WBool OnSelected( WBool selected=TRUE );
  128.  
  129.         /**********************************************************
  130.          * Others
  131.          *********************************************************/
  132.  
  133.         int operator==( const WMenuItem & obj ) const;
  134.         int operator!=( const WMenuItem & obj ) const;
  135.  
  136.         /**********************************************************
  137.          * Overrides
  138.          *********************************************************/
  139.  
  140.         // Text
  141.  
  142.         virtual WString GetText();
  143.         virtual WBool   SetText( const WString & text );
  144.  
  145.         /**********************************************************
  146.          * Data members
  147.          *********************************************************/
  148.  
  149.     private:
  150.  
  151.         WBitmap *               _bitmap;
  152.         WBitmap *               _checkedBitmap;
  153.         WBitmap *               _uncheckedBitmap;
  154.         WMenuItemType           _type;
  155. };
  156.  
  157. #ifndef _WNO_PRAGMA_PUSH
  158. #pragma enum pop;
  159. #pragma pack(pop);
  160. #endif
  161.  
  162. #endif // _WMENUITM_HPP_INCLUDED
  163.