/** * Removes the tab with ID \a button_id. */ void KTinyTabBar::removeTab( int button_id ) { if( !m_IDToTabButton.contains( button_id ) ) return; KTinyTabButton* tabButton = m_IDToTabButton[button_id]; if( tabButton == m_previousButton ) m_previousButton = 0L; if( tabButton == m_activeButton ) m_activeButton = 0L; m_IDToTabButton.remove( button_id ); m_tabButtons.removeAll( tabButton ); // delete the button with deleteLater() because the button itself might // have send a close-request. So the app-execution is still in the // button, a delete tabButton; would lead to a crash. tabButton->hide(); tabButton->deleteLater(); if( m_tabButtons.count() == 0 ) hide(); triggerResizeEvent(); }
/** * Set the maximum width in pixels a tab may have. */ void KTinyTabBar::setMaximumTabWidth( int max_pixel ) { if( m_maximumTabWidth == max_pixel ) return; m_maximumTabWidth = max_pixel; triggerResizeEvent(); }
/** * Decrease the current row. */ void KTinyTabBar::scrollUp() { if( m_currentRow == 0 ) return; --m_currentRow; triggerResizeEvent(); }
/** * Set the current row. * @param row new current row */ void KTinyTabBar::setCurrentRow( int row ) { if( row == currentRow() ) return; m_currentRow = row; if( m_currentRow < 0 ) m_currentRow = 0; triggerResizeEvent(); }
GEM_EXTERN void dispatchGemWindowMessages(WindowInfo &win) { SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: // ignore break; case SDL_WINDOWEVENT: switch (event.window.event) { case SDL_WINDOWEVENT_CLOSE: // ignore break; case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_SIZE_CHANGED: triggerResizeEvent(event.window.data1, event.window.data2); break; } break; case SDL_KEYDOWN: case SDL_KEYUP: triggerKeyboardEvent ( key2symbol(event.key.keysym.sym).c_str() , event.key.keysym.scancode , event.type == SDL_KEYDOWN ); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: triggerButtonEvent ( event.button.button == SDL_BUTTON_LEFT ? 0 : event.button.button == SDL_BUTTON_MIDDLE ? 1 : event.button.button == SDL_BUTTON_RIGHT ? 2 : event.button.button // FIXME , event.type == SDL_MOUSEBUTTONDOWN , event.button.x , event.button.y ); break; case SDL_MOUSEMOTION: triggerMotionEvent(event.motion.x, event.motion.y); break; case SDL_MOUSEWHEEL: // FIXME if (event.wheel.y != 0) triggerWheelEvent(0, event.wheel.y); if (event.wheel.x != 0) triggerWheelEvent(1, event.wheel.x); break; } } }
/** * Increase the current row. */ void KTinyTabBar::scrollDown() { ++m_currentRow; triggerResizeEvent(); }
void KTinyTabBar::updateSort() { global_sortType = tabSortType(); qSort( m_tabButtons.begin(), m_tabButtons.end(), tabLessThan ); triggerResizeEvent(); }
/** * Updates the fixed height. Called when the tab height or the number of rows * changed. */ void KTinyTabBar::updateFixedHeight() { setFixedHeight( numRows() * tabHeight() ); triggerResizeEvent(); }
///////////////////////////////////////////////////////// // MainWndProc // ///////////////////////////////////////////////////////// LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static RECT rcClient; static int ctrlKeyDown = 0; // assume that we handle the message long lRet = 0; switch (uMsg) { // mouse motion case WM_MOUSEMOVE: triggerMotionEvent(LOWORD(lParam), HIWORD(lParam)); break; // left button up case WM_LBUTTONUP: triggerButtonEvent(0, 0, LOWORD(lParam), HIWORD(lParam)); break; // left button down case WM_LBUTTONDOWN: triggerButtonEvent(0, 1, LOWORD(lParam), HIWORD(lParam)); break; // middle button up case WM_MBUTTONUP: triggerButtonEvent(1, 0, LOWORD(lParam), HIWORD(lParam)); break; // middle button down case WM_MBUTTONDOWN: triggerButtonEvent(1, 1, LOWORD(lParam), HIWORD(lParam)); break; // right button up case WM_RBUTTONUP: triggerButtonEvent(2, 0, LOWORD(lParam), HIWORD(lParam)); break; // right button down case WM_RBUTTONDOWN: triggerButtonEvent(2, 1, LOWORD(lParam), HIWORD(lParam)); break; // keyboard action case WM_KEYUP: if ((int)wParam == VK_CONTROL) ctrlKeyDown = 0; triggerKeyboardEvent((char*)&wParam, (int)wParam, 1); break; // keyboard action case WM_KEYDOWN: if ((int)wParam == VK_CONTROL) ctrlKeyDown = 1; else if (ctrlKeyDown && (int)wParam == 'R') gemAbortRendering(); else triggerKeyboardEvent((char*)&wParam, (int)wParam, 0); break; // resize event case WM_SIZE: triggerResizeEvent(LOWORD(lParam), HIWORD(lParam)); GetClientRect(hWnd, &rcClient); break; // we want to override these messages // and not do anything case WM_DESTROY: case WM_CLOSE: break; case WM_CREATE: { } break; // pass all unhandled messages to DefWindowProc default: lRet = DefWindowProc (hWnd, uMsg, wParam, lParam); break; } return(lRet); }