//----------------------------------------------------------------------------- // Purpose: Label paint functions - take into account current highligh status //----------------------------------------------------------------------------- void CLabelHeader::paint() { Color oldFg; getFgColor(oldFg); if (gViewPort->GetScoreBoard()->m_iHighlightRow == _row) { setFgColor(255, 255, 255, 0); } // draw text int x, y, iwide, itall; getTextSize(iwide, itall); calcAlignment(iwide, itall, x, y); _dualImage->setPos(x, y); int x1, y1; _dualImage->GetImage(1)->getPos(x1, y1); _dualImage->GetImage(1)->setPos(_gap, y1); _dualImage->doPaint(this); // get size of the panel and the image if (_image) { Color imgColor; getFgColor( imgColor ); if( _useFgColorAsImageColor ) { _image->setColor( imgColor ); } _image->getSize(iwide, itall); calcAlignment(iwide, itall, x, y); _image->setPos(x, y); _image->doPaint(this); } setFgColor(oldFg[0], oldFg[1], oldFg[2], oldFg[3]); }
//================================================================================= // CUSTOM SCROLLPANEL //================================================================================= CTFScrollButton::CTFScrollButton(int iArrow, const char* text,int x,int y,int wide,int tall) : CommandButton(text,x,y,wide,tall) { // Set text color to orange setFgColor(Scheme::sc_primary1); // Load in the arrow m_pTGA = LoadTGAForRes( sArrowFilenames[iArrow] ); setImage( m_pTGA ); // Highlight signal InputSignal *pISignal = new CHandler_CommandButtonHighlight(this); addInputSignal(pISignal); }
void ColorBar::onPaletteIndexChange(int index) { m_lock = true; Color color = Color::fromIndex(index); if (jmouse_b(0) & 2) // TODO create a PaletteChangeEvent and take left/right mouse button from there setBgColor(color); else setFgColor(color); m_lock = false; }
void CommandButton::paint() { // Make the sub label paint the same as the button if ( m_pSubLabel ) { if ( isSelected() ) m_pSubLabel->PushDown(); else m_pSubLabel->PushUp(); } // draw armed button text in white if ( isArmed() ) { setFgColor( Scheme::sc_secondary2 ); } else { setFgColor( Scheme::sc_primary1 ); } Button::paint(); }
void KopeteRichTextEditPart::setFgColor() { QColor col=editor->color(); int s = KColorDialog::getColor( col, KGlobalSettings::textColor() , editor ); if(!col.isValid()) col= KGlobalSettings::textColor() ; if ( s != QDialog::Accepted ) return; setFgColor( col ); writeConfig(); }
void CommandButton::Init( void ) { m_pSubMenu = NULL; m_pSubLabel = NULL; m_pParentMenu = NULL; // Set text color to orange setFgColor(Scheme::sc_primary1); // left align setContentAlignment( vgui::Label::a_west ); // Add the Highlight signal if (!m_bNoHighlight) addInputSignal( new CHandler_CommandButtonHighlight(this) ); // not bound to any button yet m_cBoundKey = 0; }
CharacterWidget::CharacterWidget(QWidget *parent, CharSetCharacter ch) : QWidget(parent), m_character(ch) { m_dobitshift = true; m_showgrid = true; // setMaximumSize(this->size()); // setMinimumSize(this->size()); m_pixmap = QPixmap(this->size()); setFgColor(Qt::black); setBgColor(Qt::white); setGridColor(Qt::red); QString name = QChar(ch.asciiVal()); if (ch.asciiVal() == ' ') { name = "<Space>"; } if (ch.asciiVal() == 0x7f) { name = "<Delete>"; } QString ttstring = QString("Ascii: %1\nCharacter: %2").arg(ch.asciiVal()).arg(name); setToolTip(ttstring); doRepaint(); }
void KopeteRichTextEditPart::clear() { editor->setText( QString::null ); setFont( mFont ); setFgColor( mFgColor ); if( m_capabilities & Kopete::Protocol::BaseBFormatting || m_capabilities & Kopete::Protocol::RichBFormatting ) { editor->setBold( action_bold->isChecked() ); } if( m_capabilities & Kopete::Protocol::BaseIFormatting || m_capabilities & Kopete::Protocol::RichIFormatting ) { editor->setItalic( action_italic->isChecked() ); } if( m_capabilities & Kopete::Protocol::BaseUFormatting || m_capabilities & Kopete::Protocol::RichUFormatting ) { editor->setUnderline( action_underline->isChecked() ); } }
void KopeteRichTextEditPart::readConfig() { // Don't update config untill we read whole config first m_configWriteLock = true; KConfig *config = KGlobal::config(); config->setGroup("RichTextEditor"); QColor tmpColor = KGlobalSettings::textColor(); setFgColor( config->readColorEntry("FgColor", &tmpColor ) ); tmpColor = KGlobalSettings::baseColor(); setBgColor( config->readColorEntry("BgColor", &tmpColor ) ); QFont tmpFont = KopetePrefs::prefs()->fontFace(); setFont( config->readFontEntry("Font", &tmpFont ) ); int tmp = KGlobalSettings::generalFont().pixelSize(); setFontSize( config->readNumEntry( "FontSize", tmp ) ); action_bold->setChecked( config->readBoolEntry( "FontBold" ) ); action_italic->setChecked( config->readBoolEntry( "FontItalic" ) ); action_underline->setChecked( config->readBoolEntry( "FontUnderline" ) ); switch( config->readNumEntry( "EditAlignment", AlignLeft ) ) { case AlignLeft: action_align_left->activate(); break; case AlignCenter: action_align_center->activate(); break; case AlignRight: action_align_right->activate(); break; case AlignJustify: action_align_justify->activate(); break; } m_configWriteLock = false; }
void BigTime::resizeEvent(QResizeEvent *ev) { dwin->resize(ev->size()); QFont f = dwin->font(); QFontMetrics fm(f); int fs = f.pixelSize(); int hspace = 20; //int tw = fm.width(QString("00:00:00:00")); int tw = fm.width(QString("000:00:00:00")); fs = ((ev->size().width() - hspace * 2) * fs) / tw; //fs -= 20; // set min/max if (fs < 10) fs = 10; else if (fs > 200) fs = 200; else fs -= 20; //if(debugMsg) // printf("resize BigTime: Font name:%s CurSize:%d NewSize:%d, NewWidth:%d\n", // f.family().toLatin1().constData(), fs, nfs, ev->size().width()); //f.setPixelSize(fs); //dwin->setFont(f); QString fstr = QString("font-size:%1px; font-family:'Arial'; ").arg(fs); // Tim p4.0.8 dwin->setStyleSheet(fstr); setBgColor(config.bigTimeBackgroundColor); setFgColor(config.bigTimeForegroundColor); int digitWidth = dwin->fontMetrics().width(QString("0")); int vspace = (ev->size().height() - (fs * 2)) / 3; int tickY = vspace; int timeY = vspace * 2 + fs; int absTickY = tickY; int absFrameY = timeY; barLabel->resize(digitWidth * 4, fs); beatLabel->resize(digitWidth * 2, fs); tickLabel->resize(digitWidth * 3, fs); //hourLabel->resize(digitWidth*2, fs); //minLabel->resize(digitWidth*2, fs); minLabel->resize(digitWidth * 3, fs); secLabel->resize(digitWidth * 2, fs); frameLabel->resize(digitWidth * 2, fs); subFrameLabel->resize(digitWidth * 2, fs); absTickLabel->resize(digitWidth * 10, fs); absFrameLabel->resize(digitWidth * 10, fs); sep1->resize(digitWidth, fs); sep2->resize(digitWidth, fs); sep3->resize(digitWidth, fs); sep4->resize(digitWidth, fs); sep5->resize(digitWidth, fs); barLabel->move(hspace + (digitWidth * 0), tickY); sep1->move(hspace + (digitWidth * 4), tickY); beatLabel->move(hspace + (digitWidth * 5), tickY); sep2->move(hspace + (digitWidth * 7), tickY); tickLabel->move(hspace + (digitWidth * 8), tickY); //hourLabel->move( hspace + (digitWidth*0), timeY); //sep3->move( hspace + (digitWidth*2), timeY); //minLabel->move( hspace + (digitWidth*3), timeY); //sep4->move( hspace + (digitWidth*5), timeY); //secLabel->move( hspace + (digitWidth*6), timeY); //sep5->move( hspace + (digitWidth*8), timeY); //frameLabel->move( hspace + (digitWidth*9), timeY); minLabel->move(hspace + (digitWidth * 0), timeY); sep3->move(hspace + (digitWidth * 3), timeY); secLabel->move(hspace + (digitWidth * 4), timeY); sep4->move(hspace + (digitWidth * 6), timeY); frameLabel->move(hspace + (digitWidth * 7), timeY); sep5->move(hspace + (digitWidth * 9), timeY); subFrameLabel->move(hspace + (digitWidth * 10), timeY); absTickLabel->move(hspace + (digitWidth * 0), absTickY); absFrameLabel->move(hspace + (digitWidth * 0), absFrameY); }
void BigTime::configChanged() { setBgColor(config.bigTimeBackgroundColor); setFgColor(config.bigTimeForegroundColor); }
void BigTime::resizeEvent(QResizeEvent *ev) { QWidget::resizeEvent(ev); dwin->resize(ev->size()); QFont f = dwin->font(); QFontMetrics fm(f); int fs = f.pixelSize(); int hspace = 20; int tw = fm.width(QString("000:00:00:00")); fs = ((ev->size().width() - hspace*2)*fs) / tw; // set min/max if (fs < 10) fs = 10; else if (fs > 256) fs = 256; QString fstr = QString("font-size:%1px; font-family:'Courier'; ").arg(fs); // Tim p4.0.8 dwin->setStyleSheet(fstr); setBgColor(MusEGlobal::config.bigTimeBackgroundColor); setFgColor(MusEGlobal::config.bigTimeForegroundColor); int digitWidth = dwin->fontMetrics().width(QString("0")); int vspace = (ev->size().height() - (fs*2)) / 3; int tickY = vspace; int timeY = vspace*2 + fs; int absTickY = tickY; int absFrameY = timeY; barLabel->resize(digitWidth*4, fs); beatLabel->resize(digitWidth*2, fs); tickLabel->resize(digitWidth*3, fs); minLabel->resize(digitWidth*3, fs); secLabel->resize(digitWidth*2, fs); frameLabel->resize(digitWidth*2, fs); subFrameLabel->resize(digitWidth*2, fs); absTickLabel->resize(digitWidth*10, fs); absFrameLabel->resize(digitWidth*10, fs); sep1->resize(digitWidth, fs); sep2->resize(digitWidth, fs); sep3->resize(digitWidth, fs); sep4->resize(digitWidth, fs); sep5->resize(digitWidth, fs); barLabel->move( hspace + (digitWidth*0), tickY); sep1->move( hspace + (digitWidth*4), tickY); beatLabel->move( hspace + (digitWidth*5), tickY); sep2->move( hspace + (digitWidth*7), tickY); tickLabel->move( hspace + (digitWidth*8), tickY); minLabel->move( hspace + (digitWidth*0), timeY); sep3->move( hspace + (digitWidth*3), timeY); secLabel->move( hspace + (digitWidth*4), timeY); sep4->move( hspace + (digitWidth*6), timeY); frameLabel->move( hspace + (digitWidth*7), timeY); sep5->move( hspace + (digitWidth*9), timeY); subFrameLabel->move( hspace + (digitWidth*10), timeY); absTickLabel->move( hspace + (digitWidth*0), absTickY); absFrameLabel->move( hspace + (digitWidth*0), absFrameY); metronome->move(0,dwin->height() - dwin->height()/10); metronome->resize(dwin->width(),dwin->height()/10); }
ChatWindow::ChatWindow(ICQChat *_chat) : QMainWindow(NULL) { logFile = NULL; bConnected = false; setWFlags(WDestructiveClose); connect(pClient, SIGNAL(event(ICQEvent*)), this, SLOT(processEvent(ICQEvent*))); transparent = new TransparentTop(this, pMain->UseTransparentContainer, pMain->TransparentContainer); QToolBar *toolbar = new QToolBar(this); btnSave = new QToolButton(toolbar); btnSave->setIconSet(Icon("save_all")); btnSave->setTextLabel(i18n("Save")); connect(btnSave, SIGNAL(clicked()), this, SLOT(openLog())); toolbar->addSeparator(); btnBold = new QToolButton(toolbar); btnBold->setIconSet(Icon("text_bold")); btnBold->setTextLabel(i18n("Bold")); btnBold->setToggleButton(true); connect(btnBold, SIGNAL(toggled(bool)), this, SLOT(toggleBold(bool))); btnItalic = new QToolButton(toolbar); btnItalic->setIconSet(Icon("text_italic")); btnItalic->setTextLabel(i18n("Italic")); btnItalic->setToggleButton(true); connect(btnItalic, SIGNAL(toggled(bool)), this, SLOT(toggleItalic(bool))); btnUnderline = new QToolButton(toolbar); btnUnderline->setIconSet(Icon("text_under")); btnUnderline->setTextLabel(i18n("Underline")); btnUnderline->setToggleButton(true); connect(btnUnderline, SIGNAL(toggled(bool)), this, SLOT(toggleUnderline(bool))); btnFgColor = new QToolButton(toolbar); btnFgColor->setTextLabel(i18n("Text color")); btnFgColor->setIconSet(Icon("fgcolor")); connect(btnFgColor, SIGNAL(clicked()), this, SLOT(setFgColor())); chat = _chat; bInit = false; pClient->cancelMessage(chat, false); bInit = true; CUser u(chat->getUin()); setCaption(u.name()); setIcon(Pict("chat")); QSplitter *splitter = new QSplitter(this); setCentralWidget(splitter); QFrame *frm = new QFrame(splitter); lstUsers = new QListBox(splitter); splitter->setResizeMode(lstUsers, QSplitter::KeepSize); QVBoxLayout *lay = new QVBoxLayout(frm); txtChat = new TextShow(frm); txtChat->setTextFormat(QTextEdit::RichText); lay->addWidget(txtChat); lay->addSpacing(2); edtChat = new QTextEdit(frm); edtChat->setTextFormat(QTextEdit::RichText); edtChat->setWordWrap(QTextEdit::NoWrap); QFontMetrics fm(edtChat->font()); int h = fm.height(); #if QT_VERSION < 300 if ( style() == WindowsStyle && h < 26 ) h = 22; #endif if ( h < QApplication::globalStrut().height()) h = QApplication::globalStrut().height(); edtChat->setFixedHeight(h); edtChat->setHScrollBarMode(QScrollView::AlwaysOff); edtChat->setVScrollBarMode(QScrollView::AlwaysOff); lay->addWidget(edtChat); connect(edtChat, SIGNAL(returnPressed()), this, SLOT(sendLine())); CUser owner(pClient); new ChatUserItem(lstUsers, owner.name(), 0); if (pMain->ChatWidth() && pMain->ChatHeight()) resize(pMain->ChatWidth(), pMain->ChatHeight()); baseColor = txtChat->color(); bClientMode = false; }
//behandelt exception interrupts void _isrException(unsigned int intNum) { setClearColor(CL_BLUE); clearScreen(); enum TEXT_COLOR color; color = getFgColor(); setFgColor(CL_WHITE); setCursor(40,10); switch(intNum) { case 0: { kprint("\nException: Division durch 0 ...\n"); }break; case 1: { kprint("\nException: Debuger ...\n"); }break; case 2: { kprint("\nException: Non Maskable Interrupt ...\n"); }break; case 3: { kprint("\nException: Breakpoint ...\n"); }break; case 4: { kprint("\nException: Into Detected Overflow ...\n"); }break; case 5: { kprint("\nException: Out of Bounds ...\n"); }break; case 6: { kprint("\nException: Invalid Opcode ...\n"); }break; case 7: { kprint("\nException: No Coprocessor ...\n"); }break; case 8: { kprint("\nException: Double Fault ...\n"); }break; case 9: { kprint("\nException: Coprocessor Segment Overrun ...\n"); }break; case 10: { kprint("\nException: Bad TSS ...\n"); }break; case 11: { kprint("\nException: Segment Not Present ...\n"); }break; case 12: { kprint("\nException: Stack Fault ...\n"); }break; case 13: { kprint("\nException: General Protection Fault ...\n"); }break; case 14: { kprint("\nException: Page Fault ...\n"); }break; case 15: { kprint("\nException: Unknown Interrupt ...\n"); }break; case 16: { kprint("\nException: Coprocessor Fault ...\n"); }break; case 17: { kprint("\nException: Alignment Check ...\n"); }break; case 18: { kprint("\nException: Machine Check ...\n"); }break; default: { kprint("\nException: Von Intel reserviert ...\n"); }break; }; kprint("System angehalten. Bitte neustarten!\n"); setFgColor(color); for (;;); }
ColorBar::ColorBar(int align) : Box(align) , m_paletteButton("Edit Palette", JI_BUTTON) , m_paletteView(false) , m_fgColor(Color::fromIndex(15), IMAGE_INDEXED) , m_bgColor(Color::fromIndex(0), IMAGE_INDEXED) , m_lock(false) { setBorder(gfx::Border(1*jguiscale())); child_spacing = 1*jguiscale(); m_paletteView.setBoxSize(6*jguiscale()); m_paletteView.setColumns(4); m_fgColor.setPreferredSize(0, m_fgColor.getPreferredSize().h); m_bgColor.setPreferredSize(0, m_bgColor.getPreferredSize().h); m_scrollableView.attachToView(&m_paletteView); int w = (m_scrollableView.getBorder().getSize().w + m_scrollableView.getViewport()->getBorder().getSize().w + m_paletteView.getPreferredSize().w + getTheme()->scrollbar_size); jwidget_set_min_size(&m_scrollableView, w, 0); m_scrollableView.setExpansive(true); addChild(&m_paletteButton); addChild(&m_scrollableView); addChild(&m_fgColor); addChild(&m_bgColor); this->border_width.l = 2*jguiscale(); this->border_width.t = 2*jguiscale(); this->border_width.r = 2*jguiscale(); this->border_width.b = 2*jguiscale(); this->child_spacing = 2*jguiscale(); m_paletteView.IndexChange.connect(&ColorBar::onPaletteIndexChange, this); m_fgColor.Change.connect(&ColorBar::onFgColorButtonChange, this); m_bgColor.Change.connect(&ColorBar::onBgColorButtonChange, this); // Set background color reading its value from the configuration. setBgColor(get_config_color("ColorBar", "BG", getBgColor())); // Clear the selection of the BG color in the palette. m_paletteView.clearSelection(); // Set foreground color reading its value from the configuration. setFgColor(get_config_color("ColorBar", "FG", getFgColor())); // Change color-bar background color (not ColorBar::setBgColor) Widget::setBgColor(((SkinTheme*)getTheme())->get_tab_selected_face_color()); m_paletteView.setBgColor(((SkinTheme*)getTheme())->get_tab_selected_face_color()); // Change labels foreground color setup_mini_look(&m_paletteButton); m_paletteButton.setFont(((SkinTheme*)getTheme())->getMiniFont()); m_paletteButton.Click.connect(Bind<void>(&ColorBar::onPaletteButtonClick, this)); setDoubleBuffered(true); onColorButtonChange(getFgColor()); }
void KopeteRichTextEditPart::createActions( KActionCollection *ac ) { enableRichText = new KToggleAction(i18n("Enable &Rich Text"), "pencil", 0, ac, "enableRichText" ); enableRichText->setCheckedState(i18n("Disable &Rich Text")); connect( enableRichText, SIGNAL( toggled(bool) ), this, SLOT( slotSetRichTextEnabled(bool) ) ); checkSpelling = new KAction( i18n("Check &Spelling"), "spellcheck", 0, editor, SLOT( checkSpelling() ), ac, "check_spelling" ); //Fg Color actionFgColor = new KAction( i18n("Text &Color..."), "color_line", 0, this, SLOT( setFgColor() ), ac, "format_color" ); //BG Color actionBgColor = new KAction( i18n("Background Co&lor..."), "color_fill", 0, this, SLOT( setBgColor() ), ac, "format_bgcolor" ); //Font Family action_font = new KFontAction( i18n("&Font"), 0, ac, "format_font" ); connect( action_font, SIGNAL( activated( const QString & ) ), this, SLOT( setFont( const QString & ) ) ); //Font Size action_font_size = new KFontSizeAction( i18n("Font &Size"), 0, ac, "format_font_size" ); connect( action_font_size, SIGNAL( fontSizeChanged(int) ), this, SLOT( setFontSize(int) ) ); //Formatting action_bold = new KToggleAction( i18n("&Bold"), "text_bold", CTRL+Key_B, ac, "format_bold" ); connect( action_bold, SIGNAL( toggled(bool) ), this, SLOT( setBold(bool) ) ); action_italic = new KToggleAction( i18n("&Italic"), "text_italic", CTRL+Key_I, ac, "format_italic" ); connect( action_italic, SIGNAL( toggled(bool) ), this, SLOT( setItalic(bool) ) ); action_underline = new KToggleAction( i18n("&Underline"), "text_under", CTRL+Key_U, ac, "format_underline" ); connect( action_underline, SIGNAL( toggled(bool) ), this, SLOT( setUnderline(bool) ) ); connect( editor, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( updateCharFmt() ) ); updateCharFmt(); connect( editor, SIGNAL( currentFontChanged( const QFont & ) ), this, SLOT( updateFont() ) ); updateFont(); //Alignment action_align_left = new KToggleAction( i18n("Align &Left"), "text_left", 0, ac, "format_align_left" ); connect( action_align_left, SIGNAL( toggled(bool) ), this, SLOT( setAlignLeft(bool) ) ); action_align_center = new KToggleAction( i18n("Align &Center"), "text_center", 0, ac, "format_align_center" ); connect( action_align_center, SIGNAL( toggled(bool) ), this, SLOT( setAlignCenter(bool) ) ); action_align_right = new KToggleAction( i18n("Align &Right"), "text_right", 0, ac, "format_align_right" ); connect( action_align_right, SIGNAL( toggled(bool) ), this, SLOT( setAlignRight(bool) ) ); action_align_justify = new KToggleAction( i18n("&Justify"), "text_block", 0, ac, "format_align_justify" ); connect( action_align_justify, SIGNAL( toggled(bool) ), this, SLOT( setAlignJustify(bool) ) ); action_align_left->setExclusiveGroup( "alignment" ); action_align_center->setExclusiveGroup( "alignment" ); action_align_right->setExclusiveGroup( "alignment" ); action_align_justify->setExclusiveGroup( "alignment" ); connect( editor, SIGNAL( cursorPositionChanged( int,int ) ), this, SLOT( updateAligment() ) ); updateAligment(); }