home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WTOOLTIP.HPP < prev    next >
C/C++ Source or Header  |  1996-11-29  |  5KB  |  181 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.  * WToolTip -- Wrapper for the Windows 95 ToolTip control.
  14.  *
  15.  *   Events:
  16.  *
  17.  *************************************************************************/
  18.  
  19. #ifndef _WTOOLTIP_HPP_INCLUDED
  20. #define _WTOOLTIP_HPP_INCLUDED
  21.  
  22. #ifndef _WNO_PRAGMA_PUSH
  23. #pragma pack(push,8);
  24. #pragma enum int;
  25. #endif
  26.  
  27. #ifndef _WCONTROL_HPP_INCLUDED
  28. #  include "wcontrol.hpp"
  29. #endif
  30. #ifndef _WWINDOW_HPP_INCLUDED
  31. #  include "wwindow.hpp"
  32. #endif
  33. #ifndef _WVECTOR_HPP_INCLUDED
  34. #  include "wvector.hpp"
  35. #endif
  36.  
  37. class WToolTip;
  38.  
  39. enum WToolTipIdentifierType {
  40.     WToolTipWindowHandle,
  41.     WToolTipIdentifier
  42. };
  43.  
  44. enum WToolTipDuration {
  45.     WToolTipAutomaticDuration,
  46.     WToolTipReshowDuration,
  47.     WToolTipAutoPopDuration,
  48.     WToolTipInitialDuration,
  49. };
  50.  
  51. //
  52. // ToolTip styles
  53. //
  54.  
  55. #define WTOOLTSDefault          ((WStyle)0x00000001L) // TTS_ALWAYSTIP
  56. #define WTOOLTSAlwaysTip        ((WStyle)0x00000001L) // TTS_ALWAYSTIP
  57. #define WTOOLTSNoPrefix         ((WStyle)0x00000002L) // TTS_NOPREFIX
  58.  
  59. class WCMCLASS WToolTip : public WControl {
  60.     WDeclareSubclass( WToolTip, WControl );
  61.  
  62.     public:
  63.     
  64.         /**********************************************************
  65.          * Constructors and Destructors
  66.          *********************************************************/
  67.  
  68.         WToolTip();
  69.     
  70.         ~WToolTip();
  71.  
  72.         /**********************************************************
  73.          * Properties
  74.          *********************************************************/
  75.     
  76.         // Count
  77.  
  78.         WInt GetCount() const;
  79.  
  80.         // DelayTime
  81.  
  82.         WBool SetDelayTime( WInt milliseconds=500,
  83.                             WToolTipDuration duration=WToolTipAutomaticDuration );
  84.  
  85.         /**********************************************************
  86.          * Methods
  87.          *********************************************************/
  88.  
  89.         // Activate
  90.  
  91.         void Activate();
  92.  
  93.         // Add
  94.  
  95.         WBool Add( WWindow * parent, WToolTipIdentifierType type,
  96.                    const WRect & rect, const char * text=NULL,
  97.                    WWindow * window=NULL, WLong id=0,
  98.                    WBool getTextFromParent=FALSE );
  99.  
  100.         // Deactivate
  101.  
  102.         void Deactivate();
  103.  
  104.         // Delete
  105.  
  106.         WBool Delete( WLong itemNumber );
  107.  
  108.         // DeleteAll
  109.  
  110.         WBool DeleteAll();
  111.  
  112.         // Retrieve
  113.  
  114.         WLong Retrieve( const WPoint & pt, WWindow * win=NULL );
  115.  
  116.         /**********************************************************
  117.          * Item Properties
  118.          *********************************************************/
  119.  
  120.         // ID
  121.  
  122.         void SetID( WLong itemNumber, WLong id );
  123.         WLong GetID( WLong itemNumber ) const;
  124.  
  125.         // Parent
  126.  
  127.         WBool SetParent( WLong itemNumber, WWindow * parent );
  128.         WWindow * GetParent( WLong itemNumber );
  129.  
  130.         // Rectangle
  131.  
  132.         WBool SetRectangle( WLong itemNumber, const WRect & rect );
  133.         WRect GetRectangle( WLong itemNumber );
  134.  
  135.         // Text
  136.  
  137.         WBool SetText( WLong itemNumber, const WString & str );
  138.         WString GetText( WLong itemNumber );
  139.  
  140.         // Type
  141.  
  142.         void SetType( WLong itemNumber, WToolTipIdentifierType type );
  143.         WToolTipIdentifierType GetType( WLong itemNumber );
  144.  
  145.         // Window
  146.  
  147.         void SetWindow( WLong itemNumber, WWindow * window );
  148.         WWindow * GetWindow( WLong itemNumber );
  149.     
  150.         /**********************************************************
  151.          * Overrides
  152.          *********************************************************/
  153.  
  154.         virtual WBool SetParent( const WWindow * parent );
  155.  
  156.         virtual WWindow * GetParent() const;
  157.  
  158.         virtual WBool SetRectangle( const WRect & rectangle,
  159.                                     WBool update=TRUE );
  160.  
  161.         virtual WRect GetRectangle( WBool absolute=FALSE ) const;
  162.  
  163.         virtual WBool SetText( const WString & text );
  164.  
  165.         virtual WString GetText() const;
  166.  
  167.         virtual const WChar * InitializeClass();
  168.  
  169.         virtual WStyle GetDefaultStyle() const;
  170.  
  171.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  172.                                    void * data=NULL );
  173. };
  174.  
  175. #ifndef _WNO_PRAGMA_PUSH
  176. #pragma enum pop;
  177. #pragma pack(pop);
  178. #endif
  179.  
  180. #endif // _WTOOLTIP_HPP_INCLUDED
  181.