Example #1
0
void Graphics::drawText(const char_t* text, ulong_t length, const Point& topLeft, bool inverted)
{
    FontEffects fx = font_.effects();    
    PalmUnderlineSetter setUnderline(convertUnderlineMode(fx.underline()));

    ScalingSetter setScaling(*this);

    uint_t height = fontHeight();
    uint_t top=topLeft.y;
    if (fx.subscript())
        top+=(height/3);
    if (inverted)
        WinDrawInvertedChars(text, length, topLeft.x, top);
    else         
        WinDrawChars(text, length, topLeft.x, top);

    if (fx.strikeOut())
    {
        uint_t baseline = fontBaseline();
        top=topLeft.y + (baseline*2)/3;
        uint_t width = FntCharsWidth(text, length);
        Color_t color=setTextColor(0);
        setTextColor(color); // Quite strange method of querying current text color...
        color=setForegroundColor(color);
        WinDrawOperation old;
        if (inverted)
            old=WinSetDrawMode(winInvert);
        drawLine(topLeft.x, top, topLeft.x+width, top);
        if (inverted)
            WinSetDrawMode(old);
        setForegroundColor(color);
    }
  }
Example #2
0
void Win3D::initializeGL()
{
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHTING);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_COLOR_MATERIAL);

    // Default colors
    setForegroundColor(QColor(svar.GetString("Win3D.ForegroundColor","#B4B4B4").c_str()));
    setBackgroundColor(QColor(svar.GetString("Win3D.BackgroundColor","#333333").c_str()));

    // Clear the buffer where we're going to draw
    if (format().stereo())
    {
        glDrawBuffer(GL_BACK_RIGHT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glDrawBuffer(GL_BACK_LEFT);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }
    else
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // Calls user defined method. Default emits a signal.
    init();

    // Give time to glInit to finish and then call setFullScreen().
    if (isFullScreen())
        QTimer::singleShot( 100, this, SLOT(delayedFullScreen()) );
}
Example #3
0
PopupWindow::PopupWindow(const char* sName,WidgetManager* sManager,const char* sTitleString)
	:Container(sName,0,false),manager(sManager),
	 titleBar(0),hideButton(0),closeButton(0),
	 resizableMask(0x3),
	 childBorderWidth(0.0f),
	 child(0),
	 isResizing(false)
	 #if GLMOTIF_POPUPWINDOW_USE_RENDERCACHE
	 ,version(1)
	 #endif
	{
	/* Get the style sheet: */
	const StyleSheet* ss=manager->getStyleSheet();
	
	/* Create the title bar widget: */
	titleBar=new TitleBar("TitleBar",this,sTitleString,false);
	
	/* Set the popup window's default layout: */
	setBorderWidth(0.0f);
	setBorderType(Widget::PLAIN);
	setBorderColor(ss->borderColor);
	setBackgroundColor(ss->bgColor);
	setForegroundColor(ss->fgColor);
	childBorderWidth=ss->popupWindowChildBorderWidth;
	
	titleBar->manageChild();
	
	/* Create the hide button by default: */
	setHideButton(true);
	}
