Beispiel #1
0
Event<eq::PointerEvent>::Event(const QEvent* from)
    : type(_getType(from))
{
#ifndef QT_NO_WHEELEVENT
    if (type == EVENT_WINDOW_POINTER_WHEEL)
    {
        const QWheelEvent* qevent = static_cast<const QWheelEvent*>(from);
        PointerEvent event;
        switch (qevent->orientation())
        {
        case Qt::Horizontal:
            event.xAxis = qevent->delta() > 0 ? 1 : -1;
            break;
        case Qt::Vertical:
            event.yAxis = qevent->delta() > 0 ? 1 : -1;
            break;
        }
        event.buttons = _getButtons(qevent->buttons());
        event.button = PTR_BUTTON_NONE;
    }
    else
#endif
    {
        const QMouseEvent* qevent = static_cast<const QMouseEvent*>(from);
        event.x = qevent->x();
        event.y = qevent->y();
        event.buttons = _getButtons(qevent->buttons());
        event.button = _getButton(qevent->button());
    }
}
Beispiel #2
0
Event<eq::SizeEvent>::Event(const QEvent* from)
    : type(_getType(from))
{
    const QResizeEvent* qevent = static_cast<const QResizeEvent*>(from);
    event.w = qevent->size().width();
    event.h = qevent->size().height();
}
Beispiel #3
0
/*
 * call-seq:
 *   inspect -> String
 * 
 * Human-readable description. 
 * ===Return value
 * String
*/
VALUE _inspect(VALUE self)
{
	if(wrap< RubyWindowHolder* >(self)->window==NULL){
		VALUE array[2];
		array[0]=rb_str_new2("#<%s:(destroyed)>");
		array[1]=rb_class_of(self);
		return rb_f_sprintf(2,array);
	}else{
		if(rb_const_defined(rb_class_of(self),rb_intern("WidgetTypeName")))
			if(_self->getType() == wrap<CEGUI::String>(rb_const_get(rb_class_of(self),rb_intern("WidgetTypeName"))))
			{
				VALUE array[3];
				array[0]=rb_str_new2("#<%s:%s>");
				array[1]=rb_class_of(self);
				array[2]=rb_funcall(self,rb_intern("name"),0);
				return rb_f_sprintf(3,array);
			}
		VALUE array[4];
		array[0]=rb_str_new2("#<%s(%s):%s>");
		array[1]=rb_class_of(self);
		array[2]=_getType(self);
		array[3]=rb_funcall(self,rb_intern("name"),0);
		return rb_f_sprintf(4,array);
	}
}
Beispiel #4
0
bool StyleData::parse(const Value& v, unsigned long projectId)
{
    std::string typeStr = getJSONString(v, "type");
    type = _getType(typeStr);
    
    zoom_level_min = atoi(getJSONString(v, "zoom_level_min", "2").c_str());
    zoom_level_max = atoi(getJSONString(v, "zoom_level_max", "20").c_str());
    icon = getJSONString(v, "icon-mobile", "point");
    transform = getJSONString(v, "transform", "");
    transormValid = _parseTransform(transform);
    
    dasharray = getJSONString(v, "dasharray", "");
    if(dasharray.empty())
        dasharray = getJSONString(v, "outline-dasharray", "");
    
    color = _parseColor( getJSONString(v, "color"), colorValid );
    color.v[3] = atof(getJSONString(v, "opacity", "1.0").c_str());
    size = atof(getJSONString(v, "size", "0").c_str());
    outline_color = _parseColor( getJSONString(v, "outline-color"), outlineColorValid );
    outline_color.v[3] = atof(getJSONString(v, "outline-opacity", "1.0").c_str());
    outline_size = atof(getJSONString(v, "outline-size", "0").c_str());
    filter = getJSONString(v, "filter");
    filter_hash = getJSONString(v, "filter_hash");

    // Font style
    field_name = getJSONString(v, "field-name");
    font_name = getJSONString(v, "font-name");
    font_filename = getJSONString(v, "font-filename");
    font_size = atof(getJSONString(v, "font-size", "0").c_str());
    font_opacity = atof(getJSONString(v, "font-opacity", "1").c_str());

    font_color = _parseColor( getJSONString(v, "font-color"), fontColorValid);
    font_halo_color = _parseColor( getJSONString(v, "font-halo-color"), fontHaloColorValid);
    font_halo_size = atof(getJSONString(v, "font-halo-size", "0").c_str());
    offset_x = atof(getJSONString(v, "offset-x", "0").c_str());
    offset_y = atof(getJSONString(v, "offset-y", "0").c_str());
    mode = getJSONString(v, "mode");
    modeType = _getType(mode);
    allow_overlap = getJSONBool(v, "allow-overlap", false);

    if(type==ICON)
    {
        fullIconPath = SupportFiles::getFullPath(projectId) + icon;
    }
    return true;
}
Beispiel #5
0
void GUIElementBase::setAnchorParent(GUIPanel* anchorParent)
{
    mAnchorParent = anchorParent;

    if (_getType() == Type::Panel)
        return;

    for (auto& child : mChildren)
        child->setAnchorParent(anchorParent);
}
Beispiel #6
0
Event<eq::KeyEvent>::Event(const QEvent* from)
    : type(_getType(from))
{
    const QKeyEvent* qevent = static_cast<const QKeyEvent*>(from);
    event.key = _getKey(*qevent);
}
Beispiel #7
0
Event<eq::Event>::Event(const QEvent* from)
    : type(_getType(from))
{
}