Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSMenuItem.cpp

Go to the documentation of this file.
00001 #ifdef WIN32
00002 #pragma warning(disable : 4786 )
00003 #endif
00004 
00005 #include "CSMenuItem.h"
00006 #include "CSFont.h"
00007 
00008 const char *CSMenuItem::CLASS = "CSMenuItem";
00009 
00010 CSMenuItem::CSMenuItem(const std::string &itemName) : CSMenu(itemName)
00011 {
00012     static char *functionName="CSMenuItem";
00013     LOG_ENTER 
00014     MESSAGE_MENUITEM_ACTIVATED.setSubtype(MENUITEM_ACTIVATED_MESSAGE);
00015     setFocusable(false);
00016     LOG_EXIT
00017 }
00018 
00019 void CSMenuItem::reactOnMessage(CSMessage *message)
00020 {
00021     reactOnMessageMenuItem(message);
00022 }
00023 
00024 void CSMenuItem::reactOnMessageMenuItem(CSMessage *message)
00025 {
00026     static char *functionName="reactOnMessage";
00027     if (message->mIsHandled)
00028     {
00029         reactOnMessageMenu(message);
00030         return;
00031     }
00032     if (message->getType() == GUI_MESSAGE)
00033     {
00034         GuiMessage *gm = (GuiMessage *) message;
00035         if (isChild(gm->receiver))
00036         //else // receiver == this
00037         {
00038             switch (message->getSubtype())
00039             {
00040                 case MOUSE_MOTION_LOST_MESSAGE:
00041                 {
00042                     mBorderState = mBorderState & (~BUTTON_VISIBLE);
00043                     gm->mIsHandled = true;
00044                     break;
00045                 }
00046                 case MOUSE_MOTION_MESSAGE:
00047                 {
00048                     mBorderState = mBorderState | BUTTON_VISIBLE;
00049                     mBorderState = mBorderState | BUTTON_HOVERING;
00050                     gm->mIsHandled = true;
00051                     break;
00052                 }
00053                 case MOUSE_BUTTON_PRESSED_MESSAGE:
00054                 {
00055                     mBorderState = mBorderState | BUTTON_PRESSED;
00056                     gm->mIsHandled = true;
00057                     break;
00058                 }
00059 
00060                 case MOUSE_BUTTON_RELEASED_MESSAGE:
00061                 {
00062                     mBorderState = BUTTON_DEFAULT;
00063                     if (isChild(gm->downReceiver))
00064                     {
00065                         CSDesktop *desktop = getDesktop();
00066                         if (desktop == 0)
00067                         {
00068                             break;
00069                         }
00070                         desktop->setFocusedComponent(0);
00071                         MESSAGE_MENUITEM_ACTIVATED.actionId = mActionId;
00072                         MESSAGE_MENUITEM_ACTIVATED.mIsHandled = false;
00073                         sendMessage(MESSAGE_MENUITEM_ACTIVATED);
00074                     }
00075                     gm->mIsHandled = true;
00076                     break;
00077                 }
00078             }
00079         }
00080         else
00081         //if (gm->receiver != this)
00082         {
00083             if (message->getSubtype() == MOUSE_BUTTON_RELEASED_MESSAGE)
00084             {
00085                 mBorderState = BUTTON_DEFAULT;
00086             }
00087         }
00088     }
00089 }
00090 
00091 void CSMenuItem::layoutSetupMenuItem()
00092 {
00093     static char *functionName="layoutSetupMenuItem";
00094     LOG_ENTER 
00095     layoutSetupMenu();
00096     LOG_EXIT
00097 }
00098 
00099 

Generated on Wed Jul 14 00:43:30 2004 for CSLib by doxygen 1.3.6