bool RenderThemeWin::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { // Get the correct theme data for a button ThemeData themeData = getThemeData(o); // Now paint the button. HDC hdc = prepareForDrawing(i.context); RECT widgetRect = r; if (m_themeDLL && !m_buttonTheme) m_buttonTheme = openTheme(0, L"Button"); if (m_buttonTheme && drawThemeBG) { drawThemeBG(m_buttonTheme, hdc, themeData.m_part, themeData.m_state, &widgetRect, NULL); } else { if ((themeData.m_part == BP_BUTTON) && isFocused(o)) { // Draw black focus rect around button outer edge HBRUSH brush = GetSysColorBrush(COLOR_3DDKSHADOW); if (brush) { FrameRect(hdc, &widgetRect, brush); InflateRect(&widgetRect, -1, -1); } } DrawFrameControl(hdc, &widgetRect, DFC_BUTTON, themeData.m_classicState); if ((themeData.m_part != BP_BUTTON) && isFocused(o)) { DrawFocusRect(hdc, &widgetRect); } } doneDrawing(i.context, hdc); return false; }
HANDLE nsUXThemeData::GetTheme(nsUXThemeClass cls) { NS_ASSERTION(cls < eUXNumClasses, "Invalid theme class!"); if(!sThemeDLL) return NULL; if(!sThemes[cls]) { sThemes[cls] = openTheme(NULL, GetClassName(cls)); } return sThemes[cls]; }
bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { HDC hdc = prepareForDrawing(i.context); RECT widgetRect = r; if (m_themeDLL && !m_menuListTheme) m_menuListTheme = openTheme(0, L"Combobox"); if (m_menuListTheme && drawThemeBG) drawThemeBG(m_menuListTheme, hdc, CP_DROPDOWNBUTTON, determineState(o), &widgetRect, NULL); else DrawFrameControl(hdc, &widgetRect, DFC_SCROLL, DFCS_SCROLLCOMBOBOX | determineClassicState(o)); doneDrawing(i.context, hdc); return false; }
bool RenderThemeWin::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { // Get the correct theme data for a textfield ThemeData themeData = getThemeData(o); // Now paint the text field. HDC hdc = prepareForDrawing(i.context); RECT widgetRect = r; if (m_themeDLL && !m_textFieldTheme) m_textFieldTheme = openTheme(0, L"Edit"); if (m_textFieldTheme && drawThemeBG) { drawThemeBG(m_textFieldTheme, hdc, themeData.m_part, themeData.m_state, &widgetRect, NULL); } else { DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); FillRect(hdc, &widgetRect, reinterpret_cast<HBRUSH>(((themeData.m_classicState & DFCS_INACTIVE) ? COLOR_BTNFACE : COLOR_WINDOW) + 1)); } doneDrawing(i.context, hdc); return false; }
// --------------------------------------------------------- void KMahjongg::setupKAction() { // game KStdGameAction::gameNew(this, SLOT(newGame()), actionCollection()); KStdGameAction::load(this, SLOT(loadGame()), actionCollection()); KStdGameAction::save(this, SLOT(saveGame()), actionCollection()); KStdGameAction::quit(this, SLOT(close()), actionCollection()); KStdGameAction::restart(this, SLOT(restartGame()), actionCollection()); new KAction(i18n("New Numbered Game..."), "newnum", 0, this, SLOT(startNewNumeric()), actionCollection(), "game_new_numeric"); new KAction(i18n("Open Th&eme..."), 0, this, SLOT(openTheme()), actionCollection(), "game_open_theme"); new KAction(i18n("Open &Tileset..."), 0, this, SLOT(openTileset()), actionCollection(), "game_open_tileset"); new KAction(i18n("Open &Background..."), 0, this, SLOT(openBackground()), actionCollection(), "game_open_background"); new KAction(i18n("Open La&yout..."), 0, this, SLOT(openLayout()), actionCollection(), "game_open_layout"); new KAction(i18n("Sa&ve Theme..."), 0, this, SLOT(saveTheme()), actionCollection(), "game_save_theme"); // originally "file" ends here KStdGameAction::hint(bw, SLOT(helpMove()), actionCollection()); new KAction(i18n("Shu&ffle"), "reload", 0, bw, SLOT(shuffle()), actionCollection(), "move_shuffle"); demoAction = KStdGameAction::demo(this, SLOT(demoMode()), actionCollection()); showMatchingTilesAction = new KToggleAction(i18n("Show &Matching Tiles"), 0, this, SLOT(showMatchingTiles()), actionCollection(), "options_show_matching_tiles"); showMatchingTilesAction->setCheckedState(i18n("Hide &Matching Tiles")); showMatchingTilesAction->setChecked(Prefs::showMatchingTiles()); bw->setShowMatch( Prefs::showMatchingTiles() ); KStdGameAction::highscores(this, SLOT(showHighscores()), actionCollection()); pauseAction = KStdGameAction::pause(this, SLOT(pause()), actionCollection()); // TODO: store the background ; open on startup // TODO: same about layout // TODO: same about theme // move undoAction = KStdGameAction::undo(this, SLOT(undo()), actionCollection()); redoAction = KStdGameAction::redo(this, SLOT(redo()), actionCollection()); // edit new KAction(i18n("&Board Editor"), 0, this, SLOT(slotBoardEditor()), actionCollection(), "edit_board_editor"); // settings KStdAction::preferences(this, SLOT(showSettings()), actionCollection()); setupGUI(); }