home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
sybase
/
starbuck
/
hpp.z
/
WSPLITB.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
8KB
|
251 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WSplitBar -- Wrapper for the Windows 95 SplitBar control.
*
* Events:
*
*************************************************************************/
#ifndef _WSPLITB_HPP_INCLUDED
#define _WSPLITB_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WPOINT_HPP_INCLUDED
# include "wpoint.hpp"
#endif
#ifndef _WCONTROL_HPP_INCLUDED
# include "wcontrol.hpp"
#endif
enum WSplitDir {
WSplitHorizontal,
WSplitVertical,
};
enum WSplitTrackingMode {
WSplitTrackingStretch,
WSplitTrackingSlide,
WSplitTrackingManual,
WSplitTrackingStatic
};
struct WSplitRect {
WLong left;
WLong top;
WLong right;
WLong bottom;
};
//
// SplitBar styles
//
#define WSplitDefault ((WStyle)0x50000001L) // WS_VISIBLE | WSPLIT_DRAWENDS | WS_CHILD | WSPLIT_DRAWBORDER
#define WSPLIT_DRAWENDS 0x00000001L
#define WSPLIT_BORDER 0x00000002L
#define WSplitDrawEnds ((WStyle)0x00000001L) // WSPLIT_DRAWENDS
#define WSplitBorder ((WStyle)0x00000002L) // WSPLIT_BORDER
class WCMCLASS WSplitBar: public WControl {
WDeclareSubclass( WSplitBar, WControl );
public:
/**************************************************************
* Contructors and destructors
**************************************************************/
~WSplitBar();
protected:
WSplitBar( WSplitDir dir,
WSplitTrackingMode split=WSplitTrackingStretch );
public:
/**************************************************************
* Properties
**************************************************************/
// Border
WBool GetBorder() const;
WBool SetBorder( WBool on );
// BottomOffset
WUInt GetBottomOffset() const;
WBool SetBottomOffset( WUInt bottomOffset );
// LeftOffset
WUInt GetLeftOffset() const;
WBool SetLeftOffset( WUInt leftOffset );
// RightOffset
WUInt GetRightOffset() const;
WBool SetRightOffset( WUInt rightOffset );
// TopOffset
WUInt GetTopOffset() const;
WBool SetTopOffset( WUInt topOffset );
// Direction
virtual WSplitDir GetDirection() const;
// DrawEnds
WBool GetDrawEnds() const;
WBool SetDrawEnds( WBool drawEnds );
// TrackingMode
WSplitTrackingMode GetTrackingMode() const;
WBool SetTrackingMode( WSplitTrackingMode mode );
/**************************************************************
* Methods
**************************************************************/
/**************************************************************
* Overrides
**************************************************************/
virtual WBool ProcessMessage( const WMessage & msg,
WLong & returns );
virtual const WChar * InitializeClass();
virtual WBool LoadWindow( WWindow * parent,
const WResourceID & id,
WModuleHandle module=_ApplicationModule );
/**************************************************************
* Event Handlers
**************************************************************/
private:
WBool OnDragFeedback( WWindow *, WDragEventData * event );
WBool OnDragEnd( WWindow *, WDragEventData * event );
WBool PaintHandler( WWindow * window, WPaintEventData * event );
WBool MoveEventHandler( WWindow * window, WMoveEventData * event );
/**************************************************************
* Others
**************************************************************/
private:
void MovePanes( const WPoint & diff, WBool stretch );
WBool IsLeftPane( const WSplitRect & split, const WSplitRect & pane ) const;
WBool IsRightPane( const WSplitRect & split, const WSplitRect & pane ) const;
WBool IsTopPane( const WSplitRect & split, const WSplitRect & pane ) const;
WBool IsBottomPane( const WSplitRect & split, const WSplitRect & pane ) const;
/**************************************************************
* Data members
**************************************************************/
private:
WSplitTrackingMode _trackingMode;
WSplitDir _direction;
WPoint _dragfrom;
WRect _dragrect;
WRect _savedpos;
WUInt _topOffset;
WUInt _bottomOffset;
WUInt _leftOffset;
WUInt _rightOffset;
};
class WCMCLASS WVSplitBar : public WSplitBar {
WDeclareSubclass( WVSplitBar, WSplitBar );
public:
/**************************************************************
* Contructors and destructors
**************************************************************/
WVSplitBar();
~WVSplitBar();
/**************************************************************
* Properties
**************************************************************/
/**************************************************************
* Methods
**************************************************************/
/**************************************************************
* Overrides
**************************************************************/
virtual WStyle GetDefaultStyle() const;
};
class WCMCLASS WHSplitBar : public WSplitBar {
WDeclareSubclass( WHSplitBar, WSplitBar );
public:
/**************************************************************
* Contructors and destructors
**************************************************************/
WHSplitBar();
~WHSplitBar();
/**************************************************************
* Properties
**************************************************************/
/**************************************************************
* Methods
**************************************************************/
/**************************************************************
* Overrides
**************************************************************/
virtual WStyle GetDefaultStyle() const;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WSPLITB_HPP_INCLUDED