bool keyboard_shortcut_manager::on_keydown_auto(WPARAM wp) { if (on_keydown(TYPE_MAIN,wp)) return true; if (on_keydown(TYPE_CONTEXT_PLAYLIST,wp)) return true; if (on_keydown(TYPE_CONTEXT_NOW_PLAYING,wp)) return true; return false; }
LRESULT UIManager::ProcessMessage(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) { switch(iMessage) { case WM_CREATE: if(!LyricManagerInstance) LyricManagerInstance = new LyricManager(); LyricManagerInstance->AddRedrawHandler(boost::bind(&UIManager::Invalidated, this, hWnd)); Invalidated(hWnd); break; case WM_CONTEXTMENU: case WM_NCRBUTTONUP: on_contextmenu(hWnd); break; case WM_KEYDOWN: case WM_SYSKEYDOWN: on_keydown(wParam); return 0; case WM_DESTROY: return 0; case WM_PAINT: PAINTSTRUCT ps; if(BeginPaint(hWnd, &ps) != NULL) { Draw(hWnd, ps.hdc); EndPaint(hWnd, &ps); } return 0; case WM_ERASEBKGND: return TRUE;/* case WM_USER + 1: { HDC hdc = GetDCEx(hWnd, NULL, DCX_WINDOW); Draw(hWnd, hdc); ReleaseDC(hWnd, hdc); return TRUE; }*/ } return DefWindowProc(hWnd, iMessage, wParam, lParam); }
TEST_F( libRocketDataGridTest, UIDataViewList ) { Point2i pos1(60,25); std::string doc_file1 = "dataview.rml"; UIDataViewList store1; EXPECT_EQ( true, store1.set_context(&this->desktop) ); EXPECT_EQ( true, store1.load_document_file( doc_file1 ) ) << this->test_set() << " object should not be invalid; is the context and document file valid?"; // Ensure that the visual debugger's beacon (err icon) appears on-screen. Rocket::Core::Log::Message( Rocket::Core::Log::LT_ASSERT, "Hello, world!" ); this->model.reset( new CardsPageDataSource("cards_db") ); this->db.reset( new CardCollection() ); EXPECT_TRUE( model != nullptr ); EXPECT_TRUE( db != nullptr ); EXPECT_EQ( true, db->load_db() ) << "Could not initialize nom::CardsPageDataSource data interface."; CardList deck; CardList cards = db->cards(); // Load in the entire cards database for( auto itr = cards.begin(); itr != cards.end(); ++itr ) { deck.push_back( *itr ); } // Deck of cards for the data source model->append_cards( deck ); store1.show(); EXPECT_TRUE( store1.set_column_title(1, "CARDS P. " + std::to_string(model->page() + 1) ) ); EXPECT_EQ( true, store1.visible() ); EXPECT_EQ( pos1, store1.position() ); // Default values sanity EXPECT_EQ( "cards", model->table_name() ); EXPECT_EQ( 11, model->per_page() ); EXPECT_EQ( 0, model->page() ); EXPECT_EQ( 10, model->map_page_row( 10, 0 ) ) << "Selection should be between 0..11"; EXPECT_EQ( 2, model->map_page_row( 13, 1 ) ) << "Selection should be between 0..11"; EXPECT_EQ( 10, model->map_page_row( 21, 1 ) ) << "Selection should be between 0..11"; EXPECT_EQ( "CARDS P. 1", store1.column_title(1) ); EXPECT_EQ( "NUM.", store1.column_title(2) ); store1.register_event_listener( store1.document(), "keydown", new nom::UIEventListener( [&] ( Rocket::Core::Event& ev ) { on_keydown( ev, &store1, db, model, this->phand ); } )); store1.register_event_listener( store1.document(), "mouseup", new nom::UIEventListener( [&] ( Rocket::Core::Event& ev ) { on_mouseup( ev, &store1, db, model, this->phand ); } )); // Synthesized user input events; we hope to capture these before the end of // the first frame Rocket::Core::Element* target = nullptr; Rocket::Core::Dictionary lclick; Rocket::Core::Dictionary rclick; lclick.Set("button","0"); // Left click rclick.Set("button","1"); // Left click // We must update the context before our cards model is filled this->desktop.update(); target = store1.document()->GetElementById("Geezard"); if( target ) { target->DispatchEvent("mouseup", lclick); // Should have zero cards remaining } target = store1.document()->GetElementById("Red Bat"); if( target ) { target->DispatchEvent("mouseup", lclick); target->DispatchEvent("mouseup", lclick); target->DispatchEvent("mouseup", lclick); // Should have one cards remaining } target = store1.document()->GetElementById("Red Bat"); if( target ) { target->DispatchEvent("mouseup", rclick); // Should have two cards remaining } target = store1.document()->GetElementById("Cockatrice"); if( target ) { target->DispatchEvent("mouseup", lclick); target->DispatchEvent("mouseup", lclick); target->DispatchEvent("mouseup", lclick); // Should have zero cards remaining } // NOM_LOG_INFO( NOM_LOG_CATEGORY_TEST, store1.dump() ); EXPECT_EQ( NOM_EXIT_SUCCESS, this->on_run() ); EXPECT_TRUE( this->compare() ); }