void TestWidget::Receive ( JBroadcaster* sender, const Message& message ) { JXWindow* window = GetWindow(); // insure that it isn't const JXWindowIcon* windowIcon = NULL; if (sender == itsAnimButton && message.Is(JXButton::kPushed)) { if (GetCursorAnimator() == NULL) { CreateCursorAnimator(); itsAnimButton->SetShortcuts("^o^m"); itsAnimButton->SetLabel("Stop"); if (itsAnimColorTask != NULL) { (JXGetApplication())->InstallIdleTask(itsAnimColorTask); } } else { RemoveCursorAnimator(); itsAnimButton->SetLabel("Start"); itsAnimButton->SetShortcuts("#a"); (JXGetApplication())->RemoveIdleTask(itsAnimColorTask); } } else if (sender == itsQuitButton && message.Is(JXButton::kPushed)) { (JXGetApplication())->Quit(); } else if (window->GetIconWidget(&windowIcon) && sender == windowIcon && message.Is(JXWindowIcon::kHandleDrop)) { const JXWindowIcon::HandleDrop* data = dynamic_cast(const JXWindowIcon::HandleDrop*, &message); assert( data != NULL ); HandleDNDDrop(JPoint(0,0), data->GetTypeList(), data->GetAction(), data->GetTime(), data->GetSource()); } else if (sender == window && message.Is(JXWindow::kIconified))
void TestWidget::Receive ( JBroadcaster* sender, const Message& message ) { JXWindow* window = GetWindow(); // insure that it isn't const JXWindowIcon* windowIcon = NULL; if (sender == itsAnimButton && message.Is(JXButton::kPushed)) { if (GetCursorAnimator() == NULL) { CreateCursorAnimator(); itsAnimButton->SetShortcuts("^o^m"); itsAnimButton->SetLabel("Stop"); } else { RemoveCursorAnimator(); itsAnimButton->SetLabel("Start"); itsAnimButton->SetShortcuts("#a"); } } else if (sender == itsQuitButton && message.Is(JXButton::kPushed)) { (JXGetApplication())->Quit(); } else if (window->GetIconWidget(&windowIcon) && sender == windowIcon && message.Is(JXWindowIcon::kHandleDrop)) { const JXWindowIcon::HandleDrop* data = dynamic_cast<const JXWindowIcon::HandleDrop*>(&message); assert( data != NULL ); HandleDNDDrop(JPoint(0,0), data->GetTypeList(), data->GetAction(), data->GetTime(), data->GetSource()); } else if (sender == itsActionsMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdateActionsMenu(); } else if (sender == itsActionsMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandleActionsMenu(selection->GetIndex()); } else if (sender == itsPointMenu && message.Is(JXMenu::kNeedsUpdate)) { UpdatePointMenu(); } else if (sender == itsPointMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); HandlePointMenu(selection->GetIndex()); } else if (sender == itsSecretMenu && message.Is(JXMenu::kItemSelected)) { const JXMenu::ItemSelected* selection = dynamic_cast<const JXMenu::ItemSelected*>(&message); assert( selection != NULL ); if (selection->GetIndex() == kSecretMenuDialogCmd) { (JGetUserNotification())->DisplayMessage( "This message is generated by an item on the secret popup menu."); } } else if (sender == itsResizeDialog && message.Is(JXDialogDirector::kDeactivated)) { const JXDialogDirector::Deactivated* info = dynamic_cast<const JXDialogDirector::Deactivated*>(&message); assert( info != NULL ); if (info->Successful()) { ChangeSize(); } itsResizeDialog = NULL; } else { JXScrollableWidget::Receive(sender, message); } }