Пример #1
0
//======================================================================
//======================================================================
void NvUIButton::SetTitle(const char *title, float ptsize, bool shadowed)
{
    const bool push = (m_type==NvUIButtonType::PUSH);
    if (ptsize==0)
        ptsize = (GetHeight() * 0.75f); // some default...

    if (m_title==NULL)
    {
        m_title = new NvUIText(title, NvUIFontFamily::DEFAULT, ptsize,
                                push ? NvUITextAlign::CENTER : NvUITextAlign::LEFT);
    }
    else
    { // already have one, so just call proper setter methods
        m_title->SetString(title);
        m_title->SetFontSize(ptsize);
        m_title->SetAlignment(push ? NvUITextAlign::CENTER : NvUITextAlign::LEFT);
    }

    SetTitleColor(NV_PC_PREDEF_WHITE);

    if (shadowed)
        m_title->SetShadow(4); // a little deeper shadow than the default 2px.
    // for checkbox/radio, the width is totally wrong at this point.
    //m_title->SetTextBox(m_rect.width, m_title->GetFontSize(), 0, 0);
}
Пример #2
0
void
InfoBoxData::SetAllColors(unsigned color)
{
  SetTitleColor(color);
  SetValueColor(color);
  SetCommentColor(color);
}
Пример #3
0
void Graph::SetDefaults()
{
	m_BkColor = QColor(0,10,20);
	m_BorderColor = QColor(200,200,200);
	m_BorderStyle = 0;
	m_BorderWidth = 3;

	m_LogPixelsY = 96;

	m_AxisStyle = 0;
	m_AxisWidth = 1;

	m_bYInverted = false;

	QFont TmpFont;
//	TmpFont.CreatePointFont(85, "Comic Sans MS");

	SetTitleLogFont(&TmpFont);
	SetLabelLogFont(&TmpFont);

	SetAxisColor(QColor(200,200,200));
	SetTitleColor(QColor(255,255,255));
	SetLabelColor(QColor(255,255,255));

	m_bXMajGrid = true;
	m_bYMajGrid = true;
	m_bXMinGrid = false;
	m_bYMinGrid = false;

	m_XMajStyle = 1;
	m_YMajStyle = 1;
	m_XMajWidth = 1;
	m_YMajWidth = 1;
	m_XMajClr   = QColor(90,90,90);
	m_YMajClr   = QColor(90,90,90);

	m_XMinStyle = 1;
	m_YMinStyle = 1;
	m_XMinWidth = 1;
	m_YMinWidth = 1;
	m_XMinClr   = QColor(50,50,50);
	m_YMinClr   = QColor(50,50,50);

	m_XMinorUnit = 0.1;
	m_YMinorUnit = 0.1;
}
Пример #4
0
void QGraph::LoadSettings(QSettings *pSettings)
{
	int k;

	QString FontName;
	QFont lgft;
	bool bs, ba;
	int s,w;
	int r,g,b;
	double f;

	pSettings->beginGroup(m_GraphName);
	{
		//read variables
		r = pSettings->value("AxisColorRed",255).toInt();
		g = pSettings->value("AxisColorGreen",255).toInt();
		b = pSettings->value("AxisColorBlue",255).toInt();
		SetAxisColor(QColor(r,g,b));

		k = pSettings->value("AxisStyle",0).toInt();
		SetAxisStyle(k);
		k = pSettings->value("AxisWidth",1).toInt();
		SetAxisWidth(k);

		r = pSettings->value("TitleColorRed",255).toInt();
		g = pSettings->value("TitleColorGreen",255).toInt();
		b = pSettings->value("TitleColorBlue",255).toInt();
		SetTitleColor(QColor(r,g,b));
		r = pSettings->value("LabelColorRed",255).toInt();
		g = pSettings->value("LabelColorGreen",255).toInt();
		b = pSettings->value("LabelColorBlue",255).toInt();
		SetLabelColor(QColor(r,g,b));

		FontName = pSettings->value("TitleFontName","Comic Sans MS").toString();
		lgft.setFamily(FontName);
		lgft.setPointSize(pSettings->value("TitleFontSize",8).toInt());
		SetTitleLogFont(&lgft);

		FontName = pSettings->value("LabelFontName","Comic Sans MS").toString();
		lgft.setFamily(FontName);
		lgft.setPointSize(pSettings->value("LabelFontSize",8).toInt());
		SetLabelLogFont(&lgft);


		r  = pSettings->value("XMajGridColorRed",90).toInt();
		g  = pSettings->value("XMajGridColorGreen",90).toInt();
		b  = pSettings->value("XMajGridColorBlue",90).toInt();
		bs = pSettings->value("XMajGridShow",true).toBool();
		s  = pSettings->value("XMajGridStyle",1).toInt();
		w  = pSettings->value("XMajGridWidth",1).toInt();
		SetXMajGrid(bs,QColor(r,g,b),s,w);

		r  = pSettings->value("YMajGridColorRed",90).toInt();
		g  = pSettings->value("YMajGridColorGreen",90).toInt();
		b  = pSettings->value("YMajGridColorBlue",90).toInt();
		bs = pSettings->value("YMajGridShow",true).toBool();
		s  = pSettings->value("YMajGridStyle",1).toInt();
		w  = pSettings->value("YMajGridWidth",1).toInt();
		SetYMajGrid(bs,QColor(r,g,b),s,w);

		r  = pSettings->value("XMinGridColorRed",50).toInt();
		g  = pSettings->value("XMinGridColorGreen",50).toInt();
		b  = pSettings->value("XMinGridColorBlue",50).toInt();
		ba = pSettings->value("XMinGridAuto",true).toBool();
		bs = pSettings->value("XMinGridShow",false).toBool();
		s  = pSettings->value("XMinGridStyle",2).toInt();
		w  = pSettings->value("XMinGridWidth",1).toInt();
		f  = pSettings->value("XMinGridUnit", 0.01).toDouble();
		SetXMinGrid(bs,ba,QColor(r,g,b),s,w,f);

		r  = pSettings->value("YMinGridColorRed",50).toInt();
		g  = pSettings->value("YMinGridColorGreen",50).toInt();
		b  = pSettings->value("YMinGridColorBlue",50).toInt();
		ba = pSettings->value("YMinGridAuto",true).toBool();
		bs = pSettings->value("YMinGridShow",false).toBool();
		s  = pSettings->value("YMinGridStyle",2).toInt();
		w  = pSettings->value("YMinGridWidth",1).toInt();
		f  = pSettings->value("YMinGridUnit",0.01).toDouble();
		SetYMinGrid(bs,ba,QColor(r,g,b),s,w,f);

		r  = pSettings->value("BorderColorRed",200).toInt();
		g  = pSettings->value("BorderColorGreen",200).toInt();
		b  = pSettings->value("BorderColorBlue",200).toInt();
		s  = pSettings->value("BorderStyle",0).toInt();
		w  = pSettings->value("BorderWidth",2).toInt();
		m_bBorder = pSettings->value("BorderShow", true).toBool();
		SetBorderColor(QColor(r,g,b));
		SetBorderStyle(s);
		SetBorderWidth(w);

		r  = pSettings->value("BackColorRed",0).toInt();
		g  = pSettings->value("BackColorGreen",20).toInt();
		b  = pSettings->value("BackColorBlue",20).toInt();
		SetBkColor(QColor(r,g,b));

		m_bYInverted = pSettings->value("Inverted", false).toBool();

		m_X  = pSettings->value("XVariable",1).toInt();
		m_Y  = pSettings->value("YVariable",0).toInt();
	}
	pSettings->endGroup();
}