Example #4
0
void eButton::gotFocus()
{
#ifndef DISABLE_LCD
	if (parent && parent->LCDElement)
	{
		if (descr)
		{
			LCDTmp = new eLabel(parent->LCDElement);
			LCDTmp->hide();
			eSize s = parent->LCDElement->getSize();
			LCDTmp->move(ePoint(0,s.height()/2));
			LCDTmp->resize(eSize(s.width(), s.height()/2));
			LCDTmp->setText(text);
			LCDTmp->setBackgroundColor(255);
			LCDTmp->show();
			tmpDescr = new eLabel(parent->LCDElement);
			tmpDescr->hide();
			tmpDescr->move(ePoint(0,0));
			tmpDescr->resize(eSize(s.width(), s.height()/2));
			tmpDescr->setText(descr->getText());
			tmpDescr->show();
		}
		else
			parent->LCDElement->setText(text);
	}
#endif
	setForegroundColor(focusF,false);
	setBackgroundColor(focusB);
}
Example #5
0
void LogViewer::init()
{
    setAcceptDrops(true);
    setReadOnly(true);
    setTabWidth(4);
    setLineWrapMode(QPlainTextEdit::NoWrap);
    setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);

    QPalette palette;
    palette.setColor(QPalette::Inactive, QPalette::Highlight, palette.color(QPalette::Active, QPalette::Highlight));
    palette.setColor(QPalette::Inactive, QPalette::HighlightedText, palette.color(QPalette::Active, QPalette::HighlightedText));
    setPalette(palette);

    // Read settings.
    setFont(INIMANAGER()->font());
    setForegroundColor(INIMANAGER()->foregroundColor());
    setBackgroundColor(INIMANAGER()->backgroundColor());
    setCustomBackgroundColor(INIMANAGER()->customBackgroundColor());
    setCurrentLineFgColor(INIMANAGER()->currentLineFgColor());
    setCurrentLineBgColor(INIMANAGER()->currentLineBgColor());

    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(drawCurrentLine()));
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(blockCountChanged(int)));
    connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    // Line Number.
    updateLineNumberAreaWidth(0);
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));

    // Keyword Highlighter.
    connect(m_keywordHighlighter, SIGNAL(modelCreated(QStandardItemModel*)), this, SLOT(modelCreated(QStandardItemModel*)));
    connect(m_keywordHighlighter, SIGNAL(chartLoaded(QPixmap*)), this, SLOT(chartLoaded(QPixmap*)));
}
Example #6
0
PlotWidget::PlotWidget(QWidget * parent) : KPlotWidget(parent)
, mKpoBCWP(NULL)
, mKpoBCWS(NULL)
, mKpoACWP(NULL)
{
    kDebug() << "------------> ChartWidget :: Constructor"<<endl;

    // UI Parameters
    setBackgroundColor(Qt::white);
    setForegroundColor(Qt::black);
    setGridColor(Qt::black);
    setAntialiasing(false);

//     // creating a plot object whose points are connected by red lines 
//     mKpoBCWP = new KPlotObject( Qt::black, KPlotObject::Lines );
//     mKpoBCWS = new KPlotObject( Qt::green, KPlotObject::Lines );
//     mKpoACWP = new KPlotObject( Qt::red, KPlotObject::Lines );
// 
//     // ... and adding the object to the plot widget
//     addPlotObject(mKpoBCWP);
//     addPlotObject(mKpoBCWS);
//     addPlotObject(mKpoACWP);

    kDebug() << "ChartWidget :: Constructor Ended"<<endl;
}
Example #7
0
void VCWidget::chooseForegroundColor()
{
	QColor color;
	color = QColorDialog::getColor(foregroundColor());
	if (color.isValid())
		setForegroundColor(color);
}
Example #8
0
RadioButton::RadioButton(const std::string &caption, const std::string &group,
                         bool marked):
    gcn::RadioButton(caption, group, marked),
    mHasMouse(false)
{
    setForegroundColor(Theme::getThemeColor(Theme::TEXT));
    if (instances == 0)
    {
        radioNormal = Theme::getImageFromTheme("radioout.png");
        radioChecked = Theme::getImageFromTheme("radioin.png");
        radioDisabled = Theme::getImageFromTheme("radioout.png");
        radioDisabledChecked = Theme::getImageFromTheme("radioin.png");
        radioNormalHi = Theme::getImageFromTheme("radioout_highlight.png");
        radioCheckedHi = Theme::getImageFromTheme("radioin_highlight.png");
        if (radioNormal)
            radioNormal->setAlpha(mAlpha);
        if (radioChecked)
            radioChecked->setAlpha(mAlpha);
        if (radioDisabled)
            radioDisabled->setAlpha(mAlpha);
        if (radioDisabledChecked)
            radioDisabledChecked->setAlpha(mAlpha);
        if (radioNormalHi)
            radioNormalHi->setAlpha(mAlpha);
        if (radioCheckedHi)
            radioCheckedHi->setAlpha(mAlpha);
    }

    instances++;
}
Example #9
0
bool VCWidget::loadXMLAppearance(const QDomElement* root)
{
    QDomNode node;
    QDomElement tag;

    Q_ASSERT(root != NULL);

    if (root->tagName() != KXMLQLCVCWidgetAppearance)
    {
        qWarning() << Q_FUNC_INFO << "Appearance node not found!";
        return false;
    }

    /* Children */
    node = root->firstChild();
    while (node.isNull() == false)
    {
        tag = node.toElement();
        if (tag.tagName() == KXMLQLCVCWidgetForegroundColor)
        {
            if (tag.text() != KXMLQLCVCWidgetColorDefault)
                setForegroundColor(QColor(tag.text().toUInt()));
            else if (hasCustomForegroundColor() == true)
                resetForegroundColor();
        }
        else if (tag.tagName() == KXMLQLCVCWidgetBackgroundColor)
        {
            if (tag.text() != KXMLQLCVCWidgetColorDefault)
                setBackgroundColor(QColor(tag.text().toUInt()));
        }
/*
        else if (tag.tagName() == KXMLQLCVCWidgetBackgroundImage)
        {
            if (tag.text() != KXMLQLCVCWidgetBackgroundImageNone)
                setBackgroundImage(m_doc->denormalizeComponentPath(tag.text()));
        }
*/
        else if (tag.tagName() == KXMLQLCVCWidgetFont)
        {
            if (tag.text() != KXMLQLCVCWidgetFontDefault)
            {
                QFont font;
                font.fromString(tag.text());
                setFont(font);
            }
        }
        else if (tag.tagName() == KXMLQLCVCFrameStyle)
        {
            /** LEGACY: no more supported/needed */
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown appearance tag:" << tag.tagName();
        }

        node = node.nextSibling();
    }

    return true;
}
Example #10
0
bool KstViewLabel::readConfigWidget(QWidget *w) {
  ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w);
  if (!widget) {
    return false;
  }

  _txt = widget->_text->text();
  // No, this is broken.  It kills latex.
