home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WFORM.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1997-01-24
|
15KB
|
470 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. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WForm -- Base Form class
*
*
* Events:
*
* Close --
*
* InitMenu --
*
*************************************************************************/
#ifndef _WFORM_HPP_INCLUDED
#define _WFORM_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WVECTOR_HPP_INCLUDED
# include "wvector.hpp"
#endif
#ifndef _WWINDOW_HPP_INCLUDED
# include "wwindow.hpp"
#endif
#ifndef _WCONTROL_HPP_INCLUDED
# include "wcontrol.hpp"
#endif
#ifndef _WPOPMENU_HPP_INCLUDED
# include "wpopmenu.hpp"
#endif
#ifndef _WFILPATH_HPP_INCLUDED
# include "wfilpath.hpp"
#endif
extern template WVector<WWindow>;
extern template WVector<WObject>;
extern template WVector<WString>;
class WAcceleratorTable;
class WStatusBar;
enum WWindowState {
WWindowStateNormal,
WWindowStateMinimized,
WWindowStateMaximized
};
//
// Styles
//
#define WFormDefault ((WStyle)0x12CF0000L) // WS_OVERLAPPEDWINDOW|WS_VISIBLE|WS_CLIPCHILDREN
class WCMCLASS WForm : public WWindow {
WDeclareSubclass( WForm, WWindow );
public:
/**************************************************************
* Constructors
**************************************************************/
WForm();
WForm( WWindow * parent, WWindowHandle hdl );
virtual ~WForm();
/**************************************************************
* Properties
**************************************************************/
// AcceleratorTable
WAcceleratorTable GetAcceleratorTable() const;
WBool SetAcceleratorTable( const WAcceleratorTable & table,
WBool append=FALSE );
// Active
//
// If TRUE, window is the active window for this thread.
// Use the Activate method to force a window to become
// the active window.
virtual WBool GetActive() const;
// AutomaticScrolling
WBool GetAutomaticScrolling() const;
WBool SetAutomaticScrolling( WBool automaticScrolling );
// ClientWindow
//
// The client window will automatically be positioned directly
// over the client area of the form, excluding any space taken
// up by docked windows such as toolbars and status bars.
virtual WWindow * GetClientWindow();
virtual WBool SetClientWindow( WWindow * clientWindow );
// ControlCount
virtual WInt GetControlCount();
// MaximizedPosition
//
// Defines the left & top position of the form when
// maximized.
WPoint GetMaximizedPosition() const;
WBool SetMaximizedPosition( const WPoint & maxPos );
// MaximizedSize
//
// Defines the height & width of the form when
// maximized.
WSize GetMaximizedSize() const;
WBool SetMaximizedSize( const WSize & maxSize );
// MaximumTrackingSize
//
// Defines the maximum height & width when the window
// is being resized.
WSize GetMaximumTrackingSize() const;
WBool SetMaximumTrackingSize( const WSize & maxTrackSize );
// Menu
virtual WMenu *GetMenu() const;
virtual WBool SetMenu( WMenu *menu );
// MinimumTrackingSize
//
// Defines the minimum height & width when the window
// is being resized.
WSize GetMinimumTrackingSize() const;
WBool SetMinimumTrackingSize( const WSize & minTrackSize );
// SystemMenu
//
//
WSystemMenu *GetSystemMenu();
// Icon in the window's title bar
//
//
WIcon GetIcon(WBool size = FALSE);
WIcon SetIcon(const WIcon & icon, WBool size = FALSE); // default small size
// HelpFile
WFilePath GetHelpFile() const;
WBool SetHelpFile( const WFilePath & helpFile );
// HintText
WString GetHintText() const;
virtual WBool SetHintText( const WString & str );
// StatusBar
virtual WStatusBar *GetStatusBar() const;
virtual WBool SetStatusBar( WStatusBar * statusBar );
// VirtualClientRectangle
virtual WBool SetVirtualClientRectangle( const WRect & rect );
virtual WRect GetVirtualClientRectangle() const;
// WindowID
virtual WUInt GetWindowID() const;
virtual WBool SetWindowID( WUInt newID );
// WindowState
WWindowState GetWindowState();
WBool SetWindowState( WWindowState state );
/**************************************************************
* Methods
**************************************************************/
// Activate
//
// Force this form to become the active window for the
// thread.
virtual WBool Activate() const;
// AddDockedWindow
virtual void AddDockedWindow( WWindow * docked,
WWindow * sibling=NULL,
WBool insertBeforeSibling=TRUE );
// AddObject
WBool AddObject( WObject * object, const WString & objectName );
// Close
virtual WBool Close();
// GetObject
WObject * FindObject( const WString & objectName,
WBool recurseUp=TRUE );
// RemoveObject
WBool RemoveObject( WObject * object, WBool recurseUp=TRUE );
WBool RemoveObject( const WString & objectName,
WBool recurseUp=TRUE );
// AddDrawPrimitive
//
// Note: The added drawPrimitives will automatically be
// deleted by the window in its destructor, so the
// user should NOT delete this primitives him/herself
virtual void AddDrawPrimitive( WDrawPrimitive * drawPrimitive );
// AddPinnedWindow
virtual WBool AddPinnedWindow( WWindow * pinned );
// AdjustClientRectangle
virtual void AdjustClientRectangle( WRect & rect,
WBool moveChildren=FALSE );
// Center
//
// Center the form, either over its parent (owner) or
// over an arbitrary window. Pass NULL to center over
// the desktop.
WBool Center();
WBool Center( WWindow *window );
// ClearMenu
WMenu * ClearMenu();
// CreateStatusBar
WBool CreateStatusBar();
// FDXInitializeControls
//
// Called by the default Initialize event handler
virtual WBool FDXInitializeControls();
// FDXUpdateControls
//
// Called by the default OK event handler
virtual WBool FDXUpdateControls();
// Initialize
virtual WBool Initialize();
// RedrawFrame
WBool RedrawFrame();
// RemoveDockedWindow
virtual void RemoveDockedWindow( WWindow * docked );
// RemoveDrawPrimitive
//
// Note: The added drawPrimitives will automatically be
// deleted by the window in its destructor, so the
// user should NOT delete this primitives him/herself
virtual void RemoveDrawPrimitive( WDrawPrimitive * drawPrimitive );
// RemovePinnedWindow
virtual WBool RemovePinnedWindow( WWindow *pinned );
// ResetSystemMenu
WBool ResetSystemMenu();
// ShiftDockedWindows
virtual void ShiftDockedWindows( WDockPosition pos,
WInt startIndex, WInt endIndex,
WBool moveUp );
// Show
virtual WBool Show( WShowStyle style=WWinStateShowNormal );
// UpdateMenu
WBool UpdateMenu();
/**************************************************************
* Item properties
**************************************************************/
// Control
virtual WControl * GetControl( WInt itemNumber );
// DockedWindow
virtual WWindow * GetDockedWindow( WInt index, WDockPosition pos );
// DockedWindowCount
virtual WInt GetDockedWindowCount( WDockPosition pos );
/**************************************************************
* Event handlers
**************************************************************/
WBool InitMenuEventHandler( WForm * form,
WMessageEventData * event );
WBool SystemCommandEventHandler( WForm * form,
WMessageEventData * event );
WBool CommandEventHandler( WForm * form,
WMessageEventData * event );
WBool InitPopupMenuEventHandler( WForm * form,
WMessageEventData * event );
WBool MenuSelectEventHandler( WForm * form,
WMessageEventData * event );
WBool FormCloseEventHandler( WForm * form,
WEventData * event );
WBool EraseBackgroundHandler( WWindow * window,
WPaintEventData * event );
WBool ResizeEventHandler( WWindow * window,
WResizeEventData * event );
WBool DestroyEventHandler( WWindow * window, WEventData * event );
WBool HelpEventHandler( WWindow * window, WHelpEventData * event );
WBool PositionChangedEventHandler( WForm *window,
WResizeEventData * event );
WBool ScrollEventHandler( WWindow * window,
WScrollBarEventData * event );
/**************************************************************
* Overrides
**************************************************************/
virtual WBool SetPopup( WPopupMenu * popup );
virtual WBool AdjustFloatingFormStyle( WStyle & style,
WStyle & exStyle );
virtual WRect CalculateSize( const WRect &, WBool adjust );
virtual void SetDockedPosition( WDockPosition pos, WInt index=0,
WBool insert=FALSE,
WWindow * sibling=NULL,
WBool insertBeforeSibling=TRUE,
WBool callEventHandler=TRUE );
virtual void AddControl( WControl * ctrl );
virtual void RemoveControl( WControl * ctrl );
virtual WBool ProcessMessage( const WMessage & msg, WLong & returns );
virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
virtual WFont GetFont( WBool getResultingFont=TRUE );
virtual WUInt AssignWindowID();
virtual WStyle GetDefaultStyle() const;
virtual WStyle GetDefaultExtendedStyle() const;
virtual WBool LoadWindow( WWindow * parent,
const WResourceID & id,
WModuleHandle module=_ApplicationModule );
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 CloneWindow( WStyle newStyle, WStyle newExStyle,
void * data=NULL );
/**************************************************************
* Others
**************************************************************/
virtual WBool FilterMessage( WMessage & msg, WBool & eatMessage );
/**************************************************************
* Data members
**************************************************************/
protected:
WRect _lastResizeRect;
private:
WString _hintText;
WFilePath _helpFile;
WStatusBar * _statusBar;
WMenu * _menu;
WSystemMenu * _systemMenu;
WInt _nextChildID;
WAcceleratorTable * _accelTable;
WSize _maxSize;
WPoint _maxPosition;
WSize _minTrackSize;
WSize _maxTrackSize;
WWindow * _clientWindow;
WStyle * _dockStyle;
WStyle * _dockExStyle;
WDrawPrimitiveGroup * _drawPrimitives;
WVector< WWindow > * _dockedWindows;
WVector< WWindow > * _dockWindowFrames;
WVector< WWindow > * _pinnedWindows;
WVector< WObject > * _objects;
WVector< WString > * _objectNames;
WRect _virtClientRect;
WBool _automaticScrolling;
WBool _inResize;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WFORM_HPP_INCLUDED