Beispiel #1
0
void
JXButton::SetShortcuts
	(
	const JCharacter* list
	)
{
	JXWindow* w = GetWindow();
	w->ClearShortcuts(this);
	w->InstallShortcuts(this, list);

	const JBoolean wasReturnButton = itsIsReturnButtonFlag;
	itsIsReturnButtonFlag = kJFalse;
	if (list != NULL)
		{
		JString shortcuts = list;
		if (shortcuts.Contains("^M") || shortcuts.Contains("^m"))
			{
			itsIsReturnButtonFlag = kJTrue;
			}
		}

	const JSize borderWidth = GetBorderWidth();
	if (!wasReturnButton && itsIsReturnButtonFlag)
		{
		SetBorderWidth(borderWidth+1);
		}
	else if (wasReturnButton && !itsIsReturnButtonFlag && borderWidth > 0)
		{
		SetBorderWidth(borderWidth-1);
		}

	Refresh();
}
JXMenuBar::JXMenuBar
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x,y, w,h),
	itsOverflowMenu(NULL),
	itsIgnoreWidthChangedCount(0)
{
	itsMenus = new JPtrArray<JXMenu>(JPtrArrayT::kForgetAll);
	assert( itsMenus != NULL );

	SetBorderWidth(kJXDefaultBorderWidth);

	JXDockManager* dockMgr;
	if (JXGetDockManager(&dockMgr))
		{
		Move(JXDocktab::kWidth, 0);
		AdjustSize(-JXDocktab::kWidth, 0);

		JXDocktab* tab =
			new JXDocktab(enclosure,
						  hSizing == kFixedRight ? kFixedRight : kFixedLeft,
						  vSizing, x, y, JXDocktab::kWidth, h);
		assert( tab != NULL );
		}
}
GMMessageDragSource::GMMessageDragSource
	(
	GMessageViewDir*	dir,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXImageWidget(enclosure, hSizing, vSizing, x,y, w,h)
{
	itsDir	= dir;

	JXImage* icon = new JXImage(GetDisplay(), envelope_front);
	assert( icon != NULL );
	icon->ConvertToRemoteStorage();
	SetImage(icon, kJTrue);

	SetHint(kHintText);

	SetBorderWidth(0);

	// targets for DND

	itsMessageXAtom	= GetDisplay()->RegisterXAtom(kDragMessagesXAtomName);
}
void
JXInputField::SetTable
	(
	JXEditTable* table
	)
{
	assert( itsTable == NULL && table != NULL );

	itsTable = table;
	WantInput(kJTrue, kJTrue);
	SetBorderWidth(1);
}
JXBorderRect::JXBorderRect
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXDecorRect(enclosure, hSizing, vSizing, x,y, w,h)
{
	SetBorderWidth(1);
}
Widget::Widget
	(
	JXContainer* enclosure,
	const HSizingOption hSizing, 
	const VSizingOption vSizing,
	const JCoordinate x, 
	const JCoordinate y,
	const JCoordinate w, 
	const JCoordinate h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x, y, w, h)
{
	// We have to tell JXWidget that we want a border.
	// Only then will DrawBorder() get called.
	SetBorderWidth(kJXDefaultBorderWidth);
}
JXImageCheckbox::JXImageCheckbox
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXCheckbox(enclosure, hSizing, vSizing, x,y, w,h)
{
	itsImage         = NULL;
	itsOwnsImageFlag = kJTrue;

	SetBorderWidth(kJXDefaultBorderWidth);
}
Beispiel #8
0
JXButton::JXButton
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x,y, w,h)
{
	itsIsReturnButtonFlag = kJFalse;
	itsIsPushedFlag       = kJFalse;

	SetBorderWidth(kJXDefaultBorderWidth);
}
JXImageWidget::JXImageWidget
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXScrollableWidget(NULL, enclosure, hSizing, vSizing, x,y, w,h)
{
	itsImage            = NULL;
	itsOwnsImageFlag    = kJTrue;
	itsAdjustBoundsTask = NULL;

	SetBorderWidth(0);
}
Beispiel #10
0
JXRadioGroup::JXRadioGroup
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x,y, w,h)
{
	itsButtons = new JPtrArray<JXRadioButton>(JPtrArrayT::kForgetAll);
	assert( itsButtons != NULL );

	itsSelection = NULL;

	SetBorderWidth(kFrameDownWidth + kFrameUpWidth);
}
JX3DWidget::JX3DWidget
	(
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXWidget(enclosure, hSizing, vSizing, x,y, w,h),
	itsShowFocusFlag(kJTrue),
	itsStartPos(3)
{
	itsCamera = NULL;

	SetBorderWidth(kJXDefaultBorderWidth);
	SetBackColor(GetColormap()->GetBlackColor());
	SetFocusColor(GetColormap()->GetBlackColor());

// can't do this until JXMesaCamera can give the buffer pixmap to Mesa
//	GetWindow()->UsePixmapAsBackground(kJTrue);
}
Beispiel #12
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();
}
void CheckBoxObject::LoadFromXml(const TiXmlElement * elem)
{
    if ( elem->FirstChildElement( "String" ) == NULL ||
         elem->FirstChildElement( "String" )->Attribute("value") == NULL )
    {
        cout << "Les informations concernant le texte d'un objet Text manquent.";
    }
    else
    {
        SetString(elem->FirstChildElement("String")->Attribute("value"));
    }

    if ( elem->FirstChildElement( "Checked" ) == NULL ||
         elem->FirstChildElement( "Checked" )->Attribute("value") == NULL )
    {
        cout << "Les informations concernant le texte d'un objet Text manquent.";
    }
    else
    {
        int checked = 0;
        elem->FirstChildElement("Checked")->QueryIntAttribute("value", &checked);

        SetChecked(static_cast<bool>(checked));
    }

    if ( elem->FirstChildElement( "Font" ) == NULL ||
         elem->FirstChildElement( "Font" )->Attribute("value") == NULL )
    {
        cout << "Les informations concernant la police d'un objet Text manquent.";
    }
    else
    {
        SetFont(elem->FirstChildElement("Font")->Attribute("value"));
    }

    if ( elem->FirstChildElement( "CharacterSize" ) == NULL ||
         elem->FirstChildElement( "CharacterSize" )->Attribute("value") == NULL )
    {
        cout << "Les informations concernant la taille du texte d'un objet Text manquent.";
    }
    else
    {
        float size = 12;
        elem->FirstChildElement("CharacterSize")->QueryFloatAttribute("value", &size);

        SetCharacterSize(size);
    }

    //Background Scheme
    if ( elem->FirstChildElement( "BackgroundColorScheme" ) == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load background color full scheme.";
    }
    else
    {
        backgroundColor->LoadFromXml(elem->FirstChildElement( "BackgroundColorScheme" ));
    }

    //Border Scheme
    if ( elem->FirstChildElement( "BorderColorScheme" ) == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load border color full scheme.";
    }
    else
    {
        borderColor->LoadFromXml(elem->FirstChildElement( "BorderColorScheme" ));
    }

    //Text Scheme
    if ( elem->FirstChildElement( "TextColorScheme" ) == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load text color full scheme.";
    }
    else
    {
        textColor->LoadFromXml(elem->FirstChildElement( "TextColorScheme" ));
    }

    //Check Scheme
    if ( elem->FirstChildElement( "CheckColorScheme" ) == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load check color full scheme.";
    }
    else
    {
        checkColor->LoadFromXml(elem->FirstChildElement( "CheckColorScheme" ));
    }

    if ( elem->FirstChildElement( "BorderWidth" ) == NULL ||
         elem->FirstChildElement( "BorderWidth" )->Attribute("value") == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load width of border";
    }
    else
    {
        float borderW = 12;
        elem->FirstChildElement("BorderWidth")->QueryFloatAttribute("value", &borderW);

        SetBorderWidth(borderW);
    }

    if ( elem->FirstChildElement( "Padding" ) == NULL ||
         elem->FirstChildElement( "Padding" )->Attribute("value") == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load padding";
    }
    else
    {
        float pad = 12;
        elem->FirstChildElement("Padding")->QueryFloatAttribute("value", &pad);

        SetPadding(pad);
    }

    if ( elem->FirstChildElement( "BoxSize" ) == NULL ||
         elem->FirstChildElement( "BoxSize" )->Attribute("value") == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load box size";
    }
    else
    {
        int boxS = 14;
        elem->FirstChildElement("BoxSize")->QueryIntAttribute("value", &boxS);

        SetBoxSize(boxS);
    }

    if ( elem->FirstChildElement( "CheckSignSize" ) == NULL ||
         elem->FirstChildElement( "CheckSignSize" )->Attribute("value") == NULL )
    {
        cout << "Widgets Extension Warning : Unable to load check sign size";
    }
    else
    {
        int checkS = 6;
        elem->FirstChildElement("CheckSignSize")->QueryIntAttribute("value", &checkS);

        SetCheckSignSize(checkS);
    }

    UpdateProperties();
}