#if 0
  // Replace tabs and newlines in text edit box with \n and \t 
  _txt.replace(QString("\n"), "\\n");
  _txt.replace(QString("\t"), "\\t");
#endif

  setDataPrecision(widget->_precision->value());
  setRotation(widget->_rotation->value());
  setFontSize(widget->_fontSize->value());
  setHorizJustifyWrap(widget->_horizontal->currentItem());
  setForegroundColor(widget->_fontColor->color());
  setFontName(widget->_font->currentFont().toString());

  setTransparent(widget->_transparent->isChecked());
  setBorderWidth(widget->_border->value());
  setBorderColor(widget->_boxColors->color());
  setBackgroundColor(widget->_boxColors->color());
  setLabelMargin(widget->_margin->value());
 
  reparse(); // calls setDirty()
  return true;
}
OpenGLRenderer::OpenGLRenderer() :
	m_BackgroundColor(OpenGLColorCornflowerBlue()),
	m_ForegroundColor(OpenGLColorBlack())
{
  setBackgroundColor(OpenGLColorCornflowerBlue());
  setForegroundColor(OpenGLColorBlack());
}
Example #12
0
void TrackballViewer::init()
{
  std::cout << "Initialize Trackball Viewer.\n";

  BasicViewer::init();

  // Set shader
  glEnable(GL_DEPTH_TEST);
  glDisable(GL_BLEND);
  //glEnable(GL_CULL_FACE);

  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
  glShadeModel(GL_FLAT);

  qglClearColor(QColor(Qt::white));
  setBackgroundColor(QColor(Qt::white));
  setForegroundColor(QColor(Qt::white));

  setSceneCenter(qglviewer::Vec(0, 0, 0));
  setSceneRadius(50);
  camera()->fitSphere(qglviewer::Vec(0, 0, 0), 5);
  camera()->setType(qglviewer::Camera::Type::PERSPECTIVE);
  camera()->setFlySpeed(0.5);
  setWheelandMouse();
}
Example #13
0
void ToolSettings::selectToolSlot(int i)
{
	_quickslot[i]->setChecked(true);
	_currentQuickslot = i;

	setForegroundColor(_toolprops[i].foregroundColor());
	selectTool(tools::Tool::Type(_toolprops[i].currentTool()));
}
Example #14
0
/**
 * Draw the initial state of the board.
 *
 * @param state The game state to draw.
 */
