static void window_load(Window *window) { num_a_items = 0; menu_items[num_a_items++] = (SimpleMenuItem){ .title = "---10 TEN mins ---", .subtitle = "Start 10 minute timer ", .callback = menu_select_callback, }; menu_items[num_a_items++] = (SimpleMenuItem){ .title = "---5 FIVE mins ---", .subtitle = "Start 5 minute timer ", .callback = menu_select_callback, }; menu_items[num_a_items++] = (SimpleMenuItem){ .title = "---4 FOUR mins ---", .subtitle = "Start 4 minute timer ", .callback = menu_select_callback, }; // Bind the menu items to the corresponding menu sections menu_sections[0] = (SimpleMenuSection){ .title = "Start Timer Menu", .num_items = 3, .items = menu_items, }; displayFields[GPSTIME] = text_layer_create(GRect(0, 0, 144, 30)); //GPS Time text_layer_set_font( displayFields[GPSTIME],displayFont1); layer_add_child(window_get_root_layer(window), (Layer *)displayFields[GPSTIME]); menu_layer = simple_menu_layer_create(GRect(0,30,144,138), window, menu_sections, 1, NULL); layer_set_update_proc((Layer *) menu_layer, refreshData); layer_add_child(window_get_root_layer(window), simple_menu_layer_get_layer(menu_layer)); } static void window_appear(){ } static void window_unload(Window *window) {// Deinitialize resources on window unload that were initialized on window load setCurrentWindow("none"); window_destroy(window); simple_menu_layer_destroy(menu_layer); } void show_start_time_menu(){ window = window_create(); //window_set_fullscreen(window, true); setCurrentWindow("start_time"); //Just GPS time window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload, .appear = window_appear, }); window_stack_push(window, true /* Animated */); }
void nav_menu_window_unload(Window *mWindow) {// Deinitialize resources on window unload that were initialized on window load window_destroy(mWindow); setCurrentWindow("none"); simple_menu_layer_destroy(nav_menu_layer); nav_menu_layer = NULL; //APP_LOG(APP_LOG_LEVEL_DEBUG, "exiting show_nav_menu. Free: %d", heap_bytes_free()); }
void processOperations() { boost::this_thread::sleep(boost::posix_time::milliseconds(5)); OperationsList globalOperationsCopy; { boost::lock_guard<boost::recursive_mutex> lock(operationsMutex); globalOperationsCopy = globalOperations; globalOperations.clear(); } stopOperationsProcessing = false; OperationsList::iterator operation = globalOperationsCopy.begin(); while (!stopOperationsProcessing && operation != globalOperationsCopy.end()) { (*operation)(); ++operation; } WindowOperationsMap windowOperationsCopy; { boost::lock_guard<boost::recursive_mutex> lock(operationsMutex); windowOperationsCopy = windowOperations; windowOperations.clear(); } for (WindowOperationsMap::iterator operations = windowOperationsCopy.begin(); operations != windowOperationsCopy.end(); ++operations) { if (setCurrentWindow(operations->first)) { stopOperationsProcessing = false; OperationsList::iterator operation = operations->second.begin(); while (!stopOperationsProcessing && operation != operations->second.end()) { (*operation)(); ++operation; } } } }
void MainWindow::setShredFile(QStringList paths, int shredLevel) { setCurrentWindow(Shred); foreach(QString p, paths) { shredWidget->addFile(p); }
void LayoutMap::reset() { clearMaps(); setCurrentWindow( X11Helper::UNKNOWN_WINDOW_ID ); }
void WindowsManager::setFullScreen(bool enable) { m_fullScreen = enable; if(m_fullScreen) { if(m_subWindow) { getDesktopResolution(); if(m_window2Rect.bottom==-1)//one screen available { glutFullScreen(); } else { //Fullscreen in subwindow mode required the same resolution on both screen //and the second screen has to been on the right of the first screen glutPositionWindow(m_window1Rect.left-IntialMargin/2,m_window1Rect.top-30); glutReshapeWindow(m_window2Rect.right-m_window1Rect.left,m_window1Rect.bottom - m_window1Rect.top); } } else { getDesktopResolution(); if(m_window2Rect.bottom==-1)//one screen available { setCurrentWindow(0); glutPositionWindow(m_window1Rect.left,m_window1Rect.top); glutReshapeWindow((m_window1Rect.right- m_window1Rect.left)/2-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); setCurrentWindow(1); glutPositionWindow((m_window1Rect.right- m_window1Rect.left)/2,m_window1Rect.top); glutReshapeWindow((m_window1Rect.right - m_window1Rect.left)/2-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); } else //two screens { setCurrentWindow(0); glutPositionWindow(m_window1Rect.left,m_window1Rect.top); glutReshapeWindow(m_window1Rect.right - m_window1Rect.left-IntialMargin,m_window1Rect.bottom - m_window1Rect.top-IntialMargin); setCurrentWindow(1); glutPositionWindow(m_window2Rect.left,m_window2Rect.top); glutReshapeWindow(m_window2Rect.right - m_window2Rect.left-IntialMargin,m_window2Rect.bottom - m_window2Rect.top-IntialMargin); } } } else { if(m_subWindow) { setCurrentWindow(0); glutPositionWindow(IntialPosition,IntialPosition); glutReshapeWindow(IntialSize*2,IntialSize); } else { setCurrentWindow(0); glutPositionWindow(IntialPosition,IntialPosition); glutReshapeWindow(IntialSize,IntialSize); setCurrentWindow(1); glutPositionWindow(IntialPosition+IntialSize+IntialMargin,IntialPosition); glutReshapeWindow(IntialSize,IntialSize); } } }
static void refreshData(Layer *this_layer, GContext *ctx){ setCurrentWindow("start_time"); }