component.h

来自「这是VCF框架的代码」· C头文件 代码 · 共 775 行 · 第 1/2 页

H
775
字号
	@see addComponent()	*/	Component* getOwner() {		return owner_;	}	/**	Returns the Action associated with this component. Any component	can have an action associated with it. This allows multiple component	components (like a menu item, and a push button) to share the same action	and to respond in a coordinated manner to changes in state.	*/	Action* getAction() {		return action_;	}	/**	Set's the action for the component.	*/	void setAction( Action* action );	/**	Calling this triggers an update event to be fired.	The default behaviour is to see if the component has an action 	associated with it, and then calls the action's update()	method. 	@return bool the method returns true if the component has an	action and the action's update() method is called. Otherwise 	it returns false.	@see Action::update()	*/	virtual bool updateAction();	/**	Adds the component to the framework's update list. This list	will be traversed periodically, during idle time, and the 	framework will create a COMPONENT_NEEDS_UPDATING	event and pass it to the component. The component can specialize this	functionality by customizing the behaviour of the handleEvent() method.	*/	void addToUpdateList();	/**	Removes the component from the framework's update list.	*/	void removeFromUpdateList();	/**	Allows the user to control whether or not the component should 	attempt to translate the text of a specific component. This is typically 	used in derived control classes paint() methods, which would check this value	before calling System::getCurrentThreadLocale()->translate() to 	translate the text to a specific locale sensitive value. Setting this	value will also set it for any child components.	@param bool A boolean value that indicates whether or not a  	lookup should be made based on the current thread's locale to	translate any text that needs displaying. A value of true means the	lookup should take place, a value of false means the lookup should be 	ignored.	@see Locale	@see System::getCurrentThreadLocale	*/	void setUseLocaleStrings( const bool& val );	/**	Returns a value indicating whether or not the component will attempt 	to translate any text using the current thread's locale. By	default, this is true.	@return bool A boolean value that indicates whether or not a  	lookup will be made based on the current thread's locale to	translate any text that needs displaying. A value of true means the	lookup will take place, a value of false means the lookup will be 	ignored.	*/	bool getUseLocaleStrings() {		return useLocaleStrings_;	}	/**	registers a component in the system component map. The map is organized into	a series of keys called categories, with 1 or more entries in each category.	The UIToolkit registers the default ApplicationKit components, and other developers may	use this to extend the list with their own components.	*/	static bool registerComponent( const String& componentClassName, const String& category );	/**	Used by IDE's to list the various Component classes for a given category. Each Class pointer	that is contained in the Enumerator guarantees the ability to create an instance	of the component it represents.	*/	static Enumerator<Class*>* getComponentClassesForCategory( const String& category );	/**	returns a list of all the known, registered, component categories. These in turn	may be used to gather the classes for each category with a call to the getComponentClassesForCategory()	static method.	@see Component::getComponentClassesForCategory()	*/	static Enumerator<String>* getRegisteredComponentCategories();	/**	*	*/	static void initComponentRegistrar();	/**	*	*	*/	static void clearRegistedComponents();	/**	Takes a valid component instance and initializes it from a VFF file that	is assumed to be present in the programs resource bundle.	*/	static void initComponent( Component* instance, Class* clazz, Class* rootClazz, ResourceBundle* resBundle=NULL );	static Component* createComponentFromResources( Class* clazz, Class* rootClazz, ResourceBundle* resBundle=NULL );protected:	/**	*	*	*/	virtual void destroy();protected:	/**	*	*	*/	Component* owner_;	ulong32 componentState_;	String name_;	long tag_;	Action* action_;	std::vector<Component*> components_;	EnumeratorContainer<std::vector<Component*>, Component*> componentContainer_;		/**	*	*	*/	bool useLocaleStrings_;	/**	a map of component classes to categories	*/	static std::map<String,std::vector<Class*>*>* registeredComponentMap;	static std::vector<String>* registeredCategory;	static EnumeratorContainer<std::vector<String>,String>* registeredCategoryContainer;	static EnumeratorContainer<std::vector<Class*>,Class*>* registeredCompContainer;};}; // namespace VCF/***CVS Log info*$Log$*Revision 1.5  2006/04/07 02:35:22  ddiego*initial checkin of merge from 0.6.9 dev branch.**Revision 1.4.2.4  2006/03/28 04:10:17  ddiego*tweaked some function names for the update process.**Revision 1.4.2.3  2006/03/14 02:25:46  ddiego*large amounts of source docs updated.**Revision 1.4.2.2  2005/08/27 04:49:35  ddiego*menu fixes.**Revision 1.4.2.1  2005/08/24 05:03:21  ddiego*better component loading and creation functions.**Revision 1.4  2005/07/09 23:14:52  ddiego*merging in changes from devmain-0-6-7 branch.**Revision 1.3.2.3  2005/05/15 23:17:37  ddiego*fixes for better accelerator handling, and various fixes in hwo the text model works.**Revision 1.3.2.2  2005/05/05 12:42:26  ddiego*this adds initial support for run loops,*fixes to some bugs in the win32 control peers, some fixes to the win32 edit*changes to teh etxt model so that notification of text change is more*appropriate.**Revision 1.3.2.1  2005/03/06 22:50:58  ddiego*overhaul of RTTI macros. this includes changes to various examples to accommadate the new changes.**Revision 1.3  2004/12/01 04:31:20  ddiego*merged over devmain-0-6-6 code. Marcello did a kick ass job*of fixing a nasty bug (1074768VCF application slows down modal dialogs.)*that he found. Many, many thanks for this Marcello.**Revision 1.2.2.2  2004/11/07 19:32:18  marcelloptr*more documentation**Revision 1.2.2.1  2004/09/21 23:41:23  ddiego*made some big changes to how the base list, tree, text, table, and tab models are laid out. They are not just plain interfaces. The actual*concrete implementations of them now derive from BOTH Model and the specific*tree, table, etc model interface.*Also made some fixes to the way the text input is handled for a text control.*We now process on a character by character basis and modify the model one*character at a time. Previously we were just using brute force and setting*the whole models text. This is more efficent, though its also more complex.**Revision 1.2  2004/08/07 02:49:06  ddiego*merged in the devmain-0-6-5 branch to stable**Revision 1.1.2.5  2004/07/09 03:39:28  ddiego*merged in changes from the OSX branch for new theming API. Added*support for controlling the use of locale translated strings in components.**Revision 1.1.2.4  2004/06/06 07:05:29  marcelloptr*changed macros, text reformatting, copyright sections**Revision 1.1.2.3  2004/06/05 02:57:09  ddiego*fixed a syntax mistake that tinkham pointed out.The problem was that the findComponent() method was incorrectly declared.**Revision 1.1.2.2  2004/04/29 03:43:12  marcelloptr*reformatting of source files: macros and csvlog and copyright sections**Revision 1.1.2.1  2004/04/28 00:28:15  ddiego*migration towards new directory structure**Revision 1.27.2.1  2004/04/26 21:58:18  marcelloptr*changes for dir reorganization: _VCF_MACRO_H__**Revision 1.27  2004/04/03 15:48:39  ddiego*Merged over code from the 0-6-3 branch.**Revision 1.26  2004/01/20 01:54:55  ddiego*merged some more changes from dev branch, primarily changes to*teh RTTI API so that we now process enum sets correctly (i.e. a long*that is a mask made of enum values).**Revision 1.24.2.2  2004/01/16 04:30:46  ddiego*some more minor mods to menus and the Component class. Added some utility*methods for determining the state of a component, and added two new*delegates for firing events when the component is loaded and saved,*as well as value changes for the COmponentState enum so that some of*the values of the component state can be OR'd together.**Revision 1.24.2.1  2004/01/15 05:35:03  ddiego*making some minor changes so that nested menu components get handled*correctly and added from a VFF file**Revision 1.24.2.2  2004/01/16 04:30:46  ddiego*some more minor mods to menus and the Component class. Added some utility*methods for determining the state of a component, and added two new*delegates for firing events when the component is loaded and saved,*as well as value changes for the COmponentState enum so that some of*the values of the component state can be OR'd together.**Revision 1.24.2.1  2004/01/15 05:35:03  ddiego*making some minor changes so that nested menu components get handled*correctly and added from a VFF file**Revision 1.24  2003/12/18 05:15:56  ddiego*merge from devmain-0-6-2 branch into the stable branch**Revision 1.23.4.8  2003/12/13 15:56:08  ddiego**** empty log message *****Revision 1.23.4.7  2003/12/08 05:05:27  ddiego*added a bunch more documentation to classes, and added support for new doc*keywords (@delegates, @del, @delegate, @event, and @eventtype). This*makes it easier to see at a glance what events a class fires off.*Added finishing touches for the Action implementation and have a partially*complete example for this checked in.**Revision 1.23.4.6  2003/12/02 05:50:05  ddiego*added preliminary support for teh Action class. This will make it easier*to hook up complimentary UI elements (such as a "copy" menu item, and a*"copy" toolbar item) and have tehm respond to update and actions via a*single source.*Got rid of the old toolbar button and separator class. Merged in Marcellos*new fixes for the Container and Splitter classes.*Some misc fixes to the Toolbar, groups and checks now work correctly.**Revision 1.23.4.5  2003/09/21 04:15:34  ddiego*moved the cvs info data to teh bottom of the header instead of the*top so it is easier to get to the actual header class declarations*instead of having to wade through all the cvs info stuff.**Revision 1.23.4.4  2003/09/12 00:09:32  ddiego*added better tabbing behaviour - fixed an earlier bug.*Code is easier to understand and it simplified the implementation*a bit as well*Moved around the RTTI definitions for various Appkit classes to a*single inline and stripped them from the various class headers**Revision 1.23.4.3  2003/09/06 19:45:44  ddiego*changes to ensure that the destroy() is properly called.*Destructors were moved back to pbulic scope in case that was causing a bug.*Moving them all(all teh component derived classes) to private scope causes*a complete failure in hte VC6 compiler. Alas...*So destructors are present, and modal dialogs can still be created on the*stack, but almost any other component should be created on the heap, and*gotten rid of via free() NOT using operator delete directly.*also moved the vcs info to the end of the file for some of the headers*This will be an ongoing process.**Revision 1.23.4.2  2003/09/05 21:03:38  ddiego*moved the various control destructor's to protected scope*migrated code into destroy() overridden methods*----------------------------------------------------------------------**Revision 1.23.4.1  2003/09/02 02:11:14  ddiego*fixed some glitches in drag drop. also cleaned up the drag drop event*classes. Began some fixes to the html browser implementation on Win32**Revision 1.23  2003/05/17 20:37:01  ddiego*this is the checkin for the 0.6.1 release - represents the merge over from*the devmain-0-6-0 branch plus a few minor bug fixes**Revision 1.22.2.2  2003/03/23 03:23:45  marcelloptr*3 empty lines at the end of the files**Revision 1.22.2.1  2003/03/12 03:09:23  ddiego*switched all member variable that used the "m_"<name> prefix to* <name>"_" suffix nameing standard.*Also changed all vcf builder files to accomadate this.*Changes were made to the Stream classes to NOT multiple inheritance and to*be a little more correct. Changes include breaking the FileStream into two*distinct classes, one for input and one for output.**Revision 1.22  2003/02/26 04:30:37  ddiego*merge of code in the devmain-0-5-9 branch into the current tree.*most additions are in the area of the current linux port, but the major*addition to this release is the addition of a Condition class (currently*still under development) and the change over to using the Delegate class*exclusively from the older event handler macros.**Revision 1.21.14.3  2003/02/24 05:42:17  ddiego*moved the code for the VariantData calss into it's own header*migrated to the new event style using Delegates instead of relying on*the ugly macros that we were using before - same functionality though*made sure everything still works and compiles, including neccessary*changes in the VCF Builder so that it creates code in the new style*This changes to teh new style of using Delegates completes task 58837**Revision 1.21.14.2  2003/01/08 00:19:42  marcelloptr*mispellings and newlines at the end of all source files**Revision 1.21.14.1  2002/12/25 22:06:16  ddiego*whole bunch of little changes to the header files used by the ApplicationKit*to get rid of no newline warnings by gcc.*fixes to various event handlers in the ApplicationKit to compile with gcc*since gcc does not like a member function pointer without the "&"*addressof operator.*Added initial file for the X11 UIToolkit implementation**Revision 1.21  2002/05/09 03:10:42  ddiego*merged over code from development branch devmain-0-5-1a into the main CVS trunk**Revision 1.20.4.1  2002/04/27 15:41:54  ddiego*removed ApplicationKit.h and optimized header includes as*well as adding better include guard support**Revision 1.20  2002/02/20 04:07:49  ddiego*consolidated event handling code a bit*introduced a virtual handleEvent() method to Component*clean up some of the event constants, so they are now localized in the*appropriate control classes.**Revision 1.19  2002/01/24 01:46:47  ddiego*added a cvs "log" comment to the top of all files in vcf/src and vcf/include*to facilitate change tracking**/#endif // _VCF_COMPONENT_H__

⌨️ 快捷键说明

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