void drawBoard(GameState* state) {
    int i, j;


    for (i = 0; i < 9; i++) {


        moveCursor(boardTop + i * 2, boardLeft);
        for (j = 0; j < 2 * 9 + 1; j++) {

            if ((i % 3) == 0 || (j % 6) == 0) {
                setForegroundColor(COLOR_WHITE);
                setBold(1);
            } else {
                setForegroundColor(COLOR_BLUE);
            }

            printf("-");

            setBold(0);
        }

        moveCursor(boardTop + i * 2 + 1, boardLeft);
        for (j = 0; j < 9; j++) {

            if ((j % 3) == 0) {
                setForegroundColor(COLOR_WHITE);
                setBold(1);
            } else {
                setForegroundColor(COLOR_BLUE);
            }
            printf("|");

            setForegroundColor(COLOR_WHITE);
            setBold(1);
            if (state->board[i][j] != '0') {
                printf("%c", state->board[i][j]);
            } else {
                printf(" ");
            }
            setBold(0);
        }

        setForegroundColor(COLOR_WHITE);
        setBold(1);
        printf("|");
        setBold(0);
    }

    setBold(1);
    setForegroundColor(COLOR_WHITE);
    moveCursor(boardTop + 9 * 2, boardLeft);
    for (j = 0; j < 9; j++) {
        printf("--");
    }
    printf("-");
    setBold(0);

    moveCursor(boardTop + 1, boardLeft + 1);
}
Example #15
0
CLabel::CLabel(const string &name, int id, Color fgcolor, Color bgcolor, bool bold)
	: CWidget(name, id)
{
	_centered = true;

	setForegroundColor(fgcolor);
	setBackgroundColor(bgcolor);
	setBold(bold);
}
KoCanvasResourceManager::KoCanvasResourceManager(QObject *parent)
        : QObject(parent),
        d(new Private())
{
    const KoColorSpace* cs = KoColorSpaceRegistry::instance()->rgb8();
    setForegroundColor(KoColor(Qt::black, cs));
    setBackgroundColor(KoColor(Qt::white, cs));
    setResource(ApplicationSpeciality, NoSpecial);
}
bool KstViewLabel::readConfigWidget(QWidget *w, bool editMultipleMode) {
  ViewLabelWidget *widget = dynamic_cast<ViewLabelWidget*>(w);
  if (!widget) {
    return false;
  }

  if (!editMultipleMode || widget->_text->text().compare(QString(" ")) != 0) {
    _txt = widget->_text->text();
  }

  if (!editMultipleMode || widget->_precision->value() != widget->_precision->minValue()) {
    setDataPrecision(widget->_precision->value());
  }

  if (!editMultipleMode || widget->_rotation->value() != widget->_rotation->minValue()) {
    setRotation(widget->_rotation->value());
  }

  if (!editMultipleMode || widget->_fontSize->value() != widget->_fontSize->minValue()) {
    setFontSize(widget->_fontSize->value());
  }

  if (!editMultipleMode || widget->_horizontal->currentText().compare(QString(" ")) != 0) {
    setHorizJustifyWrap(widget->_horizontal->currentItem());
  }

  if (!editMultipleMode || widget->_fontColor->color() != QColor()) {
    setForegroundColor(widget->_fontColor->color());
  }

  if (!editMultipleMode || widget->_font->currentText().compare(QString(" ")) != 0) {
    setFontName(widget->_font->currentFont());
  }

  if (!editMultipleMode || widget->_transparent->state() != QButton::NoChange) {
    setTransparent(widget->_transparent->isChecked());
  }

  if (!editMultipleMode || widget->_border->value() != widget->_border->minValue()) {
    setBorderWidth(widget->_border->value());
  }

  if (!editMultipleMode || widget->_changedFgColor) {
    setBorderColor(widget->_boxColors->foreground());
  }

  if (!editMultipleMode || widget->_changedBgColor) {
    setBackgroundColor(widget->_boxColors->background());
  }

  if (!editMultipleMode || widget->_margin->value() != widget->_margin->minValue()) {
    setLabelMargin(widget->_margin->value());
  }

  reparse(); // calls setDirty()
  return true;
}
Example #18
0
void eProgress::init_eProgress()
{
	left = eSkin::getActive()->queryScheme("eProgress.left");
	right = eSkin::getActive()->queryScheme("eProgress.right");
	perc = start = 0;
	border = 2;
	direction = 0;
	sliderPixmap = NULL;
	setForegroundColor(eSkin::getActive()->queryScheme("eProgress.border"));
}
Example #19
0
ImageButton::ImageButton() : gcn::Button (), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = NULL;
	setFrameSize(0);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
