os::ColorRequester Class Reference
[The Syllable Graphical User Interface API]

Color Requester. More...

Inheritance diagram for os::ColorRequester:

os::Window os::Looper os::Handler List of all members.

Public Member Functions

 ColorRequester (os::Messenger *pcTarget=NULL)
 ~ColorRequester ()

Protected Member Functions

virtual void HandleMessage (os::Message *)
 Handle a message targeted at this handler.
bool OkToQuit ()
 Check if it is ok to break the loop.

Classes

class  Private

Detailed Description

Description:
The Color Requester is the default way to pick colors in Syllable. The Color Requester is very easy to use. The following messages are sent to the given message target: M_COLOR_REQUESTER_CANCELED - If the ColorRequester is closed without any action. M_COLOR_REQUESTED - If a Color has been selected to be loaded. M_COLOR_REQUESTER_CHANGED - The use of this message will allow you to determine when the user has changed the color. This can be used to show the color to the user without having them commit to any changes/
Warning:
As with all libSyllable objects, don't use the ColorRequester without an application object.
Note:
The ColorRequester is sent an os::Messenger telling it where to send its messages to. If you send NULL to or use the default parameters, the ColorRequester will send all messages to the instance of the application calling it.
Note:
The ColorRequester is centered in the middle of the screen by default, you can override this at anytime after calling an instance of the dialog.
Example:
  ColorRequester* pcColorRequester = new ColorRequester(NULL);
  pcColorRequester->Show();

  ...

  MyApplication::HandleMessage(Message* pcMessage)
  {
                switch (pcMessage->GetCode())
        {
                        case M_COLOR_REQUESTED:
                {
                os::Color32_s sColor
                pcMessage->FindColor("color",&sColor);  //get the color from the requester and then do anything you want with it
                pcMyView->SetBgColor(sColor);
                break;
                }
         
                        //this message is useful if you want to update a gui without hitting the okay button
                        case M_COLOR_REQUESTER_CHANGED:
                {
                os::Color32_s sColor
                pcMessage->FindColor("color",&sColor);  //get the color from the requester and then do anything you want with it
                pcMyView->SetBgColor(sColor);
                break;
                        }
                case M_COLOR_REQUESTER_CANCELED:
                {
                break; //do whatever you need to do when cancelled is called.
                }
        }
  }
See also:
os::Color32_s, os::Message, os::Application, os::Window, os::FileRequester, os::FontRequester, os::Messenger
Author:
Rick Caudill <[email protected]>


Constructor & Destructor Documentation

ColorRequester::ColorRequester ( os::Messenger pcTarget = NULL  ) 

ColorRequester::~ColorRequester (  ) 


Member Function Documentation

void ColorRequester::HandleMessage ( os::Message pcMessage  )  [protected, virtual]

Description:
Overload this member to dispatch messages sendt to this handler. When a looper receives a message for one of it's handlers it will call the taget handlers HandleMessage() to allow the handler to dispatch the message.
The message passed in pcMessage is also available through os::Looper::GetCurrentMessage() and os::Looper::DetachCurrentMessage() until this member returns. This is normally not very usefull for HandleMessage() itself but it can be convinient for other members called from HandleMessage() in case they need data from the message that was not passed on from HandleMessage().
The looper will be locked when this member is called. The default implementation of this member will pass the message on to the next handler if one was set with SetNextHandler().
Note:
Never do any lenthy operations in any hook members that are called from the looper thread if the looper is involved with the GUI (for example if the looper is a os::Window). The looper will not be able to dispatch messages until the hook returns so spending a long time in this members will make the GUI feel unresponsive.
Parameters:
pcMessage The message that should be handled. This message will be deleted by the looper when HandleMessage() returns unless you detach it with os::Looper::DetachCurrentMessage(),
See also:
os::Looper::DispatchMessage(), os::Looper::DetachCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::Handler.

bool ColorRequester::OkToQuit ( void   )  [protected, virtual]

Description:
You can overload this function to affect how the looper will react to M_QUIT messages. When an M_QUIT message arrive the looper will call this function to figure out what to do. If it returns false the message is ignored. If it returns true the loop is terminated, the looper object deleted and the looper thread will exit.
Returns:
true if it is ok to terminate the looper, false otherwise.
See also:
Quit(), PostMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::Looper.


Generated on Sat May 9 22:51:22 2009 for Syllable higlevel API by  doxygen 1.5.1