void CWndTray::Notify( TNotifyUI &msg ) { __super::Notify(msg); if (msg.sType == DUI_MSGTYPE_CLICK) { if (msg.pSender->GetName() == _T("btn_set")) { HandleSet(); } else if (msg.pSender->GetName() == _T("btn_feedback")) { HandleFeedBack(); } else if (msg.pSender->GetName() == _T("btn_quit")) { HandleQuit(); } } }
/*---------------------------------------------------------------------------- DispatchEvent Handles all OSL messages that this object should handle ----------------------------------------------------------------------------*/ void AEGenericClass::DispatchEvent(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply) { OSErr err = noErr; AEEventID eventID; OSType typeCode; Size actualSize = 0L; // Get the event ID err = AEGetAttributePtr(appleEvent, keyEventIDAttr, typeType, &typeCode, (Ptr)&eventID, sizeof(eventID), &actualSize); ThrowIfOSErr(err); try { switch (eventID) { case kAEClone: HandleDuplicate(token, appleEvent, reply); break; case kAEClose: HandleClose(token, appleEvent, reply); break; case kAECountElements: HandleCount(token, appleEvent, reply); break; case kAECreateElement: HandleMake(token, appleEvent, reply); break; case kAEDelete: HandleDelete(token, appleEvent, reply); break; case kAEDoObjectsExist: HandleExists(token, appleEvent, reply); break; case kAEGetData: HandleGetData(token, appleEvent, reply); break; case kAEGetDataSize: HandleDataSize(token, appleEvent, reply); break; case kAEMove: HandleMove(token, appleEvent, reply); break; case kAEOpen: // == kAEOpenDocuments HandleOpen(token, appleEvent, reply); break; case kAEPrint: HandlePrint(token, appleEvent, reply); break; case kAEOpenApplication: HandleRun(token, appleEvent, reply); break; case kAEReopenApplication: HandleReOpen(token, appleEvent, reply); break; case kAEQuitApplication: HandleQuit(token, appleEvent, reply); break; case kAESave: HandleSave(token, appleEvent, reply); break; case kAESetData: HandleSetData(token, appleEvent, reply); break; // MT-NW suite case kAEExtract: HandleExtract(token, appleEvent, reply); break; case kAESendMessage: HandleSendMessage(token, appleEvent, reply); break; default: err = errAEEventNotHandled; break; } } catch (OSErr catchErr) { PutReplyErrorNumber(reply, catchErr); throw; } catch ( ... ) { PutReplyErrorNumber(reply, paramErr); throw; } }
bool pawsControlWindow::HandleWindowName(csString widgetStr) { csString widget; widgetStr.Downcase(); if(widgetStr == "options" ) widget = "ConfigWindow"; else if(widgetStr == "stats" || widgetStr =="skills") widget = "SkillWindow"; else if(widgetStr == "spell book" || widgetStr == "spells") widget = "SpellBookWindow"; else if(widgetStr == "inventory" || widgetStr == "inv") widget = "InventoryWindow"; else if(widgetStr == "help") widget = "HelpWindow"; else if(widgetStr == "buddy") widget = "BuddyWindow"; else if(widgetStr == "info") widget = "InfoWindow"; else if(widgetStr == "petition" || widgetStr == "petitions") widget = "PetitionWindow"; else if(widgetStr == "quest") widget = "QuestNotebook"; else if(widgetStr == "gm") widget = "GmGUI"; else if(widgetStr == "shortcut") widget = "ShortcutWindow"; else if(widgetStr == "group") widget = "GroupWindow"; else if(widgetStr == "guild") widget = "GuildWindow"; else if(widgetStr == "glyph") widget = "GlyphWindow"; else if(widgetStr == "sketch") widget = "SketchWindow"; else if(widgetStr == "merchant") widget = "MerchantWindow"; else if(widgetStr == "loot") widget = "LootWindow"; else if(widgetStr == "detail") widget = "DetailWindow"; else if(widgetStr == "exchange") widget = "ExchangeWindow"; else if(widgetStr == "write") widget = "WritingWindow"; else if(widgetStr == "read") widget = "BookReadingWindow"; else if(widgetStr == "questreward") widget = "QuestRewardWindow"; else if(widgetStr == "craft") widget = "CraftWindow"; else if(widgetStr == "ignore") widget = "IgnoreWindow"; else if(widgetStr == "bag" || widgetStr == "smallinventory") widget = "SmallInventoryWindow"; else if(widgetStr == "talk" || widgetStr == "chat" || widgetStr == "communications") widget = "ChatWindow"; else if(widgetStr == "activemagic") widget = "ActiveMagicWindow"; else if(widgetStr == "managepetitions") widget = "PetitionGMWindow"; else if(widgetStr == "quit") { HandleQuit(); return true; } else if(widgetStr == "buy") { psengine->GetCmdHandler()->Execute("/buy"); return true; } if(widget) HandleWindow(widget); else return false; return true; }
bool pawsControlWindow::OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* reporter ) { if(reporter->GetID() == CONTROL_MINIDOWN || reporter->GetID() == CONTROL_MINIUP) { if (mouseButton == csmbRight) { //If the user clicked on the right mouse button, switch to another style if ( !hidden ) //don't allow to change styles while the toolbar is closed NextStyle(); return true; } else if (mouseButton == csmbMiddle) { printf("Resetting toolbar to orginal size (%d,%d)\n",orgw,orgh); SetRelativeFrameSize(orgw,orgh); return true; } } switch ( reporter->GetID() ) { case CONTROL_MINIUP: { if ( !hidden ) Toggle(); return true; } case CONTROL_MINIDOWN: { if ( hidden ) Toggle(); return true; } case CONTROL_QUIT: { HandleQuit(); return true; } //////////////////////////////////////////////////////////////////// //Special cases that need more than the standard to open correctly //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// // These two are from the confirm window buttons for quiting. //////////////////////////////////////////////////////////////////// case CONFIRM_YES: { psengine->QuitClient(); return true; } case CONFIRM_NO: { PawsManager::GetSingleton().SetModalWidget( 0 ); reporter->GetParent()->Hide(); return true; } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //Default handle for windows //////////////////////////////////////////////////////////////////// default: { pawsWidget* wdg = FindWidget(reporter->GetID()); if (!wdg) return false; pawsControlledWindow* wnd = FindWindowFromButton(wdg->GetName()); if (!wnd) return false; HandleWindow(wnd->GetName()); return true; } } return false; }
void HandleRequest() { char* token; short keep_processing = 1; int offset; DebugPrint("Received request %s" _C_ recv_buffer); token = FirstToken(); while (token != 0 && keep_processing) { switch (to_request(token)) { case ACTIVITY: HandleActivity(); break; case COMMAND: // COMMAND HandleCommand(); break; case EXIT: // EXIT HandleQuit(); break; case GET: // GET HandleGet(); break; case KILL: HandleKill(); break; case LISPGET: // LISPGET {STATE | GAMEINFO | MAPINFO} HandleLispGet(); break; case MAP: // Load new map if (HandleNewMap()) { LastPausedCycle = 0; keep_processing = 0; } break; case PING: // PING HandlePing(); break; case QUIT: // QUIT HandleQuit(); break; case RESTART: // RESTART / RESET HandleRestart(); LastPausedCycle = 0; keep_processing = 0; break; case SPEED: // SPEED HandleSpeed(); break; case TRANSITION: // TRANSITION HandleTransition(); keep_processing = 0; break; case VIDEO: // VIDEO HandleVideo(); break; case WRITE: HandleWrite(); break; case CYCLE: HandleGetCycle(); break; case Z: HandleRandomSeed(); break; default: SendResponseMessage("Unknown command.\n", 3); } token = NextToken(); } // Bring pending commands to the front of recv_buffer if (token != 0) { offset = token + strlen(token) - temp_buffer; temp_buffer[offset] = recv_buffer[offset]; strcpy(recv_buffer, token); } else memset(recv_buffer, 0, RECV_BUFFER_SIZE); // Clear the command buffer }