Example #20
0
ImageButton::ImageButton(const std::string &caption) : gcn::Button (caption), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = NULL;
	setFrameSize(0);
	setActionEventId(caption);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
Example #21
0
CListWidget::CListWidget(const string &name, int id, Color fgcolor, Color bgcolor, bool bold)
	: CWidget(name, id)
{
	scrollok(_window, true);
	_scroll = 0;
	_count = 0;
	_autoScroll = true;

	setForegroundColor(fgcolor);
	setBackgroundColor(bgcolor);
	setBold(bold);
}
Example #22
0
ImageButton::ImageButton(const std::string &caption, const std::string &icf) : gcn::Button (caption), GlassWidget(this) {
	idleState = state = GB_IDLE;
	icon = gcn::Image::load(icf.c_str());
	if(icon)
		setSize(icon->getWidth(),icon->getHeight());
	setFrameSize(0);
	setActionEventId(caption);
	setForegroundColor(gcn::Color(255,255,255));
		
	//for GlassWidget
	addActionListener(this);
	//addMouseListener((GlassWidget*)this);
}
Example #23
0
EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being,
                                 bool foring):
    Window(_("Equipment"), false, nullptr, "equipment.xml"),
    mEquipment(equipment),
    mSelected(-1),
    mForing(foring),
    mImageSet(nullptr)
{
    mBeing = being;
    mItemPopup = new ItemPopup;
    if (setupWindow)
        setupWindow->registerWindowForReset(this);

    // Control that shows the Player
    mPlayerBox = new PlayerBox;
    mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168));
    mPlayerBox->setPlayer(being);

    if (foring)
        setWindowName("Being equipment");
    else
        setWindowName("Equipment");

    setCloseButton(true);
    setSaveVisible(true);
    setStickyButtonLock(true);

    setDefaultSize(180, 345, ImageRect::CENTER);

    mBoxes.reserve(BOX_COUNT);
    for (int f = 0; f < BOX_COUNT; f ++)
        mBoxes.push_back(nullptr);

    fillBoxes();

    loadWindowState();

    mUnequip = new Button(_("Unequip"), "unequip", this);
    const gcn::Rectangle &area = getChildrenArea();
    mUnequip->setPosition(area.width  - mUnequip->getWidth() - 5,
                          area.height - mUnequip->getHeight() - 5);
    mUnequip->setEnabled(false);

    add(mPlayerBox);
    add(mUnequip);

    mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT);
    mBorderColor = Theme::getThemeColor(Theme::BORDER);
    setForegroundColor(Theme::getThemeColor(Theme::TEXT));
}
Example #24
0
CTabWidget::CTabWidget(const string &name, int id, Color fgcolor, Color bgcolor, bool bold)
	: CWidget(name, id)
{
	_currentIndex = -1;
	_bottom = false;
	_listenKeys = false;

	CLayout *layout = new CVBoxLayout();
	setLayout(layout);

	setForegroundColor(fgcolor);
	setBackgroundColor(bgcolor);
	setBold(bold);
}
Example #25
0
void ToolSettings::readSettings()
{
	QSettings cfg;
	cfg.beginGroup("tools");
	cfg.beginGroup("toolset");
	for(auto ts : d->toolSettings) {
		cfg.beginGroup(ts->toolType());
		ts->restoreToolSettings(tools::ToolProperties::load(cfg));
		cfg.endGroup();
	}
	cfg.endGroup();
	setForegroundColor(cfg.value("color").value<QColor>());
	selectTool(tools::Tool::Type(cfg.value("tool").toInt()));
}
Example #26
0
ScaleBar::ScaleBar(const char* sName,GLMotif::WidgetManager* sManager)
	:GLMotif::Widget(sName,0,false),manager(sManager),
	 targetLength(getDisplaySize()*Scalar(0.2)),
	 currentMantissa(1),currentExponent(0),currentNavLength(1),currentScale(1),
	 lengthLabel(0),scaleLabel(0),
	 currentPhysLength(0)
	{
	/* Set widget parameters: */
	setBorderWidth(0.0f);
	setBorderType(GLMotif::Widget::PLAIN);
	
	/* Set default background and foreground colors: */
	Color bgColor=Vrui::getBackgroundColor();
	bgColor[3]=0.0f;
	Color fgColor;
	for(int i=0;i<3;++i)
		fgColor[i]=1.0f-bgColor[i];
	fgColor[3]=1.0f;
	setBorderColor(bgColor);
	setBackgroundColor(bgColor);
	setForegroundColor(fgColor);
	
	/* Create the initial scale bar length label: */
	if(getCoordinateManager()->getUnit().unit!=Geometry::LinearUnit::UNKNOWN)
		{
		char labelText[10];
		snprintf(labelText,sizeof(labelText),"1 %s",getCoordinateManager()->getUnit().getAbbreviation());
		lengthLabel=new GLLabel(labelText,*getUiFont());
		}
	else
		lengthLabel=new GLLabel("1",*getUiFont());
	lengthLabel->setBackground(bgColor);
	lengthLabel->setForeground(fgColor);
	scaleLabel=new GLLabel("1:1",*getUiFont());
	scaleLabel->setBackground(bgColor);
	scaleLabel->setForeground(fgColor);
	
	/* Calculate the initial navigation-space scale bar length: */
	calcSize(getNavigationTransformation());
	
	/* Resize the widget: */
	GLMotif::Vector newSize=calcNaturalSize();
	GLMotif::Vector newOrigin=GLMotif::Vector(0.0f,0.0f,0.0f);
	newOrigin[0]=-newSize[0]*0.5f;
	resize(GLMotif::Box(newOrigin,newSize));
	
	/* Register a navigation change callback with the Vrui kernel: */
	getNavigationTransformationChangedCallbacks().add(this,&ScaleBar::navigationChangedCallback);
	}
