home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1994, by WATCOM International Inc. All rights %
- % reserved. No part of this software may be reproduced or %
- % used in any form or by any means - graphic, electronic or %
- % mechanical, including photocopying, recording, taping or %
- % information storage and retrieval systems - except with the %
- % written permission of WATCOM International Inc. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- */
-
- /*************************************************************************
- *
- * WTabControl -- Wrapper for the Windows 95 TabControl.
- *
- *
- * Events:
- *
- * Select --
- *
- * SelectChanging --
- *
- *************************************************************************/
-
- #ifndef _WTABCTRL_HPP_INCLUDED
- #define _WTABCTRL_HPP_INCLUDED
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma pack(push,8);
- #pragma enum int;
- #endif
-
- #ifndef _WCONTROL_HPP_INCLUDED
- # include "wcontrol.hpp"
- #endif
- #ifndef _WVECTOR_HPP_INCLUDED
- # include "wvector.hpp"
- #endif
- #ifndef _WSIZE_HPP_INCLUDED
- # include "wsize.hpp"
- #endif
- #ifndef _WIMGLIST_HPP_INCLUDED
- # include "wimglist.hpp"
- #endif
-
- //
- // TabControl styles
- //
-
- #define WTCSDefault ((WStyle)0x54001200L) // WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|TCS_MULTILINE|TCS_FOCUSONBUTTONDOWN|TCS_TABS
- #define WTCSSingleline ((WStyle)0x00000000L) // TCS_SINGLELINE
- #define WTCSTabs ((WStyle)0x00000000L) // TCS_TABS
- #define WTCSRightJustify ((WStyle)0x00000000L) // TCS_RIGHTJUSTIFY
- #define WTCSForceIconLeft ((WStyle)0x00000010L) // TCS_FORCEICONLEFT
- #define WTCSForceLabelLeft ((WStyle)0x00000020L) // TCS_FORCELABELLEFT
- #define WTCSShareImageLists ((WStyle)0x00000040L) // TCS_SHAREIMAGELISTS
- #define WTCSButtons ((WStyle)0x00000100L) // TCS_BUTTONS
- #define WTCSMultiline ((WStyle)0x00000200L) // TCS_MULTILINE
- #define WTCSFixedWidth ((WStyle)0x00000400L) // TCS_FIXEDWIDTH
- #define WTCSRaggedRight ((WStyle)0x00000800L) // TCS_RAGGEDRIGHT
- #define WTCSFocusOnButtonDown ((WStyle)0x00001000L) // TCS_FOCUSONBUTTONDOWN
- #define WTCSOwnerDrawFixed ((WStyle)0x00002000L) // TCS_OWNERDRAWFIXED
- #define WTCSToolTips ((WStyle)0x00004000L) // TCS_TOOLTIPS
- #define WTCSFocusNever ((WStyle)0x00008000L) // TCS_FOCUSNEVER
-
- #define WTCHTNowhere 0x0001
- #define WTCHTOnItemIcon 0x0002
- #define WTCHTOnItemLabel 0x0004
- #define WTCHTOnItem 0x0006
-
- struct WTabControlEventData : public WEventData {
- WLong newID;
- WLong oldID;
- };
-
- class WTabControl;
- class WToolTip;
-
- class WCMCLASS WTabControl : public WControl {
- WDeclareSubclass( WTabControl, WControl );
-
- public:
-
- /**********************************************************
- * Constructors and destructors
- *********************************************************/
-
- WTabControl();
-
- ~WTabControl();
-
- /**********************************************************
- * Properties
- *********************************************************/
-
- // Count
- //
- // Retrieves the number of items.
-
- WShort GetCount() const;
-
- // Selected
- //
- // Sets/gets the item which is currently selected.
-
- WLong GetSelected();
- WBool SetSelected( WLong id );
-
- // TabHeight
-
- WLong GetTabHeight();
- WBool SetTabHeight( WLong tabHeight );
-
- // TabSize
-
- WSize GetTabSize();
- WBool SetTabSize( const WSize & tabSize );
-
- // TabWidth
-
- WLong GetTabWidth();
- WBool SetTabWidth( WLong tabWidth );
-
- /**********************************************************
- * Methods
- *********************************************************/
-
- // Add
- //
- // Add a new item. Autosize is currently unused.
-
- WLong Add( WLong id, const WChar * text, WInt imageIndex,
- WBool autoSize=TRUE, void *itemData=NULL );
- WLong Add( WLong id, const WChar * text, WBool autoSize=TRUE,
- void *itemData=NULL );
- WLong Add( WLong id, WInt imageIndex, WBool autoSize=TRUE,
- void *itemData=NULL );
-
- // Retrieve
- //
- // Hit test
-
- WLong Retrieve( const WPoint & pt, WLong * flags=NULL );
-
- // Delete
- //
- // Delete an item. Important to note is that windows attached
- // to the item via SetWindow() are NOT destroyed by this call
- // unless the selfDelete parameter is set to TRUE
-
- WBool Delete( WLong id );
-
- // DeleteAll
- //
- // Delete all items in the control.
- // c.f. Delete
-
- WBool DeleteAll();
-
- // AdjustRect
- //
- // Adjust the given rectangle. If wantSmaller is set to TRUE,
- // this maps the supplied WRect from the tab control to a page
- // or tab on the tab control. The mapping is reversed if
- // wantSmaller is set to FALSE.
-
- void AdjustRect( WBool wantSmaller, WRect & rect );
-
- /**********************************************************
- * Item Properties
- *********************************************************/
-
- // ImageList
-
- WBool SetImageList(WImageList * il);
- WImageList * GetImageList () const;
-
- // ImageIndex
-
- WBool SetImageIndex( WLong itemNumber, WInt imageIndex );
- WInt GetImageIndex( WLong itemNumber );
-
- // RealUserData
-
- void * GetRealUserData( WLong itemNumber );
-
- // Rectangle
-
- WRect GetRectangle( WLong itemNumber );
-
- // Text
-
- WBool SetText( WLong itemNumber, const WString & str );
- WString GetText( WLong itemNumber );
-
- // UserData
-
- WBool SetUserData( WLong itemNumber, void * itemUserData );
- void * GetUserData( WLong itemNumber );
-
- // Window
-
- WBool SetWindow( WLong itemNumber, WWindow * win,
- WBool relativePos=TRUE, WBool adjustSize=TRUE,
- WBool selfDelete=FALSE );
- WWindow * GetWindow( WLong itemNumber );
-
- /**********************************************************
- * Overrides
- *********************************************************/
-
- virtual WBool SetText( const WString & text );
-
- virtual WString GetText() const;
-
- virtual WToolTip * GetToolTip() const;
-
- virtual WBool SetToolTip( WToolTip * toolTip );
-
- virtual WBool SetUserData( void * userData );
-
- virtual void * GetUserData() const;
-
- virtual const WChar * InitializeClass();
-
- virtual WStyle GetDefaultStyle() const;
-
- virtual WStyle GetDefaultExtendedStyle() const;
-
- virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
- void * data=NULL );
-
- virtual WRect GetRectangle( WBool absolute=FALSE ) const;
-
- protected:
-
- virtual WBool MakeWindow( WWindow * parent, WUInt id,
- const WChar * className,
- const WChar * title, const WRect & r,
- WStyle wstyle, WStyle exStyle,
- void * data=NULL );
-
- virtual WBool ProcessNotify( WUInt id, WNotify code,
- WNotifyInfo info, WLong & returns );
-
- /**********************************************************
- * Event handlers
- *********************************************************/
-
- protected:
-
- WBool MoveEventHandler( WWindow * window,
- WMoveEventData * event );
-
- WBool ResizeEventHandler( WWindow * window,
- WResizeEventData * event );
-
- WBool DestroyEventHandler( WWindow * window, WEventData * event );
-
- WBool NeedToolTipTextEventHandler( WWindow * source,
- WToolTipTextEventData * event );
-
- /**********************************************************
- * Data members
- *********************************************************/
-
- private:
-
- WInt _lastId;
- WImageList * _imageList;
- };
-
- #ifndef _WNO_PRAGMA_PUSH
- #pragma enum pop;
- #pragma pack(pop);
- #endif
-
- #endif // _WTABCTRL_HPP_INCLUDED
-