MenuItem::MenuItem( QWidget* p, const QString& title, const QString& comment, const QString& icon, const QColor& hl, QFrame* sub, bool updateRecent ) : QButton( p, title ), m_desktop( 0 ), m_mouseOver( false ), m_offset( 5 ), m_secOffset( 2 ), m_sub( sub ), m_updateRecent( updateRecent ), m_descFontOffset(2), m_descLines(2), m_arrowIcon( "1rightarrow" ) { kdDebug() << k_funcinfo << endl; setIcon( icon ); setTitle( title ); setDescription( comment ); if( hl.isValid() ) setHighlightColor( hl ); if( m_sub ) { m_sub->installEventFilter( this ); PopupManager::add( m_sub ); } }
Editor::Editor( QWidget* parent, const char* name ): QTextEdit( parent, name ) { d = new Private; d->eval = 0; d->index = 0; d->autoCompleteEnabled = true; d->completion = new EditorCompletion( this ); d->completionTimer = new QTimer( this ); d->autoCalcEnabled = true; d->syntaxHighlightEnabled = true; d->highlighter = new EditorHighlighter( this ); d->autoCalcTimer = new QTimer( this ); d->matchingTimer = new QTimer( this ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setWordWrap( NoWrap ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); setTextFormat( PlainText ); setAutoFormatting( AutoNone ); setTabChangesFocus( true ); setLinkUnderline( false ); connect( d->completion, SIGNAL( selectedCompletion( const QString& ) ), SLOT( autoComplete( const QString& ) ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoComplete() ) ); connect( d->completionTimer, SIGNAL( timeout() ), SLOT( triggerAutoComplete() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkMatching() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingLeft() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingRight() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoCalc() ) ); connect( d->autoCalcTimer, SIGNAL( timeout() ), SLOT( autoCalc() ) ); d->autoCalcLabel = new CalcResultLabel( 0, "autocalc", WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); d->autoCalcLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); d->autoCalcLabel->setPalette( QToolTip::palette() ); d->autoCalcLabel->hide(); setHighlightColor( Number, QColor(0,0,127) ); setHighlightColor( FunctionName, QColor(85,0,0) ); setHighlightColor( Variable, QColor(0,85,0) ); setHighlightColor( MatchedPar, QColor(255,255,183) ); }
//------------------------------------------------------------------------------ // reset() -- Reset parameters //------------------------------------------------------------------------------ void Display::reset() { BaseClass::reset(); setNormColor( getColor("NormalText") ); setHighlightColor( getColor("HighlightText") ); // Reset the I/O Handler if (ioHandler != nullptr) { ioHandler->event(RESET_EVENT); } }
MenuItem::MenuItem( QWidget* p, KDesktopFile* desktop, const QColor& hl, QFrame* sub, bool updateRecent ) : QButton( p, desktop->readName() ), m_desktop( desktop ), m_mouseOver( false ), m_offset( 5 ), m_secOffset( 2 ), m_sub( sub ), m_updateRecent( updateRecent ), m_descFontOffset(2), m_descLines(2), m_arrowIcon( "1rightarrow" ) { setTitle( m_desktop->readName() ); kdDebug() << k_funcinfo << "C-TOR" << m_desktop->readName() << endl; // DEBUG if( m_desktop->readComment() != QString::null ) { setDescription( m_desktop->readComment() ); } else { setDescription( m_desktop->readGenericName() ); } setIcon( m_desktop->readIcon() ); QColor bg = m_desktop->readColorEntry( "background" ); if( bg.isValid() ) setPaletteBackgroundColor( bg ); setHighlightColor( m_desktop->readColorEntry( "highlight" ) ); if( hl.isValid() ) setHighlightColor( hl ); if( m_sub ) { m_sub->installEventFilter( this ); PopupManager::add( m_sub ); } }
void setFakeHighlightEX(int subAmount) { int tBegin = beginHighlight - subAmount; int tEnd = endHighlight - subAmount; if(subAmount != 0) { if(tBegin < 0) { tBegin = 0; } if(tEnd < 0) { tEnd = 0; } } setHighlightColor(genericHighlightColor); setHighlight(tBegin, tEnd); }
MenuColumn::MenuColumn( QWidget* parent, const QString& name, const QColor& bg, const QColor& hl ) : QFrame( parent, name ? name : "GenericMenuColumn" ), m_name( name ) { setFrameStyle( QFrame::Plain | QFrame::MenuBarPanel ); m_mainLay = new QVBoxLayout( this ); m_compLay = new QVBoxLayout(); m_mainLay->addLayout( m_compLay ); if( !m_name.isNull() ) loadItems(); // override color if( bg.isValid() ) setBackgroundColor( bg ); if( hl.isValid() ) setHighlightColor( hl ); setPaletteBackgroundColor( backgroundColor() ); }
void KDGanttViewTaskLink::initTaskLink() { horLineList = new QPtrList<KDCanvasLine>; verLineList = new QPtrList<KDCanvasLine>; horLineList2 = new QPtrList<KDCanvasLine>; verLineList2 = new QPtrList<KDCanvasLine>; horLineList3 = new QPtrList<KDCanvasLine>; topList = new QPtrList<KDCanvasPolygon>; topLeftList = new QPtrList<KDCanvasPolygon>; topRightList = new QPtrList<KDCanvasPolygon>; horLineList->setAutoDelete( true ); verLineList->setAutoDelete( true ); horLineList2->setAutoDelete( true ); verLineList2->setAutoDelete( true ); horLineList3->setAutoDelete( true ); topList->setAutoDelete( true ); topLeftList->setAutoDelete( true ); topRightList->setAutoDelete( true ); myTimeTable = fromList.getFirst()->myGanttView->myTimeTable; KDCanvasLine* horLine,*verLine; KDCanvasLine* horLine2,*verLine2; KDCanvasLine* horLine3; KDCanvasPolygon* top; KDCanvasPolygon* topLeft; KDCanvasPolygon* topRight; unsigned int i, j; for ( i = 0;i < fromList.count();++i) { for ( j = 0;j < toList.count();++j) { horLine = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); verLine = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); horLine2 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); verLine2 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); horLine3 = new KDCanvasLine(myTimeTable,this,Type_is_KDGanttTaskLink); top = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); topLeft = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); topRight = new KDCanvasPolygon(myTimeTable,this,Type_is_KDGanttTaskLink); QPointArray arr = QPointArray(3); arr.setPoint(0,-4,-5); arr.setPoint(1,4,-5); arr.setPoint(2,0,0); top->setPoints(arr); arr.setPoint(0,5,-5); // need an extra y pixel, canvas bug? arr.setPoint(1,5,5); // need an extra y pixel, canvas bug? arr.setPoint(2,0,0); topLeft->setPoints(arr); arr.setPoint(0,-5,-4); arr.setPoint(1,-5,4); arr.setPoint(2,0,0); topRight->setPoints(arr); horLineList->append(horLine); verLineList->append(verLine); horLineList2->append(horLine2); verLineList2->append(verLine2); horLineList3->append(horLine3); topList->append(top); topLeftList->append(topLeft); topRightList->append(topRight); horLine->setZ(1); verLine->setZ(1); horLine2->setZ(1); verLine2->setZ(1); horLine3->setZ(1); top->setZ(1); topLeft->setZ(1); topRight->setZ(1); } } setTooltipText( "Tasklink" ); setWhatsThisText( "Tasklink" ); myTimeTable->myTaskLinkList.append(this); setHighlight( false); setHighlightColor(Qt::red ); setColor(Qt::black); setVisible(true); }
void MPPrefs::update() { MC2Player* player = MPlayer->getPlayerInfo( MPlayer->commanderID ); long mySeniority = player->teamSeniority; bool bMostSenior = true; long playerCount; const MC2Player* players = MPlayer->getPlayers(playerCount); for( int i = 0; i < playerCount; i++ ) { if ( players[i].teamSeniority > mySeniority && players[i].team == player->team ) { bMostSenior = false; } } if ( !bMostSenior ) { getButton( MP_PREFS_BASE )->disable( true ); } else getButton( MP_PREFS_BASE )->disable( false ); if ( !ChatWindow::instance()->pointInside(userInput->getMouseX(), userInput->getMouseY()) ) LogisticsScreen::update(); camera.update(); int oldSel = comboBox[2].GetSelectedItem(); bool bExpanded = 0; for ( i = 0; i < 3; i++ ) { if ( comboBox[i].ListBox().isShowing() ) { bExpanded = true; } comboBox[i].update(); } int newSel = comboBox[2].GetSelectedItem(); if ( newSel != oldSel && newSel != -1 ) { aBmpListItem* pItem = (aBmpListItem*)(comboBox[2].ListBox().GetItem( newSel )); const char* pName = pItem->getBmp(); MC2Player* pInfo = MPlayer->getPlayerInfo( MPlayer->commanderID ); strcpy( pInfo->insigniaFile, pName ); MPlayer->sendPlayerUpdate( 0, 5, -1 ); FullPathFileName path; path.init( "data\\multiplayer\\insignia\\", pName, ".tga" ); insigniaBmp.setTexture( path ); insigniaBmp.setUVs( 0, 0, 32, 32 ); statics[12].setTexture( path ); statics[12].setUVs( 0, 0, 32, 32 ); File file; file.open( path ); long size = file.getLength(); unsigned char* pData = new unsigned char[size]; file.read( pData, size ); MPlayer->sendPlayerInsignia( (char*)pName, pData, size ); MPlayer->insigniaList[MPlayer->commanderID] = 1; delete pData; } if ( userInput->isLeftClick() && !bExpanded ) { for ( int j = FIRST_COLOR_RECT; j < LAST_COLOR_RECT+1; j++ ) { if ( rects[j].pointInside( userInput->getMouseX(), userInput->getMouseY() ) ) { // OK, figure out if this is remotely viable.... // x out colors that are already taken if ( getButton(MP_PREFS_BASE )->isPressed() ) { setColor( rects[j].getColor() ); } else setHighlightColor( rects[j].getColor() ); break; } } } if ( MPlayer && ChatWindow::instance() ) ChatWindow::instance()->update(); }
void QAndroidOffscreenEditText::setHighlightColor(const QColor & color) { setHighlightColor(QColorToAndroidColor(color)); }
void MenuColumn::loadItems() { // Open column's config file KDesktopFile cfg( "xkmenu/" + m_name + "/spec.desktop", true ,"data" ); // Set column specific colors if defined in the file setBackgroundColor( cfg.readColorEntry( "BackgroundColor" ) ); setHighlightColor( cfg.readColorEntry( "HighlightColor" ) ); // Read directories in the column directory. These are components. QStringList compDirs = KGlobal::dirs()->findDirs( "data", "xkmenu/" + m_name ); QStringList::ConstIterator it; for( it = compDirs.begin(); it != compDirs.end(); ++it ) { QDir d( *it ); QStringList comps = d.entryList( "*", QDir::Dirs); // Now iterate through components for( QStringList::ConstIterator comp = comps.begin(); comp != comps.end(); ++comp ) { if( *comp == "." || *comp == ".." ) continue; // Read components config file. KDesktopFile compCfg( *it + "/" + *comp + "/spec.desktop" ); QString type = compCfg.readType(); if( type.lower() == "static" ) { addComponent( new GenericComponent( *it + "/" + *comp, this, backgroundColor(), highlightColor() ) ); } else if( type.lower() == "built-in" || type.lower() == "builtin" ) { QString factory = compCfg.readEntry( "Factory" ); if( factory.lower() == "all programs" ) { addComponent( new AllProgramsComponent( this, backgroundColor(), highlightColor() ) ); } else if( factory.lower() == "recent programs" ) { addComponent( new RecentApplicationsComponent( this, backgroundColor(), highlightColor() ) ); } else if( factory.lower() == "menu extensions" ) { addComponent( new MenuExtensionsComponent( this, backgroundColor(), highlightColor() ) ); } else if( factory.lower() == "separator" ) { //! FIXME: make separator read it's own config file addComponent( new SeparatorComponent( this, backgroundColor(), compCfg.readColorEntry( "HighlightColor" ) ) ); } } else if( type.lower() == "plugin" || type.lower() == "plug-in" ) { //! TODO: implement dynamic loading... later } } addSpacer(); } }