Example #27
0
void eButton::init_eButton()
{
	align=eTextPara::dirCenter;
	flags |= eLabel::flagVCenter;
	addActionMap(&i_cursorActions->map);
	if ( !focusF )
		focusF=eSkin::getActive()->queryScheme("global.selected.foreground");
	if ( !focusB )
		focusB=eSkin::getActive()->queryScheme("global.selected.background");
	if ( !normalF )
		normalF=eSkin::getActive()->queryScheme("global.normal.foreground");
	if ( !normalB )
		normalB=eSkin::getActive()->queryScheme("global.normal.background");
	setBackgroundColor(normalB);
	setForegroundColor(normalF);
}
Example #28
0
// protected virtual [base QWidget]
void kpDualColorButton::dropEvent (QDropEvent *e)
{
    QColor col = KColorMimeData::fromMimeData (e->mimeData ());
#if DEBUG_KP_DUAL_COLOR_BUTTON
    qCDebug(kpLogWidgets) << "kpDualColorButton::dropEvent() col="
              << (int *) col.rgba()
              << " (with alpha=" << (int *) col.rgba () << ")" << endl;
#endif

    if (col.isValid ())
    {
        if (foregroundRect ().contains (e->pos ()))
            setForegroundColor (kpColor (col.rgba()));
        else if (backgroundRect ().contains (e->pos ()))
            setBackgroundColor (kpColor (col.rgba()));
    }
}
 void WhiteBoardColorChooser::setColor(ColorLayer layer, const QColor& color)
 {
     switch (layer)
     {
     case ForegroundColor:
         setForegroundColor(color);
         emit foregroundColorChanged(color);
         break;
     case BackgroundColor:
         setBackgroundColor(color);
         emit backgroundColorChanged(color);
         break;
     default:
         Q_ASSERT(false);
         return;
     }
 }
Example #30
0
Popup::Popup(const char* sName,WidgetManager* sManager)
	:Container(sName,0,false),manager(sManager),
	 title(0),child(0)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=manager->getStyleSheet();
	
	/* Set the popup window's default layout: */
	marginWidth=ss->popupMarginWidth;
	titleSpacing=ss->popupTitleSpacing;
	
	setBorderWidth(0.0f);
	setBorderType(Widget::PLAIN);
	setBorderColor(ss->borderColor);
	setBackgroundColor(ss->bgColor);
	setForegroundColor(ss->fgColor);
	}