Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update documentation

  • Loading branch information...
commit 2b28cf5f0294c258c140d19cf8b7aae6cee55b44 1 parent d0ed974
@vinniefalco authored
View
4 Builds/VisualStudio2010/VFLib.vcxproj.filters
@@ -933,8 +933,6 @@
<ItemGroup>
<None Include="..\..\README.md" />
<None Include="..\..\COPYRIGHT" />
- <None Include="..\..\Doxyfile">
- <Filter>VF Modules</Filter>
- </None>
+ <None Include="..\..\Doxyfile" />
</ItemGroup>
</Project>
View
180 modules/vf_gui/components/vf_ComponentBroadcast.h
@@ -35,120 +35,120 @@
/*============================================================================*/
/**
- Broadcast to a Component and its children, recursively.
+ Broadcast to a Component and its children, recursively.
- This class functor will traverse a Component and its children recursively
- and call a member function for each Component that exposes the desired
- interface. A Component exposes the interface by deriving from the class
- containing the member function of interest. The implementation uses
- dynamic_cast to determine if the Component is eligible, so the interface
- must have a virtual table.
+ This class functor will traverse a Component and its children recursively and
+ call a member function for each Component that exposes the desired interface.
+ A Component exposes the interface by deriving from the class containing the
+ member function of interest. The implementation uses `dynamic_cast` to
+ determine if the Component is eligible, so the interface must have a virtual
+ table.
- This provides robust assistance for enforcing separation of concerns, and
- decentralizing program logic into only the areas that need it.
+ This provides robust assistance for enforcing separation of concerns, and
+ decentralizing program logic into only the areas that need it.
- In this example we will define an interface for saving and restoring
- window settings into an XmlElement, declare a Component that supports
- the interface, and finally provide a function that calls all windows
- to save their settings:
+ In this example we will define an interface for saving and restoring
+ window settings into an XmlElement, declare a Component that supports
+ the interface, and finally provide a function that calls all windows
+ to save their settings:
- @code
+ @code
- // Interface for saving and loading Component settings across launches
+ // Interface for saving and loading Component settings across launches
- struct SerializableComponent
- {
- virtual void onSaveSettings (XmlElement* xml) { }
- virtual void onLoadSettings (XmlElement* xml) { }
- };
+ struct SerializableComponent
+ {
+ virtual void onSaveSettings (XmlElement* xml) { }
+ virtual void onLoadSettings (XmlElement* xml) { }
+ };
- // Declare our component
+ // Declare our component
- class PersistentComponent : public SerializableComponent
+ class PersistentComponent : public SerializableComponent
+ {
+ public:
+ void onSaveSettings (XmlElement* xmlTree)
{
- public:
- void onSaveSettings (XmlElement* xmlTree)
- {
- // Save our state into xmlTree
- }
+ // Save our state into xmlTree
+ }
- void onLoadSettings (XmlElement* xmlTree)
- {
- // Retrieve our saved state from xmlTree if it exists
- }
- };
+ void onLoadSettings (XmlElement* xmlTree)
+ {
+ // Retrieve our saved state from xmlTree if it exists
+ }
+ };
- // This will tell every component in every window to save
- // the settings if it supports the interface.
+ // This will tell every component in every window to save
+ // the settings if it supports the interface.
- void saveAllWindowSettings (XmlElement* xmlTree)
- {
- // Go through all application windows on the desktop.
+ void saveAllWindowSettings (XmlElement* xmlTree)
+ {
+ // Go through all application windows on the desktop.
- for (int i = 0; i < Desktop::getInstance().getNumComponents(); ++i)
- {
- Component* c = Desktop::getInstance().getComponent (i);
+ for (int i = 0; i < Desktop::getInstance().getNumComponents(); ++i)
+ {
+ Component* c = Desktop::getInstance().getComponent (i);
- // Call onSaveSettings for every Component that supports the
- // interface, on the window and all its children, recursively.
+ // Call onSaveSettings for every Component that supports the
+ // interface, on the window and all its children, recursively.
- componentBroadcast (c, &PersistentComponent::onSaveSettings, xmlTree);
- }
+ componentBroadcast (c, &PersistentComponent::onSaveSettings, xmlTree);
}
+ }
- // Create a ResizableWindow and tell it to load it's settings
+ // Create a ResizableWindow and tell it to load it's settings
- void createWindowFromSettings (XmlElement* xmlTree)
- {
- // First create the window
+ void createWindowFromSettings (XmlElement* xmlTree)
+ {
+ // First create the window
- ResizableWindow* w = new ResizableWindow (...);
+ ResizableWindow* w = new ResizableWindow (...);
- // Now call onLoadSettings for every Component in the window
- // that supports the interface, recursively.
+ // Now call onLoadSettings for every Component in the window
+ // that supports the interface, recursively.
- componentBroadcast (w, &PersistentComponent::onLoadSettings, xmlTree);
- }
+ componentBroadcast (w, &PersistentComponent::onLoadSettings, xmlTree);
+ }
- @endcode
+ @endcode
- componentBroadcast can even be used to call member functions of
- already existing interfaces, without changing any Component code! This
- example will automatically clear the contents of every child TextEditor
- Component in a DocumentWindow:
+ componentBroadcast can even be used to call member functions of
+ already existing interfaces, without changing any Component code! This
+ example will automatically clear the contents of every child TextEditor
+ Component in a DocumentWindow:
- @code
+ @code
- void clearAllTextEditors (DocumentWindow* window)
- {
- componentBroadcast (window, &TextEditor::clear);
- }
+ void clearAllTextEditors (DocumentWindow* window)
+ {
+ componentBroadcast (window, &TextEditor::clear);
+ }
- @endcode
+ @endcode
- Wow!
+ Wow!
- These are some of the benefits of using this system:
+ These are some of the benefits of using this system:
- - Code that broadcasts to the interface is generic. It doesn't need to
- know who is being called.
+ - Code that broadcasts to the interface is generic. It doesn't need to
+ know who is being called.
- - Components implementing the interface don't need to know about who
- is performing the broadcast.
+ - Components implementing the interface don't need to know about who
+ is performing the broadcast.
- - Components don't care where they are in the TopLevelWindow's hierarchy,
- they can be added, removed, or reparented without affecting a broadcaster
- or other recipients.
+ - Components don't care where they are in the TopLevelWindow's hierarchy,
+ they can be added, removed, or reparented without affecting a broadcaster
+ or other recipients.
- - If an individual child Component does not support the interface,
- it is simply skipped. This makes it easy to add broadcasting features
- to already written Component hierarchies.
+ - If an individual child Component does not support the interface,
+ it is simply skipped. This makes it easy to add broadcasting features
+ to already written Component hierarchies.
- - Broadcast interfaces can be broken up into any number of individual
- classes, they don't need to know about each other. A Component can
- expose zero, one, or any number of interfaces to receive broadcasts.
+ - Broadcast interfaces can be broken up into any number of individual
+ classes, they don't need to know about each other. A Component can
+ expose zero, one, or any number of interfaces to receive broadcasts.
- @ingroup vf_gui
+ @ingroup vf_gui
*/
class componentBroadcast
{
@@ -161,44 +161,46 @@ class componentBroadcast
to eight parameters. The parameters must match the signature
of the specified function.
*/
+ /** @{ */
template <class C>
componentBroadcast (Component* c, void (C::*f)())
- { call <C> (c, vf::bind (f, vf::_1)); }
+ { call <C> (c, vf::bind (f, vf::_1)); }
template <class C, class T1>
componentBroadcast (Component* c, void (C::*f)(T1), T1 t1)
- { call <C> (c, vf::bind (f, vf::_1, t1)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1)); }
template <class C, class T1, class T2>
componentBroadcast (Component* c, void (C::*f)(T1, T2), T1 t1, T2 t2)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2)); }
template <class C, class T1, class T2, class T3>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3), T1 t1, T2 t2, T3 t3)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3)); }
template <class C, class T1, class T2, class T3, class T4>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3, T4), T1 t1, T2 t2, T3 t3, T4 t4)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4)); }
template <class C, class T1, class T2, class T3, class T4, class T5>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3, T4, T5), T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5)); }
template <class C, class T1, class T2, class T3, class T4, class T5, class T6>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3, T4, T5, T6),
T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6)); }
template <class C, class T1, class T2, class T3, class T4, class T5, class T6, class T7>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3, T4, T5, T6, T7),
T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6, t7)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6, t7)); }
template <class C, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
componentBroadcast (Component* c, void (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8),
T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
- { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6, t7, t8)); }
+ { call <C> (c, vf::bind (f, vf::_1, t1, t2, t3, t4, t5, t6, t7, t8)); }
+ /** @} */
private:
template <class Interface, class Functor>
View
84 modules/vf_gui/components/vf_ComponentNotifyParent.h
@@ -35,65 +35,65 @@
/*============================================================================*/
/**
- Notify some parent of a Component.
+ Notify some parent of a Component.
- This class functor will ascend the chain of parent components and
- call a member function on the first parent it finds that exposes a
- defined interface. A Component exposes the interface by deriving from the
- class containing the member function of interest. The implementation uses
- dynamic_cast to determine if the Component is eligible, so the interface
- must have a virtual table.
+ This class functor will ascend the chain of parent components and call a
+ member function on the first parent it finds that exposes a defined interface.
+ A Component exposes the interface by deriving from the class containing the
+ member function of interest. The implementation uses `dynamic_cast` to
+ determine if the Component is eligible, so the interface must have a virtual
+ table.
- This provides robust assistance for enforcing separation of concerns, and
- decentralizing program logic into only the areas that need it.
+ This provides robust assistance for enforcing separation of concerns, and
+ decentralizing program logic into only the areas that need it.
- In this example we will implement a ToggleButton which switches a window
- between basic and advanced modes:
+ In this example we will implement a ToggleButton which switches a window
+ between basic and advanced modes:
- @code
+ @code
- // Interface for a window that has basic and advanced modes:
+ // Interface for a window that has basic and advanced modes:
- struct TwoModeWindow
- {
- virtual void onModeChanged (bool isAdvanced) = 0;
- };
+ struct TwoModeWindow
+ {
+ virtual void onModeChanged (bool isAdvanced) = 0;
+ };
- // A ToggleButton that switches between basic and advanced modes
+ // A ToggleButton that switches between basic and advanced modes
- class AdvancedModeToggleButton : public ToggleButton
+ class AdvancedModeToggleButton : public ToggleButton
+ {
+ public:
+ AdvancedModeToggleButton (String buttonText) : ToggleButton (buttonText)
{
- public:
- AdvancedModeToggleButton (String buttonText) : ToggleButton (buttonText)
- {
- setClickingTogglesState (true);
- }
+ setClickingTogglesState (true);
+ }
- void clicked ()
- {
- // Inform a parent that the window mode was changed
+ void clicked ()
+ {
+ // Inform a parent that the window mode was changed
- componentNotifyParent (this,
- &TwoModeWindow::onModeChanged,
- getToggleState ());
- }
- };
+ componentNotifyParent (this,
+ &TwoModeWindow::onModeChanged,
+ getToggleState ());
+ }
+ };
- @endcode
+ @endcode
- These are some of the benefits of using this system:
+ These are some of the benefits of using this system:
- - A Component sending a notification doesn't need to know about
- the recipient.
+ - A Component sending a notification doesn't need to know about
+ the recipient.
- - A Component doesn't need to know where it is in the hierarchy
- of components in the window. You can add, remove, or reparent
- controls without breaking anything.
+ - A Component doesn't need to know where it is in the hierarchy
+ of components in the window. You can add, remove, or reparent
+ controls without breaking anything.
- - Child and parent components support sending and receiving notifications
- for multiple interfaces very easily.
+ - Child and parent components support sending and receiving notifications
+ for multiple interfaces very easily.
- @ingroup vf_gui
+ @ingroup vf_gui
*/
class componentNotifyParent
{
View
16 modules/vf_gui/components/vf_TransparentBorder.h
@@ -35,17 +35,17 @@
/*============================================================================*/
/**
- Transparent border for an opaque Component.
+ Transparent border for an opaque Component.
- This lets you make the sides of a component draw with transparency,
- while allowing the rest to take advantage of the opaque Component
- optimization (see Component::setOpaque).
+ This lets you make the sides of a component draw with transparency,
+ while allowing the rest to take advantage of the opaque Component
+ optimization (see Component::setOpaque).
- To use this, add TransparentBorder as a member of your Component
- derived class. Then call setComponent with the size of the desired
- transparent border.
+ To use this, add TransparentBorder as a member of your Component
+ derived class. Then call setComponent with the size of the desired
+ transparent border.
- @ingroup vf_gui
+ @ingroup vf_gui
*/
class TransparentBorder
: private ComponentListener
Please sign in to comment.
Something went wrong with that request. Please try again.