wwindow.hpp
来自「开放源码的编译器open watcom 1.6.0版的源代码」· HPP 代码 · 共 352 行 · 第 1/2 页
HPP
352 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: Window class prototype
*
****************************************************************************/
#ifndef wwindow_class
#define wwindow_class
#include "_windows.hpp"
#include "wkeydefs.hpp"
#include "wpaint.hpp"
#include "wmetrics.hpp"
typedef unsigned short WMouseKeyFlags;
typedef unsigned short WScrollPos;
// For defining WStyles for Windows:
// =================================
typedef unsigned long WStyle;
#define _CreateStyleToWStyle( x ) (((WStyle)(x))<<16)
#define _ControlStyleToWStyle( x ) (((WStyle)(x))<<16)
#define _ScrollStyleToWStyle( x ) ((WStyle)(x))
#define _WStyleToCreateStyle( x ) ((gui_create_styles)((x & 0xffff0000)>>16))
#define _WStyleToControlStyle( x ) ((gui_control_styles)((x & 0xffff0000)>>16))
#define _WStyleToScrollStyle( x ) ((gui_scroll_styles)(x & 0x0000ffff))
// Window creation styles:
#define WStyleHScrollEvents _CreateStyleToWStyle( GUI_HSCROLL_EVENTS )
#define WStyleVScrollEvents _CreateStyleToWStyle( GUI_VSCROLL_EVENTS )
#define WStyleMinimize _CreateStyleToWStyle( GUI_INIT_MINIMIZED )
#define WStyleMaximize _CreateStyleToWStyle( GUI_INIT_MAXIMIZED )
#define WStyleSizeable _CreateStyleToWStyle( GUI_RESIZEABLE )
#define WStylePopup _CreateStyleToWStyle( GUI_POPUP )
#define WStyleSysMenu _CreateStyleToWStyle( GUI_SYSTEM_MENU )
#define WStyleMinimizeBox _CreateStyleToWStyle( GUI_MINIMIZE )
#define WStyleMaximizeBox _CreateStyleToWStyle( GUI_MAXIMIZE )
#define WStyleCloseable _CreateStyleToWStyle( GUI_CLOSEABLE )
#define WStyleTabGroup _CreateStyleToWStyle( GUI_TAB_GROUP )
#define WStyleSimple _CreateStyleToWStyle( GUI_NOFRAME )
#define WStyleSimpleFrame _CreateStyleToWStyle( 0 )
#define WStyleDefault (WStyleSysMenu | WStyleSizeable | \
WStyleMinimizeBox | WStyleMaximizeBox | \
WStyleCloseable )
#define WStyleHScroll _ScrollStyleToWStyle( GUI_HSCROLL )
#define WStyleVScroll _ScrollStyleToWStyle( GUI_VSCROLL )
#define WStyleHDrag _ScrollStyleToWStyle( GUI_HDRAG )
#define WStyleVDrag _ScrollStyleToWStyle( GUI_VDRAG )
#define WStyleHTrack _ScrollStyleToWStyle( GUI_HTRACK )
#define WStyleVTrack _ScrollStyleToWStyle( GUI_VTRACK )
#define WStyleHCols _ScrollStyleToWStyle( GUI_HCOLS )
#define WStyleVRows _ScrollStyleToWStyle( GUI_VROWS )
#define WStyleHScrollAll (WStyleHScroll | WStyleHDrag | \
WStyleHTrack | WStyleHCols )
#define WStyleVScrollAll (WStyleVScroll | WStyleVDrag | \
WStyleVTrack | WStyleVRows )
// Scroll bar identifiers:
typedef unsigned WScrollBar;
#define WScrollBarVertical 1
#define WScrollBarHorizontal 2
// Scroll notifications:
typedef unsigned WScrollNotification;
#define WScrollUp 1
#define WScrollPageUp 2
#define WScrollDown 3
#define WScrollPageDown 4
#define WScrollTop 5
#define WScrollBottom 6
#define WScrollVertical 7
#define WScrollLeft 8
#define WScrollPageLeft 9
#define WScrollRight 10
#define WScrollPageRight 11
#define WScrollFullLeft 12
#define WScrollFullRight 13
#define WScrollHorizontal 14
#include "wstates.hpp"
#include "wres.hpp"
#include "wobject.hpp"
#include "wobjmap.hpp"
#include "wvlist.hpp"
#include "wrect.hpp"
#include "wstring.hpp"
#include "wcolour.hpp"
#include "wpoint.hpp"
#include "wlines.hpp"
WCLASS WMenu;
WCLASS WPopupMenu;
WCLASS WToolBar;
WCLASS WWindow;
WCLASS AccelKey;
WCLASS WControl;
typedef void (WObject::*cbw)( WWindow *w );
typedef bool (WObject::*bcbk)( gui_key k );
WCLASS WWindow : public WObject {
private:
virtual bool reallyClose( void ) { return( TRUE ); }
bool updateAutosize( void );
void destroyWindow( void );
AccelKey *findAccelKey( WKeyCode key );
private:
gui_window *_handle;
WWindow *_parent;
WMenu *_menu;
WPopupMenu *_popup;
WToolBar *_toolBar;
WVList _children;
WRect _autosize;
gui_mouse_cursor _prevCursor;
gui_mouse_cursor _currCursor;
WOrdinal _firstDirtyRow;
int _numDirtyRows;
bool _keyHandled;
protected:
void makeWindow( const char *title, WStyle wstyle=0 );
void autoPosition( WRect& r );
void setParent( WWindow *parent ) { _parent = parent; }
void setAutosize( const WRect& r ) { _autosize = r; }
WPopupMenu *popup() { return _popup; }
WVList & children() { return _children; }
WWindow *nextChild( WWindow *w );
WRect getDefSize();
void enumChildren( void );
protected:
bool _painting;
WVList _accelKeys;
public:
WEXPORT WWindow( WWindow *parent=NULL );
WEXPORT WWindow( const char *text, WStyle style=WStyleDefault );
WEXPORT WWindow( WWindow *parent, const char *text,
WStyle style=WStyleDefault );
WEXPORT WWindow( WWindow *parent, const WRect& r, const char *text,
WStyle style=WStyleDefault );
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?