bool ListControl::OnMouseUp(PixelScalar x, PixelScalar y) { if (scroll_bar.IsDragging()) { scroll_bar.DragEnd(this); return true; } if (drag_mode == DragMode::CURSOR && x >= 0 && x <= ((PixelScalar)GetWidth() - scroll_bar.GetWidth())) { drag_end(); ActivateItem(); return true; } if (drag_mode == DragMode::SCROLL || drag_mode == DragMode::CURSOR) { drag_end(); #ifndef _WIN32_WCE kinetic.MouseUp(GetPixelOrigin()); kinetic_timer.Schedule(30); #endif return true; } else return PaintWindow::OnMouseUp(x, y); }
bool ListControl::OnMouseUp(PixelPoint p) { if (scroll_bar.IsDragging()) { scroll_bar.DragEnd(this); return true; } if (drag_mode == DragMode::CURSOR && p.x >= 0 && p.x <= ((int)GetWidth() - scroll_bar.GetWidth())) { drag_end(); ActivateItem(); return true; } if (drag_mode == DragMode::SCROLL || drag_mode == DragMode::CURSOR) { const bool enable_kinetic = UsePixelPan() && drag_mode == DragMode::SCROLL; drag_end(); if (enable_kinetic) { kinetic.MouseUp(GetPixelOrigin()); kinetic_timer.Schedule(30); } return true; } else return PaintWindow::OnMouseUp(p); }
bool ListControl::OnKeyDown(unsigned key_code) { scroll_bar.DragEnd(this); kinetic_timer.Cancel(); switch (key_code) { case KEY_RETURN: if (CanActivateItem()) ActivateItem(); return true; case KEY_UP: // previous item if (GetCursorIndex() <= 0) break; MoveCursor(-1); return true; case KEY_DOWN: // next item if (GetCursorIndex() +1 >= length) break; MoveCursor(1); return true; case KEY_LEFT: // page up MoveCursor(-(int)items_visible); return true; case KEY_RIGHT: // page down MoveCursor(items_visible); return true; case KEY_HOME: SetCursorIndex(0); return true; case KEY_END: if (length > 0) { SetCursorIndex(length - 1); } return true; case KEY_PRIOR: MoveCursor(-(int)items_visible); return true; case KEY_NEXT: MoveCursor(items_visible); return true; } return PaintWindow::OnKeyDown(key_code); }
bool ListControl::OnKeyDown(unsigned key_code) { scroll_bar.DragEnd(this); #ifndef _WIN32_WCE kinetic_timer.Cancel(); #endif switch (key_code) { #ifdef GNAV // JMW added this to make data entry easier case KEY_APP4: #endif case KEY_RETURN: if (CanActivateItem()) ActivateItem(); return true; case KEY_UP: case KEY_LEFT: if (!HasPointer() ^ (key_code == KEY_LEFT)) { // page up MoveCursor(-(int)items_visible); return true; } else { // previous item if (GetCursorIndex() <= 0) break; MoveCursor(-1); return true; } case KEY_DOWN: case KEY_RIGHT: if (!HasPointer() ^ (key_code == KEY_RIGHT)) { // page down MoveCursor(items_visible); return true; } else { // next item if (GetCursorIndex() +1 >= length) break; MoveCursor(1); return true; } case KEY_HOME: SetCursorIndex(0); return true; case KEY_END: if (length > 0) { SetCursorIndex(length - 1); } return true; case KEY_PRIOR: MoveCursor(-(int)items_visible); return true; case KEY_NEXT: MoveCursor(items_visible); return true; } return PaintWindow::OnKeyDown(key_code); }
void tpAppController::onEvent(const apEvent& eve, bool& vetoEvent) { GT_UNREFERENCED_PARAMETER(vetoEvent); // Get the event type: apEvent::EventType eventType = eve.eventType(); // handle the Global var changed event switch (eventType) { case apEvent::GD_MONITORED_OBJECT_ACTIVATED_EVENT: { // Get the activation event: const apMonitoredObjectsTreeActivatedEvent& activationEvent = (const apMonitoredObjectsTreeActivatedEvent&)eve; // Get the item data; afApplicationTreeItemData* pItemData = (afApplicationTreeItemData*)activationEvent.selectedItemData(); if (pItemData != nullptr) { // Check if the file is of offline/online profiling. if it is Activate the item: tpSessionTreeNodeData* pExtenedData = qobject_cast<tpSessionTreeNodeData*>(pItemData->extendedItemData()); if (pExtenedData != nullptr) { // Display the item (is this is a power profile tree node): bool rc = ActivateItem(pItemData->m_pTreeWidgetItem); GT_ASSERT(rc); } } } break; case apEvent::APP_GLOBAL_VARIABLE_CHANGED: { const afGlobalVariableChangedEvent& globalVarChangedEvent = dynamic_cast<const afGlobalVariableChangedEvent&>(eve); // Get id of the global variable that was changed afGlobalVariableChangedEvent::GlobalVariableId variableId = globalVarChangedEvent.changedVariableId(); // If the project file path was changed if (variableId == afGlobalVariableChangedEvent::CURRENT_PROJECT) { // Initialize the sessions for this project: ProjectOpened(); } } break; case apEvent::AP_PROFILE_PROCESS_TERMINATED: { const apProfileProcessTerminatedEvent& profileProcessTerminateEvent = dynamic_cast<const apProfileProcessTerminatedEvent&>(eve); if (profileProcessTerminateEvent.profilerName() == CP_STR_ThreadProfileExtensionW) { SharedProfileManager::instance().stopCurrentRun(); } } break; default: break; } }
//---------------------------------------------------------------------------// // // //函数:void ShowMenu_Item(unsigned char ,unsigned char,unsigned char) // //描述:显示菜单项子函数 // //参数:index ——菜单项索引 // // no ——显示位置序号 // // mode ——显示模式 // // // //---------------------------------------------------------------------------// void RunMenu(unsigned char index) { char key,i,Active_Item = 0x00 ; OS_U8 Event ; union { unsigned int pos[2] ; char byte[4] ; }TPoint ; Ini_Background: Color = Black ; Color_BK = 0xEF9F ; Clear_LCD(Color_BK) ; DrawRectFill(0,0,240,25,Blue) ; DrawRectFill(0,295,240,25,Blue) ; Color = 0xFFFF ; Color_BK = Blue ; PutStringCN16(4,4,(unsigned char *)Menus[index].MenuTitle) ; Color = Black ; Color_BK = WINDOW_BK_COLOR ; for(i=0;i<Menus[index].MenuConfig[0];i++) { if(i==Active_Item) ShowMenu_Item(Menus[index].ItemIndex[i],i,1) ; else ShowMenu_Item(Menus[index].ItemIndex[i],i,0) ; } for(;;) { // Event = OS_WaitEvent(EVENT_KEY_PRESSED+EVENT_TP_PRESSED) ; OS_WaitMail(&MBKey) ; // if(Event&EVENT_KEY_PRESSED) { OS_GetMail1(&MBKey, &key) ; switch(key) { case Right: InactivateItem(Active_Item) ; if(++Active_Item>=Menus[index].MenuConfig[0]) Active_Item = 0x00 ; ActivateItem(Active_Item) ; break ; case Left: InactivateItem(Active_Item) ; if(Active_Item==0) Active_Item = 0x08 ; else Active_Item-- ; ActivateItem(Active_Item) ; break ; case 8: InactivateItem(Active_Item) ; if(Active_Item==0) Active_Item = 0x08 ; else if(Active_Item==1||Active_Item==2) Active_Item = Active_Item+5 ; else Active_Item = Active_Item-3 ; ActivateItem(Active_Item) ; break ; case 0: InactivateItem(Active_Item) ; if(Active_Item==8) Active_Item = 0x00 ; else if(Active_Item==6||Active_Item==7) Active_Item = Active_Item-5 ; else Active_Item = Active_Item+3 ; ActivateItem(Active_Item) ; break ; case Enter: OS_PutMail1(&MBFunc, &Active_Item) ; OS_SignalEvent(EVENT_OP_STARTED,&MENU_OP_TASK_TCB) ; OS_Suspend(&LCD_TASK_TCB) ; goto Ini_Background ; default: break ; } } /* else { OS_GetMail(&MBTouch, TPoint.byte) ; for(i=0;i<Menus[index].MenuConfig[0];i++) { if( (TPoint.pos[0]<(60+i%3*80)&&TPoint.pos[0]>(20+i%3*80)) &&(TPoint.pos[1]<(95+i/3*84)&&TPoint.pos[1]>(55+i/3*82))) { Active_Item = i ; OS_PutMail1(&MBFunc, &Active_Item) ; OS_SignalEvent(EVENT_OP_STARTED,&MENU_OP_TASK_TCB) ; OS_Suspend(&LCD_TASK_TCB) ; goto Ini_Background ; } } } */ } }