⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 control.h

📁 这是VCF框架的代码
💻 H
📖 第 1 页 / 共 3 页
字号:
#ifndef _VCF_CONTROL_H__#define _VCF_CONTROL_H__//Control.h/*Copyright 2000-2004 The VCF Project.Please see License.txt in the top level directorywhere you installed the VCF.*/#if _MSC_VER > 1000#   pragma once#endifnamespace VCF {class Rect;class Color;class Border;class Font;class ControlPeer;class GraphicsContext;class ControlGraphicsContext;class PopupMenu;class Scrollable;class Cursor;class Model;class AcceleratorKey;class Container;class Frame;class ControlEvent;typedef unsigned long AnchorTypes;#define CONTROL_CLASSID		"B91B1828-3639-4bcf-9882-342F16C90E21"/**The various enumerations of standard alignment types used by the default containers for control alignment. Note thatother custom control's may have their own types.*/enum AlignmentType{	/**	The default value for a control's alignment. The control's top, left, 	width, and height are what determine it's position, regardless of 	surrounding controls.	*/    AlignNone=0,		/**	The control moves to the top of the parent container and resizes to 	fill in the width of the parent control. The height of the control 	is not altered during parent dimension changes.	*/    AlignTop,		/**	The control moves to the bottom of the parent container and resizes 	to fill in the width of the parent control. The height of the control 	is not altered during parent dimension changes.	*/    AlignLeft,		/**	The control moves to the left side of the parent container and resizes 	to fill in the height of the parent control. The width of the control 	is not altered during parent dimension changes.	*/    AlignRight,		/**	The control moves to the right side of the parent container and resizes 	to fill in the height of the parent control. The width of the control is 	not altered during parent dimension changes.	*/    AlignBottom,		/**	The control resizes to fill in the remaining client area of a form (after 	all other alignment positions of other controls are calculated).	*/    AlignClient};/**An enum of anchor types for a control's anchor value.These may be masked together.*/enum AnchorType {	/**	This is the default value for a control's anchor property. 	No layout adjustments are performed on the control.	*/	AnchorNone = 0,		/**	The Control is anchored to the top edge of the parent control 	it belongs to. Whatever the distance between the top edge and 	the top coordinate of the control when this is set, is maintained 	whenever the parent control's dimensions change. 	*/	AnchorTop = 1,		/**	The Control is anchored to the left edge of the parent 	control it belongs to. Whatever the distance between the 	left edge and the left coordinate of the control when this 	is set, is maintained whenever the parent control's dimensions 	change.	*/	AnchorLeft = 2,		/**	The Control is anchored to the bottom edge of the parent 	control it belongs to. Whatever the distance between the 	bottom edge and the bottom coordinate of the control when 	this is set, is maintained whenever the parent control's 	dimensions change. 	*/	AnchorBottom = 4,		/**	The Control is anchored to the right edge of the parent 	control it belongs to. Whatever the distance between the 	right edge and the right coordinate of the control when 	this is set, is maintained whenever the parent control's 	dimensions change.	*/	AnchorRight = 8};									 enum TextAlignmentType {	taTextLeft = 0,	taTextCenter,	taTextRight};/**\class Control Control.h "vcf/ApplicationKit/Control.h"The base class for all visual components in the Visual Component Framework.In addition it implements the View interface. This means that theControl is itself a specialized form of a View, though it may not havehave a model, and can hold an external view, separate from itself.A control receives a wide variety of events from the user such as paint events, mouse events, keyboard events, help events, etc.Controls can have parents, and can form a hierarchy of parent-child controls. Controls can have children if they have a valid Container instance set.Controls can also be aligned or anchored, which can aid in laying out thepresentation of a UI.Finally a Control may also be lightweight or heavyweight, which determineshow many  window system resources the control consumes. A heavyweight controlhas a native window/widget and takes up resources accordingly. In addition aheavyweight control also has a native graphics context associated with it thatalso takes up resources. In contrast, a lightweight control shares the underlyingnative window and graphics context resources with it's parent, and greatlyreduces the number of resources the application will consume. This is especiallyuseful when making complex custom controls that have many moving parts like a tree-list control, complete with a header and movable icons, etc.To aid in the drawing of a control, all controls are double buffered by defaultto prevent flicker, though this can be turned off and on at will. @delegates	@del Control::ControlSized	@del Control::ControlPositioned	@del Control::ControlParentChanged	@del Control::MouseDoubleClicked	@del Control::MouseClicked	@del Control::MouseMove	@del Control::MouseUp	@del Control::MouseDown	@del Control::MouseEnter	@del Control::MouseLeave	@del Control::KeyPressed	@del Control::KeyDown	@del Control::KeyUp	@del Control::ControlHelpRequested	@del Control::HelpRequested	@del Control::FocusLost	@del Control::FocusGained	@del Control::ToolTipRequested	@del Control::ToolTip	@del Control::ControlModelChanged	@del Control::BeforeControlPainted	@del Control::AfterControlPainted */class APPLICATIONKIT_API Control : public Component, public AbstractView {public:	//Anchor delta enums	enum {		ANCHOR_DTOP = 0,		ANCHOR_DLEFT,		ANCHOR_DBOTTOM,		ANCHOR_DRIGHT	};	enum ControlState {		csVisible					= 0x00000001,		csEnabled					= 0x00000002,		csUseParentFont				= 0x00000004,		csDoubleBuffered			= 0x00000008,		csAutoStartDragDrop			= 0x00000010,		csTabStop					= 0x00000020,		csIgnoreForLayout			= 0x00000040,		csIgnoreForParentScrolling  = 0x00000080,		csAllowPaintNotification	= 0x00000100,		csHasMouseCapture			= 0x00000200,		csUseRenderBuffer			= 0x00000400,		csDefaultControlState = csEnabled | csTabStop | csDoubleBuffered	};	enum MinMaxSizeDefaults{		mmIgnoreMinWidth = -1,		mmIgnoreMinHeight = -1,		mmIgnoreMaxWidth = -1,		mmIgnoreMaxHeight = -1	};	enum ControlEvents {		CONTROL_EVENTS = COMPONENT_EVENTS_LAST + 200,		CONTROL_SIZED,		CONTROL_POSITIONED,		CONTROL_PARENT_CHANGED,		CONTROL_MODELCHANGED,		FOCUS_GAINED,		FOCUS_LOST,		HELP_REQUESTED,		WHATS_THIS_HELP_REQUESTED,		KEYBOARD_DOWN,		KEYBOARD_PRESSED,		KEYBOARD_UP,		KEYBOARD_ACCELERATOR,		MOUSE_DOWN,		MOUSE_MOVE,		MOUSE_UP,		MOUSE_CLICK,		MOUSE_DBLCLICK,		MOUSE_ENTERED,		MOUSE_LEAVE,		BEFORE_CONTROL_PAINTED,		AFTER_CONTROL_PAINTED,		BEFORE_POPUP_MENU,		CONTROL_EVENTS_LAST	};	Control();	virtual ~Control();	/**	@delegate ControlSized fires an ControlEvent, with a type set to Control::CONTROL_SIZED.	Fired whenever the control's width or height changes. Calls to setBounds(), setHeight(), or	setWidth() can trigger this.	@event ControlEvent	@eventtype Control::CONTROL_SIZED	*/	DELEGATE(ControlSized);	/**	@delegate ControlPositioned fires an ControlEvent, with a type set to Control::CONTROL_POSITIONED.	Fired whenever the control's position (top or left coordinates) changes. Calls to setBounds(), setLeft(), or	setTop() can trigger this.	@event ControlEvent	@eventtype Control::CONTROL_POSITIONED	*/	DELEGATE(ControlPositioned);	/**	@delegate ControlParentChanged fires an ControlEvent, with a type set to Control::CONTROL_PARENT_CHANGED.	Fired whenever the control's parent changes. Calls to setParent() trigger this.	@event ControlEvent	@eventtype Control::CONTROL_PARENT_CHANGED	*/	DELEGATE(ControlParentChanged);	/**	@delegate MouseDoubleClicked fires an MouseEvent, with a type set to Control::MOUSE_DBLCLICK.	Fired whenever the control receives a double click from the mouse. This is triggered by the	underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_DBLCLICK	*/	DELEGATE(MouseDoubleClicked);	/**	@delegate MouseClicked fires an MouseEvent, with a type set to Control::MOUSE_CLICK.	Fired whenever the control receives a click from the mouse. This is triggered by the	underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_CLICK	*/	DELEGATE(MouseClicked);	/**	@delegate MouseMove fires an MouseEvent, with a type set to Control::MOUSE_MOVE.	Fired whenever the control receives a move event from the mouse. This is triggered by the	underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_MOVE	*/	DELEGATE(MouseMove);	/**	@delegate MouseUp fires an MouseEvent, with a type set to Control::MOUSE_UP.	Fired whenever the control receives notice that a mouse button has been released, or lifted up.	This is triggered by the underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_UP	*/	DELEGATE(MouseUp);	/**	@delegate MouseDown fires an MouseEvent, with a type set to Control::MOUSE_DOWN.	Fired whenever the control receives notice a mouse button has been pressed down.	This is triggered by the underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_DOWN	*/	DELEGATE(MouseDown);	/**	@delegate MouseEnter fires an MouseEvent, with a type set to Control::MOUSE_ENTERED.	Fired whenever the control receives notice the mouse has first entered the control's bounds.	This is triggered by the underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_ENTERED	*/	DELEGATE(MouseEnter);	/**	@delegate MouseLeave fires an MouseEvent, with a type set to Control::MOUSE_LEAVE.	Fired whenever the control receives notice the mouse has left the control's bounds.	This is triggered by the underlying windowing system.	@event MouseEvent	@eventtype Control::MOUSE_LEAVE	*/	DELEGATE(MouseLeave);	/**	@delegate KeyPressed fires an KeyboardEvent, with a type set to Control::KEYBOARD_PRESSED.	Fired whenever the control receives a keypress. This is triggered by the	underlying windowing system.	@event KeyboardEvent	@eventtype Control::KEYBOARD_PRESSED	*/	DELEGATE(KeyPressed);	/**	@delegate KeyDown fires an KeyboardEvent, with a type set to Control::KEYBOARD_DOWN.	Fired whenever the control receives notice a key has been pressed down. This is triggered by the	underlying windowing system.	@event KeyboardEvent	@eventtype Control::KEYBOARD_DOWN	*/	DELEGATE(KeyDown);	/**	@delegate KeyUp fires an KeyboardEvent, with a type set to Control::KEYBOARD_UP.	Fired whenever the control receives notice a key has been released. This is triggered by the	underlying windowing system.	@event KeyboardEvent	@eventtype Control::KEYBOARD_UP	*/	DELEGATE(KeyUp);	/**	@delegate ControlHelpRequested fires an WhatsThisHelpEvent, with a type set to Control::WHATS_THIS_HELP_REQUESTED.	Fired whenever the control receives notice of a context sensitive help event.	This is triggered by the underlying windowing system. On Win32 this is frequently triggered	by right clicking on a control, and clicking on the "Whats This?" context menu item.	@event WhatsThisHelpEvent	@eventtype Control::WHATS_THIS_HELP_REQUESTED	*/	DELEGATE(ControlHelpRequested);	/**	@delegate HelpRequested fires an HelpEvent, with a type set to Control::HELP_REQUESTED.	Fired whenever the control receives notice the F1 key (or some other acknowledged help key)	has been pressed. This is triggered by the underlying windowing system.	@event HelpEvent	@eventtype Control::HELP_REQUESTED	*/	DELEGATE(HelpRequested);	/**	@delegate FocusGained fires an FocusEvent, with a type set to Control::FOCUS_GAINED.	Fired whenever the control receives notice that it has become the focused control. This is	triggered by the underlying windowing system.	@event FocusEvent	@eventtype Control::FOCUS_GAINED	*/	DELEGATE(FocusGained);	/**	@delegate FocusLost fires an FocusEvent, with a type set to Control::FOCUS_LOST.	Fired whenever the control receives notice that it has lost focus. This is	triggered by the underlying windowing system.	@event FocusEvent	@eventtype Control::FOCUS_LOST	*/	DELEGATE(FocusLost);	/**	@delegate ToolTipRequested fires an ToolTipEvent, with a type set to TOOLTIP_EVENT_TIP_REQESTED.	This is fired if the VCF framework determines a tooltip can be displayed for this	control, and no tootip text was defined for the control.	@event ToolTipEvent	@eventtype TOOLTIP_EVENT_TIP_REQESTED	@see ToolTipEvent.h for more on TOOLTIP_EVENT_TIP_REQESTED #define	@see ToolTipEvent	*/	DELEGATE(ToolTipRequested);	/**	@delegate ToolTip fires an ControlEvent.	Fired by the framework when it determins a tooltip can be displayed for a control.	Typically this is caused by hovering the mouse over a control for some fixed amount	of time, usually determine by the underlying windowing system's setting.	@event ToolTipEvent	*/	DELEGATE(ToolTip);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -