Example #1
0
TextFieldSlider::TextFieldSlider(const char* sName,Container* sParent,GLint sCharWidth,GLfloat sShaftLength,bool sManageChild)
	:Container(sName,sParent,false),
	 textField(new TextField("TextField",this,sCharWidth,false)),
	 slider(new Slider("Slider",this,Slider::HORIZONTAL,sShaftLength,false)),
	 sliderMapping(LINEAR),valueType(FLOAT),
	 valueMin(0.0),valueMax(1000.0),valueIncrement(1.0),value(500.0)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Initialize the compound widget: */
	setBorderWidth(0.0f);
	setBorderType(PLAIN);
	spacing=ss->size;
	
	/* Initialize the text field: */
	textField->setEditable(true);
	textField->getValueChangedCallbacks().add(this,&TextFieldSlider::textFieldValueChangedCallback);
	
	/* Initialize the slider: */
	slider->getValueChangedCallbacks().add(this,&TextFieldSlider::sliderValueChangedCallback);
	
	/* Manage the children: */
	textField->manageChild();
	slider->manageChild();
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #2
0
void ScrolledImage::init(bool sManageChild)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Set the compound widget's borders: */
	setBorderWidth(ss->textfieldBorderWidth);
	setBorderType(Widget::LOWERED);
	
	/* Disable the image's borders: */
	//image->setBorderWidth(image->getBorderWidth());
	//image->setBorderType(Widget::PLAIN);
	
	/* Initialize the horizontal scroll bar: */
	horizontalScrollBar->setPositionRange(0,image->getImage().getSize(0),image->getImage().getSize(0));
	horizontalScrollBar->getValueChangedCallbacks().add(this,&ScrolledImage::scrollBarCallback);
	
	/* Initialize the vertical scroll bar: */
	verticalScrollBar->setPositionRange(0,image->getImage().getSize(1),image->getImage().getSize(1));
	verticalScrollBar->getValueChangedCallbacks().add(this,&ScrolledImage::scrollBarCallback);
	
	/* Manage the children: */
	image->manageChild();
	horizontalScrollBar->manageChild();
	verticalScrollBar->manageChild();
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #3
0
NewButton::NewButton(const char* sName,Container* sParent,const char* sLabel,bool sManageChild)
	:SingleChildContainer(sName,sParent,false),
	 isArmed(false)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Button defaults to raised border: */
	setBorderType(Widget::RAISED);
	setBorderWidth(ss->buttonBorderWidth);
	
	/* Set the armed background color: */
	armedBackgroundColor=ss->buttonArmedBackgroundColor;
	
	/* Create the label child widget: */
	Label* label=new Label("ButtonLabel",this,sLabel);
	label->setBorderType(Widget::PLAIN);
	label->setBorderWidth(0.0f);
	
	/* Button defaults to some margin: */
	label->setMarginWidth(ss->buttonMarginWidth);
	
	/* Button defaults to centered text: */
	label->setHAlignment(GLFont::Center);
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #4
0
ScrolledListBox::ScrolledListBox(const char* sName,Container* sParent,ListBox::SelectionMode sSelectionMode,int sPreferredWidth,int sPreferredPageSize,bool sManageChild)
	:Container(sName,sParent,false),
	 listBox(new ListBox("ListBox",this,sSelectionMode,sPreferredWidth,sPreferredPageSize,false)),
	 verticalScrollBar(new ScrollBar("VerticalScrollBar",this,ScrollBar::VERTICAL,true,false)),
	 horizontalScrollBar(0)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Set the compound widget's borders: */
	setBorderWidth(ss->textfieldBorderWidth);
	setBorderType(Widget::LOWERED);
	
	/* Initialize the list box: */
	listBox->setBorderWidth(0.0f);
	listBox->setBorderType(Widget::PLAIN);
	listBox->getPageChangedCallbacks().add(this,&ScrolledListBox::listBoxPageChangedCallback);
	
	/* Initialize the vertical scroll bar: */
	verticalScrollBar->setPositionRange(0,0,listBox->getPageSize());
	verticalScrollBar->getValueChangedCallbacks().add(this,&ScrolledListBox::scrollBarCallback);
	
	/* Manage the children: */
	listBox->manageChild();
	verticalScrollBar->manageChild();
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #5
0
    void Ellipse::setProperty(QString &xml)
    {
        QDomDocument doc("xml");
        if (!doc.setContent(xml, false))
            return;

        QDomElement root = doc.documentElement();
        if (root.tagName() != "property")
            return;

        QDomNode n = root.firstChild();
        while (!n.isNull()) {
            QDomElement e = n.toElement();
            QString tagName = e.tagName();

            if (tagName == "border-width")
                setBorderWidth(e.text().toDouble());
            if (tagName == "border-color")
                setBorderColor(Color(e.text()));
            if (tagName == "inner-color")
                setInnerColor(Color(e.text()));

            if (tagName == "show-background")
                setShowBackground(e.text().toInt());
            if (tagName == "aspect-type")
                setAspectType((Ellipse::AspectType)e.text().toInt());
            if (tagName == "line-style")
                setLineStyle((GraphLib::LineStyle)e.text().toInt());
            if (tagName == "dash-length")
                setDashLength(e.text().toDouble());

            n = n.nextSibling();
        }
    }
Example #6
0
KstBorderedViewObject::KstBorderedViewObject(const KstBorderedViewObject& borderedViewObject)
: KstViewObject(borderedViewObject) {
  setBorderColor(borderedViewObject.borderColor());
  setBorderWidth(borderedViewObject.borderWidth());
  setMargin(borderedViewObject.margin());
  setPadding(borderedViewObject.padding());
}
Example #7
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;
}
Example #8
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 #9
0
int QwtKnob::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractSlider::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< KnobStyle*>(_v) = knobStyle(); break;
        case 1: *reinterpret_cast< MarkerStyle*>(_v) = markerStyle(); break;
        case 2: *reinterpret_cast< int*>(_v) = knobWidth(); break;
        case 3: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 4: *reinterpret_cast< double*>(_v) = totalAngle(); break;
        case 5: *reinterpret_cast< int*>(_v) = markerSize(); break;
        case 6: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setKnobStyle(*reinterpret_cast< KnobStyle*>(_v)); break;
        case 1: setMarkerStyle(*reinterpret_cast< MarkerStyle*>(_v)); break;
        case 2: setKnobWidth(*reinterpret_cast< int*>(_v)); break;
        case 3: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 4: setTotalAngle(*reinterpret_cast< double*>(_v)); break;
        case 5: setMarkerSize(*reinterpret_cast< int*>(_v)); break;
        case 6: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #10
0
int QwtThermo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = alarmEnabled(); break;
        case 1: *reinterpret_cast< double*>(_v) = alarmLevel(); break;
        case 2: *reinterpret_cast< ScalePos*>(_v) = scalePosition(); break;
        case 3: *reinterpret_cast< int*>(_v) = spacing(); break;
        case 4: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 5: *reinterpret_cast< double*>(_v) = maxValue(); break;
        case 6: *reinterpret_cast< double*>(_v) = minValue(); break;
        case 7: *reinterpret_cast< int*>(_v) = pipeWidth(); break;
        case 8: *reinterpret_cast< double*>(_v) = value(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setAlarmEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 1: setAlarmLevel(*reinterpret_cast< double*>(_v)); break;
        case 2: setScalePosition(*reinterpret_cast< ScalePos*>(_v)); break;
        case 3: setSpacing(*reinterpret_cast< int*>(_v)); break;
        case 4: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 5: setMaxValue(*reinterpret_cast< double*>(_v)); break;
        case 6: setMinValue(*reinterpret_cast< double*>(_v)); break;
        case 7: setPipeWidth(*reinterpret_cast< int*>(_v)); break;
        case 8: setValue(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
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 #12
0
int QwtWheel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractSlider::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setTotalAngle((*reinterpret_cast< double(*)>(_a[1]))); break;
        case 1: setViewAngle((*reinterpret_cast< double(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< double*>(_v) = totalAngle(); break;
        case 1: *reinterpret_cast< double*>(_v) = viewAngle(); break;
        case 2: *reinterpret_cast< int*>(_v) = tickCnt(); break;
        case 3: *reinterpret_cast< int*>(_v) = wheelWidth(); break;
        case 4: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 5: *reinterpret_cast< int*>(_v) = wheelBorderWidth(); break;
        case 6: *reinterpret_cast< double*>(_v) = mass(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTotalAngle(*reinterpret_cast< double*>(_v)); break;
        case 1: setViewAngle(*reinterpret_cast< double*>(_v)); break;
        case 2: setTickCnt(*reinterpret_cast< int*>(_v)); break;
        case 3: setWheelWidth(*reinterpret_cast< int*>(_v)); break;
        case 4: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 5: setWheelBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 6: setMass(*reinterpret_cast< double*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #13
0
RoutingPlugin::RoutingPlugin( const MarbleModel *marbleModel ) :
    AbstractFloatItem( marbleModel, QPointF( -10, -10 ) ),
    d( new RoutingPluginPrivate( this ) )
{
    setEnabled( true );
    //plugin is visible by default on small screen devices
    setVisible( MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen );
    setPadding( 0.5 );
    setBorderWidth( 1 );
    setBackground( QBrush( QColor( "white" ) ) );
}
KstPlotGroup::KstPlotGroup()
: KstMetaPlot("PlotGroup") {
  _standardActions |= Delete | Raise | Zoom | Lower | RaiseToTop | LowerToBottom;
  _layoutActions |= Delete | Copy | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo;
  setTagName(KstObjectTag(i18n("Plot Group %1").arg(++pgcount), KstObjectTag::globalTagContext));  // FIXME: tag context?
  _type = "PlotGroup";
  setBorderColor(Qt::blue);
  _container = false; // plot group is a container that doesn't behave like one
  setTransparent(true);
  setBorderWidth(0);
}
	//-----------------------------------------------------------------------------
	ZonePlugin::ZonePlugin( bool addToRegistry ):
	BaseClass(addToRegistry),
		_zoneExtent( OS_SCALAR( 0.0 ), OS_SCALAR( 0.0 ), OS_SCALAR( 0.0 ) ),
		_solid(0),
		_zoneId(0),
		_borderWidth( OS_SCALAR( 0.0 ) )
	{
		setPosition( osVector3::zero );
		setZoneExtent( osVector3( OS_SCALAR( 5.0 ), OS_SCALAR( 0.0 ), OS_SCALAR( 5.0 ) ) );
		setBorderWidth( 0.0f );
		setZoneColor( Color::_gBlue );
	}
Example #16
0
Box::Box(Renderer *renderer,  int x, int y, int w, int h, D3DCOLOR color, bool show)
	: RenderBase(renderer), m_bShown(false)
{
	setPos(x, y);
	setBoxWidth(w);
	setBoxHeight(h);
	setBoxColor(color);
	setShown(show);

	setBoxColor(color);
	setBorderWidth(0);
	setBorderShown(false);
}
Example #17
0
int QwtSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractSlider::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< Qt::Orientation*>(_v) = orientation(); break;
        case 1: *reinterpret_cast< ScalePosition*>(_v) = scalePosition(); break;
        case 2: *reinterpret_cast< bool*>(_v) = hasTrough(); break;
        case 3: *reinterpret_cast< bool*>(_v) = hasGroove(); break;
        case 4: *reinterpret_cast< QSize*>(_v) = handleSize(); break;
        case 5: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 6: *reinterpret_cast< int*>(_v) = spacing(); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setOrientation(*reinterpret_cast< Qt::Orientation*>(_v)); break;
        case 1: setScalePosition(*reinterpret_cast< ScalePosition*>(_v)); break;
        case 2: setTrough(*reinterpret_cast< bool*>(_v)); break;
        case 3: setGroove(*reinterpret_cast< bool*>(_v)); break;
        case 4: setHandleSize(*reinterpret_cast< QSize*>(_v)); break;
        case 5: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 6: setSpacing(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 7)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #18
0
void FiledSquare::Change(HDC hdc, RECT rt){

	printf("[1] Left Top Coordinate\n");
	printf("[2] Right Bottom Coordinate\n");
	printf("[3] Border Color\n");
	printf("[4] Main Color\n");
	printf("[5] Border Width\n");

	int mode;
	scanf("%d", &mode);
	switch (mode){
	case 1:{
		printf("x y\n");
		point newx;
		scanf("%d%d", &newx.x, &newx.y);
		setLeftTop(newx);	} break;

	case 2:{
		printf("x y\n");
		point newy;
		scanf("%d%d", &newy.x, &newy.y);
		setRightBottom(newy);	} break;

	case 3:{
		color newbcolor;
		printf("R G B\n");
		scanf("%d%d%d", &newbcolor.R, &newbcolor.G, &newbcolor.B);
		setBorderColor(newbcolor);	} break;

	case 4:{
		color newmcolor;
		printf("R G B\n");
		scanf("%d%d%d", &newmcolor.R, &newmcolor.G, &newmcolor.B);
		setBrushColor(newmcolor);	} break;

	case 5:{
		printf("n\n");
		int bw = NULL;
		scanf("%d", &bw);
		setBorderWidth(bw);	} break;
	}
	clear(hdc, rt);
	try { Draw(hdc, rt); }
	catch (int err) {
		if (err == 0) throw 0;
		if (err == 1) throw 1;
		if (err == 3) throw 3;
	}

}
DropdownBox::DropdownBox(const char* sName,Container* sParent,bool sManageChild)
	:Label(sName,sParent,"",false),
	 popup(0),items(0),isPopped(false),
	 foundChild(0),armedChild(0),
	 arrow(GlyphGadget::FANCY_ARROW_DOWN,GlyphGadget::IN,0.0f),
	 numItems(0),
	 selectedItem(-1)
	{
	const GLMotif::StyleSheet& ss=*getManager()->getStyleSheet();
	
	/* Dropdown box defaults to raised border: */
	setBorderType(Widget::RAISED);
	setBorderWidth(ss.buttonBorderWidth);
	
	/* Dropdown box defaults to some margin: */
	setMarginWidth(ss.buttonMarginWidth);
	
	/* Set the arrow sizes: */
	spacing=ss.buttonBorderWidth+2.0f*ss.buttonMarginWidth;
	arrow.setGlyphSize(ss.size*0.25f);
	arrow.setBevelSize(ss.size*0.25f);
	arrow.setGlyphColor(backgroundColor);
	popupExtrudeSize=ss.size*4.0f;
	
	/* Set the label insets: */
	setInsets(0.0f,arrow.getPreferredBoxSize()+spacing);
	
	/* Create a pop-up containing the item labels: */
	popup=new Popup("Popup",getManager());
	popup->setBorderWidth(ss.buttonBorderWidth);
	popup->setBorderType(Widget::PLAIN);
	popup->setBorderColor(borderColor);
	popup->setBackgroundColor(backgroundColor);
	popup->setForegroundColor(foregroundColor);
	popup->setMarginWidth(0.0f);
	
	/* Create a container for the item labels: */
	items=new RowColumn("Items",popup,false);
	items->setBorderWidth(0.0f);
	items->setOrientation(RowColumn::VERTICAL);
	items->setNumMinorWidgets(1);
	items->setMarginWidth(0.0f);
	items->setSpacing(ss.buttonBorderWidth);
	
	items->manageChild();
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #20
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 #21
0
void Unit::iniciarUnidad(PlayerType tj, PlayerColor cr, PlayerTeam eq, int maxVitalidad, int vitalidad, int maxEnergy, int energy){
    const int barWidth = 20;

//    QPainterPath path;
////    path.lineTo(10,0);
//    path.addEllipse(QRectF(-10, -10, 20, 20));
//    setShape(path);
//    includeBars = false;

    checkCounter = 0;

    setBorderWidth(2);
    setPlayerType(tj);
    setUnitColor(cr);
    setEquipo(eq);

    QRectF rectMA = MovilAgent::boundingRect();
    prepareGeometryChange();
    setMaxHealth(maxVitalidad);
    setHealth(vitalidad);
    setHealthBarPos(rectMA.topLeft() + QPointF(rectMA.width()/2 - barWidth/2, - 20));
    setHealthBarWidth(barWidth);
    setHealthBarHeight(4);
    setVisibleHealthBar(true);

    setMaxEnergy(maxEnergy);
    setEnergy(energy);
    setEnergyBarPos(rectMA.topLeft() + QPointF(rectMA.width()/2 - barWidth/2, - 10));
    setEnergyBarWidth(barWidth);
    setEnergyBarHeitght(4);
    setVisibleEnergyBar(true);

    setAcceptHoverEvents(true);

    PlayerColor pc;
    for(int i = 0; i < 8; i++){
        pc = (PlayerColor)i;
        if(pc == getUnitColor()){
            diplomacias[pc] = Alied;
        }else{
            diplomacias[pc] = Enemy;
        }
    }
    MovingActuator *actMov = dynamic_cast<MovingActuator*>(getActuator("movement"));

    connect(actMov, SIGNAL(positionChanged(QPointF)), SLOT(checkAll(QPointF)));
//    connect(actMov, SIGNAL(llegoADestinoFinal(QPointF)), SLOT(lastCheckPointReached(QPointF)));
}
	virtual bool init() {
		// Work with luminance images
		setPixelFormat(ARToolKitPlus::PIXEL_FORMAT_LUM);
		if ( ! checkPixelFormat()) {	
			if (logger)
				logger->artLog("ARToolKitPlus: Invalid Pixel Format!");
			return false;
		}

		// Memory
		if (marker_infoTWO == NULL)
			marker_infoTWO = ARToolKitPlus::artkp_Alloc<ARToolKitPlus::ARMarkerInfo2>(32);

		// Camera
		Camera *camera = new Camera(screenWidth, screenHeight);
		setCamera(camera, 1, 1000);

		// const ARFloat* mat = getProjectionMatrix();
		// printf("Proj mat\n");
		// for(int j=0; j<4; j++) {
		// 	for(int i=0; i<4; i++) {
		// 		printf ("%f, ", mat[i*4 + j]);
		// 	}
		// 	printf ("\n");
		// }

		// Work at full res
		setImageProcessingMode(ARToolKitPlus::IMAGE_FULL_RES);

		// Set border
		setBorderWidth(0.125);

		// Set threshold and activate automatic threshold
		setThreshold(160);
		activateAutoThreshold(true);
		setNumAutoThresholdRetries(2);

		// Switch to BCH ID based markers
		setMarkerMode(ARToolKitPlus::MARKER_ID_BCH);

		// Choose pose estimator
		setPoseEstimator(ARToolKitPlus::
						 //POSE_ESTIMATOR_ORIGINAL);
						 //POSE_ESTIMATOR_ORIGINAL_CONT);
						 POSE_ESTIMATOR_RPP);

		return true;
	}
NoiseTexture2D::NoiseTexture2D( unsigned int pixelSize ) 
{
    _pixelSize = pixelSize;
    _image = new osg::Image();
        
    buildImage();
    
    setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
    setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
    
    setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR );
    setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR ); 
    
    setBorderWidth( 0 );
    
    setInternalFormat( GL_LUMINANCE32F_ARB );
}
Example #24
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);
	}
Example #25
0
NewButton::NewButton(const char* sName,Container* sParent,bool sManageChild)
	:SingleChildContainer(sName,sParent,false),
	 isArmed(false)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Button defaults to raised border: */
	setBorderType(Widget::RAISED);
	setBorderWidth(ss->buttonBorderWidth);
	
	/* Set the armed background color: */
	armedBackgroundColor=ss->buttonArmedBackgroundColor;
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #26
0
int QwtSlider::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QwtAbstractSlider::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< ScalePos*>(_v) = scalePosition(); break;
        case 1: *reinterpret_cast< BackgroundStyles*>(_v) = backgroundStyle(); break;
        case 2: *reinterpret_cast< QSize*>(_v) = handleSize(); break;
        case 3: *reinterpret_cast< int*>(_v) = borderWidth(); break;
        case 4: *reinterpret_cast< int*>(_v) = spacing(); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setScalePosition(*reinterpret_cast< ScalePos*>(_v)); break;
        case 1: setBackgroundStyle(*reinterpret_cast< BackgroundStyles*>(_v)); break;
        case 2: setHandleSize(*reinterpret_cast< QSize*>(_v)); break;
        case 3: setBorderWidth(*reinterpret_cast< int*>(_v)); break;
        case 4: setSpacing(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
KstPlotGroup::KstPlotGroup(const QDomElement& e)
: KstMetaPlot(e) {
  setBorderWidth(0);
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement el = n.toElement();
    if (!el.isNull()) {
      if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
        setProperty(el.tagName().latin1(), QVariant(el.text()));
      }
    }
    n = n.nextSibling();
  }

  // always have these values
  _standardActions |= Delete | Raise | Zoom | Lower | RaiseToTop | LowerToBottom;
  _layoutActions |= Delete | Copy | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo;
  setTagName(KstObjectTag(i18n("Plot Group %1").arg(++pgcount), KstObjectTag::globalTagContext));  // FIXME: tag context?
  _type = "PlotGroup";
  _container = false; // plot group is a container that doesn't behave like one
  setBorderColor(Qt::blue);
}
Example #28
0
KstViewLegend::KstViewLegend()
: KstBorderedViewObject("Legend") {
  _fallThroughTransparency = false;
  _container = false;
  _rotation = 0;
  _vertical = true;
  _fontName = KstApp::inst()->defaultFont();
  _isResizable = false;
  setForegroundColor(KstSettings::globalSettings()->foregroundColor);
  setBorderColor(KstSettings::globalSettings()->foregroundColor);
  setBackgroundColor(KstSettings::globalSettings()->backgroundColor);
  setBorderWidth(2);
  _legendMargin = 5;
  _fontSize = -1;  
  setFontSize(0);
  _layoutActions &= ~(MoveTo | Copy | CopyTo);
  _standardActions |= Delete | Edit;
  _parsedTitle = 0L;
  _trackContents = true;
  reparseTitle();
  computeTextSize();
  setDirty(false);
}
Example #29
0
Button::Button(const char* sName,Container* sParent,const char* sLabel,bool sManageChild)
	:Label(sName,sParent,sLabel,false),
	 isArmed(false)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Button defaults to raised border: */
	setBorderType(Widget::RAISED);
	setBorderWidth(ss->buttonBorderWidth);
	
	/* Button defaults to some margin: */
	setMarginWidth(ss->buttonMarginWidth);
	
	/* Button defaults to centered text: */
	setHAlignment(GLFont::Center);
	
	/* Set the armed background color: */
	armedBackgroundColor=ss->buttonArmedBackgroundColor;
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}
Example #30
0
NewButton::NewButton(const char* sName,Container* sParent,const Vector& preferredSize,bool sManageChild)
	:SingleChildContainer(sName,sParent,false),
	 isArmed(false)
	{
	/* Get the style sheet: */
	const StyleSheet* ss=getStyleSheet();
	
	/* Button defaults to raised border: */
	setBorderType(Widget::RAISED);
	setBorderWidth(ss->buttonBorderWidth);
	
	/* Set the armed background color: */
	armedBackgroundColor=ss->buttonArmedBackgroundColor;
	
	/* Create the blind child: */
	Blind* blind=new Blind("ButtonBlind",this);
	blind->setBorderType(Widget::PLAIN);
	blind->setBorderWidth(0.0f);
	blind->setPreferredSize(preferredSize);
	
	/* Manage me: */
	if(sManageChild)
		manageChild();
	}