Esempio n. 1
0
void GuiElement::setHeight(float new_h)
{
	AVec diff(0.0f, new_h - size.y);
	size.y = new_h;
	onSizeChanged(diff);
	resolveAttachments();
}
Esempio n. 2
0
LRESULT Window::wndProc(UINT uMsg, WPARAM wParam, LPARAM lParam) 
{
	switch (uMsg) {
		case WM_CREATE: { if (onCreate()) break; return 0; }
		case WM_DESTROY: { if (onDestroy()) break; return 0; }
		case WM_CLOSE: { if (onClose()) break; return 0; }
		case WM_MOUSEMOVE: { if (onMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))) break; return 0; }
		case WM_LBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; }
		case WM_RBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; }
		case WM_MBUTTONDOWN: { if (onMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; }
		case WM_LBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0)) break; return 0; }
		case WM_RBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 1)) break; return 0; }
		case WM_MBUTTONUP: { if (onMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 2)) break; return 0; }
		case WM_PAINT: { if (onPaint()) break; return 0; }
		case WM_SIZE: { if (onSizeChanged()) break; return 0; }
		case WM_KEYDOWN: { if (onKeyDown((UINT)wParam)) break; return 0; }
		case WM_KEYUP: { if (onKeyUp((UINT)wParam)) break; return 0; }
		case WM_COMMAND: {
			if (SendMessage(reinterpret_cast<HWND>(lParam), WM_COMMAND_REFLECT, wParam, lParam))
				break;
			return 0;
		}
	}
	if (mBaseWndProc != sGlobalWndProc) {
		LRESULT r = CallWindowProc(mBaseWndProc, mHWND, uMsg, wParam, lParam);
		return r;
	} else {
		LRESULT r = DefWindowProc(mHWND, uMsg, wParam, lParam);
		return r;
	}
}
Esempio n. 3
0
void GuiElement::setSize(AVec a_size)
{
	AVec diff = a_size - size;
	size = a_size;
	onSizeChanged(diff);
	resolveAttachments();
}
Esempio n. 4
0
void UIView::setSize(float width, float height)
{
	// -- This control is about to be resized, might need to do some automatic operations on children
	processSizeChange(mRect.width, mRect.height, width, height);

	float pX = mRect.width;
	float pY = mRect.height;

	mRect.width = width;
	mRect.height = height;
	
	onResize();

	onSizeChanged();

	updateLayout();

	// Let components know a resize was made
	for(std::size_t i = 0; i < components.size(); ++i)
	{
		components[i]->onResize(this);
	}

	size.x = width;
	size.y = height;

	// lets try to notify the parent layouters 
	if (getParent() && getParent()->getLayout())
	{
		//getParent()->getLayout()->doLayout(getParent());
	}
};
Esempio n. 5
0
 void AbstractScene::setSize(const glm::vec2& newSize)
 {
     mSize = newSize;
     FOR_EACH_COMPONENT(onBeforeSizeChanged(this, mSize));
     onSizeChanged(mSize);
     FOR_EACH_COMPONENT_REVERSE(onAfterSizeChanged(this, mSize))
 }
Esempio n. 6
0
OfferStorageDialog::OfferStorageDialog(IncClient* client, QString clusterName, QObject* parent) : QObject(parent)
{
    dialog = new QDialog();
    ui = new Ui::CreateClusterDialog();
    ui->setupUi(dialog);

    this->client = client;
    this->clusterName = clusterName;

    dialog->setWindowTitle(QString("Offer storage to: %1").arg(clusterName));
    ui->clusterNameLineEdit->setText(clusterName);
    ui->clusterNameLineEdit->setEnabled(false);

    //Set some default values:
    ui->locationLineEdit->setText(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
    double size = 11111111111;
    ui->sizeLineEdit->setText("11111111111");
    ui->sizeIndicatorLabel->setText(FileSizeUtils::getAppropriateFileSizeFor(size));

    connect(ui->saveButton, SIGNAL(clicked()),this, SLOT(onOfferClicked()));
    connect(ui->browseButton, SIGNAL(clicked()),this, SLOT(onBrowseClicked()));
    connect(ui->cancelButton, SIGNAL(clicked()),this, SLOT(onCancelClicked()));
    connect(ui->sizeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onSizeChanged(QString)));
    dialog->exec();
}
Esempio n. 7
0
void Widget::copyProperties(Widget *widget)
{
    setEnabled(widget->isEnabled());
    setVisible(widget->isVisible());
    setBright(widget->isBright());
    setTouchEnabled(widget->isTouchEnabled());
    _touchPassedEnabled = false;
    setLocalZOrder(widget->getLocalZOrder());
    setTag(widget->getTag());
    setName(widget->getName());
    setActionTag(widget->getActionTag());
    _ignoreSize = widget->_ignoreSize;
    _size = widget->_size;
    _customSize = widget->_customSize;
    copySpecialProperties(widget);
    _sizeType = widget->getSizeType();
    _sizePercent = widget->_sizePercent;
    _positionType = widget->_positionType;
    _positionPercent = widget->_positionPercent;
    setPosition(widget->getPosition());
    setAnchorPoint(widget->getAnchorPoint());
    setScaleX(widget->getScaleX());
    setScaleY(widget->getScaleY());
    setRotation(widget->getRotation());
    setRotationX(widget->getRotationX());
    setRotationY(widget->getRotationY());
    setFlipX(widget->isFlipX());
    setFlipY(widget->isFlipY());
    setColor(widget->getColor());
    setOpacity(widget->getOpacity());
    setCascadeOpacityEnabled(widget->isCascadeOpacityEnabled());
    setCascadeColorEnabled(widget->isCascadeColorEnabled());
    onSizeChanged();
}
Esempio n. 8
0
void View::onSetSize(const glm::vec3 &v) {
	if (mSize == v) return;
	mSize = v;
	mTransformDirty = true;
//	if (mHooks) mHooks->onSizeChanged(mSize);
	onSizeChanged(v);
}
Esempio n. 9
0
void Widget::setSizePercent(const Point &percent)
{
    _sizePercent = percent;
    Size cSize = _customSize;
    if (_running)
    {
        Widget* widgetParent = getWidgetParent();
        if (widgetParent)
        {
            cSize = Size(widgetParent->getSize().width * percent.x , widgetParent->getSize().height * percent.y);
        }
        else
        {
            cSize = Size(_parent->getContentSize().width * percent.x , _parent->getContentSize().height * percent.y);
        }
    }
    if (_ignoreSize)
    {
        _size = getContentSize();
    }
    else
    {
        _size = cSize;
    }
    _customSize = cSize;
    onSizeChanged();
}
Esempio n. 10
0
void UIWidget::setSize(const cocos2d::Size &size)
{
    m_tCustomSize = size;
    if (m_bIgnoreSize)
    {
        m_tSize = getContentSize();
    }
    else
    {
        m_tSize = size;
    }
    if (m_bIsRunning && m_pWidgetParent)
    {
        cocos2d::Size pSize = m_pWidgetParent->getSize();
        float spx = 0.0f;
        float spy = 0.0f;
        if (pSize.width > 0.0f)
        {
            spx = m_tCustomSize.width / pSize.width;
        }
        if (pSize.height > 0.0f)
        {
            spy = m_tCustomSize.height / pSize.height;
        }
        m_tSizePercent = cocos2d::Point(spx, spy);
    }
    
    onSizeChanged();
}
Esempio n. 11
0
void UIWidget::copyProperties(UIWidget *widget)
{
    setEnabled(widget->isEnabled());
    setVisible(widget->isVisible());
    setBright(widget->isBright());
    setTouchEnabled(widget->isTouchEnabled());
    m_bTouchPassedEnabled = false;
    setZOrder(widget->getZOrder());
    setUpdateEnabled(widget->isUpdateEnabled());
    setTag(widget->getTag());
    setName(widget->getName());
    setActionTag(widget->getActionTag());
    m_bIgnoreSize = widget->m_bIgnoreSize;
    m_tSize = widget->m_tSize;
    m_tCustomSize = widget->m_tCustomSize;
    copySpecialProperties(widget);
    m_eSizeType = widget->getSizeType();
    m_tSizePercent = widget->m_tSizePercent;
    m_ePositionType = widget->m_ePositionType;
    m_tPositionPercent = widget->m_tPositionPercent;
    setPosition(widget->getPosition());
    setAnchorPoint(widget->getAnchorPoint());
    setScaleX(widget->getScaleX());
    setScaleY(widget->getScaleY());
    setRotation(widget->getRotation());
    setRotationX(widget->getRotationX());
    setRotationY(widget->getRotationY());
    setFlipX(widget->isFlipX());
    setFlipY(widget->isFlipY());
    setColor(widget->getColor());
    setOpacity(widget->getOpacity());
    setCascadeOpacityEnabled(widget->isCascadeOpacityEnabled());
    setCascadeColorEnabled(widget->isCascadeColorEnabled());
    onSizeChanged();
}
Esempio n. 12
0
void GuiElement::setWidth(float new_w)
{
	AVec diff(new_w - size.x, 0.0f);
	size.x = new_w;
	onSizeChanged(diff);
	resolveAttachments();
}
Esempio n. 13
0
void Widget::setSizePercent(const Vec2 &percent)
{
    _sizePercent = percent;
    Size cSize = _customSize;
    if (_running)
    {
        Widget* widgetParent = getWidgetParent();
        if (widgetParent)
        {
            cSize = Size(widgetParent->getContentSize().width * percent.x , widgetParent->getContentSize().height * percent.y);
        }
        else
        {
            cSize = Size(_parent->getContentSize().width * percent.x , _parent->getContentSize().height * percent.y);
        }
    }
    if (_ignoreSize)
    {
        this->setContentSize(getVirtualRendererSize());
    }
    else
    {
        this->setContentSize(cSize);
    }
    _customSize = cSize;
    onSizeChanged();
}
Esempio n. 14
0
AudioDisplay::AudioDisplay(ParentElement *parent_, APoint a_pos, AVec a_size, bool draw_statuses)
	: CompoundControl(parent_, a_pos, a_size, true, false),
		drawStatuses(draw_statuses)
{
	setAllBackgroundColors(Color(0.5f, 0.5f, 0.5f, 1.0f));
	
	onSizeChanged(AVec());
}
Esempio n. 15
0
MidiDisplay::MidiDisplay(ParentElement *parent_, APoint a_pos, AVec a_size)
	: CompoundControl(parent_, a_pos, a_size, true, false)//,
		//midiData(midi_data)
{
	setAllBackgroundColors(Color(0.5f, 0.5f, 0.6f, 1.0f));
	
	onSizeChanged(AVec());
}
Esempio n. 16
0
void AudioDisplay::setData(const std::vector<DataChunk*> *audio_data, bool flip_chunks, bool flip_chunk_samples)
{
	audioData = (const std::vector<DataChunk*>*)audio_data;

	flipChunks = flip_chunks;
	flipChunkSamples = flip_chunk_samples;

	onSizeChanged(AVec());
}
Esempio n. 17
0
GraphDisplay::GraphDisplay(GPoint data_min, GPoint data_max, RVec absolute_to_graph, GVec standard_unit_size, GraphProps g_props)
	: Display(),
		minData(data_min), maxData(data_max),
		absoluteToGraphUnits(absolute_to_graph), graphToAbsoluteUnits(1.0f/absolute_to_graph.x, 1.0f/absolute_to_graph.y),
		gProps(g_props), fixedWidth(g_props & GraphProps::FIXED_WIDTH), fixedHeight(g_props & GraphProps::FIXED_HEIGHT),
		flipX(g_props & GraphProps::FLIP_X), flipY(g_props & GraphProps::FLIP_Y),
		standardUnitSize(standard_unit_size)
{
	setBgColor(Color(0.75f, 0.75f, 0.75f, 1.0f));
	onSizeChanged(AVec());
}
Esempio n. 18
0
void GuiElement::setRect(const Rect &new_rect)
{
	AVec	p_diff = new_rect.pos - pos,
			s_diff = new_rect.size - size;

	pos = new_rect.pos;
	size = new_rect.size;

	onPosChanged(p_diff);
	onSizeChanged(s_diff);
	resolveAttachments();
}
Esempio n. 19
0
void Widget::updateContentSizeWithTextureSize(const cocos2d::Size &size)
{
    if (_ignoreSize)
    {
        _size = size;
    }
    else
    {
        _size = _customSize;
    }
    onSizeChanged();
}
Esempio n. 20
0
void Widget::updateContentSizeWithTextureSize(const cocos2d::Size &size)
{
    if (_ignoreSize)
    {
        this->setContentSize(size);
    }
    else
    {
        this->setContentSize(_customSize);
    }
    onSizeChanged();
}
Esempio n. 21
0
void
AnimatedSplitter::addWidget( AnimatedWidget* widget )
{
    QSplitter::addWidget( widget );

    connect( widget, SIGNAL( showWidget() ), SLOT( onShowRequest() ) );
    connect( widget, SIGNAL( hideWidget() ), SLOT( onHideRequest() ) );
    connect( widget, SIGNAL( sizeHintChanged( QSize ) ), SLOT( onShowRequest() ) );
    connect( widget, SIGNAL( sizeChanged( QSize ) ), SLOT( onSizeChanged( QSize ) ) );

    connect( this, SIGNAL( shown( QWidget*, bool ) ), widget, SLOT( onShown( QWidget*, bool ) ) );
    connect( this, SIGNAL( hidden( QWidget*, bool ) ), widget, SLOT( onHidden( QWidget*, bool ) ) );
}
Esempio n. 22
0
void UIWidget::setSize(const CCSize &size)
{
    if (m_bIgnoreSize)
    {
        m_size = getContentSize();
    }
    else
    {
        m_size = size;
    }
    m_customSize = size;
    onSizeChanged();
}
Esempio n. 23
0
void Widget::ignoreContentAdaptWithSize(bool ignore)
{
    _ignoreSize = ignore;
    if (_ignoreSize)
    {
        Size s = getContentSize();
        _size = s;
    }
    else
    {
        _size = _customSize;
    }
    onSizeChanged();
}
Esempio n. 24
0
void UIWidget::ignoreContentAdaptWithSize(bool ignore)
{
    m_bIgnoreSize = ignore;
    if (m_bIgnoreSize)
    {
        CCSize s = getContentSize();
        m_size = s;
    }
    else
    {
        m_size = m_customSize;
    }
    onSizeChanged();
}
Esempio n. 25
0
void UIWidget::updateSizeAndPosition()
{
    switch (m_eSizeType)
    {
        case SIZE_ABSOLUTE:
            if (m_bIgnoreSize)
            {
                m_size = getContentSize();
            }
            else
            {
                m_size = m_customSize;
            }
            m_sizePercent = (m_pWidgetParent == NULL) ? CCPointZero : ccp(m_customSize.width / m_pWidgetParent->getSize().width, m_customSize.height / m_pWidgetParent->getSize().height);
            break;
        case SIZE_PERCENT:
        {
            CCSize cSize = (m_pWidgetParent == NULL) ? CCSizeZero : CCSizeMake(m_pWidgetParent->getSize().width * m_sizePercent.x , m_pWidgetParent->getSize().height * m_sizePercent.y);
            if (m_bIgnoreSize)
            {
                m_size = getContentSize();
            }
            else
            {
                m_size = cSize;
            }
            m_customSize = cSize;
        }
            break;
        default:
            break;
    }
    onSizeChanged();
    CCPoint absPos = getPosition();
    switch (m_ePositionType)
    {
        case POSITION_ABSOLUTE:
            m_positionPercent = (m_pWidgetParent == NULL) ? CCPointZero : ccp(absPos.x / m_pWidgetParent->getSize().width, absPos.y / m_pWidgetParent->getSize().height);
            break;
        case POSITION_PERCENT:
        {
            CCSize parentSize = m_pWidgetParent->getSize();
            absPos = ccp(parentSize.width * m_positionPercent.x, parentSize.height * m_positionPercent.y);
        }
            break;
        default:
            break;
    }
    m_pRenderer->setPosition(absPos);
}
Esempio n. 26
0
void GraphDisplay::setGraph(GPoint data_min, GPoint data_max, RVec absolute_to_graph, GVec standard_unit_size, GraphProps g_props)
{
	minData = data_min;
	maxData = data_max;
	absoluteToGraphUnits = absolute_to_graph;
	graphToAbsoluteUnits = RVec(1.0f/absoluteToGraphUnits.x, 1.0f/absoluteToGraphUnits.y);
	gProps = g_props;
	fixedWidth = gProps & GraphProps::FIXED_WIDTH;
	fixedHeight = gProps & GraphProps::FIXED_HEIGHT;
	flipX = gProps & GraphProps::FLIP_X;
	flipY = gProps & GraphProps::FLIP_Y;
	standardUnitSize = standard_unit_size;
	
	onSizeChanged(AVec());
}
Esempio n. 27
0
void UIWidget::setSize(const CCSize &size)
{
    m_customSize = size;
    if (m_bIgnoreSize)
    {
        m_size = getContentSize();
    }
    else
    {
        m_size = size;
    }
    if (m_bIsRunning)
    {
        m_sizePercent = (m_pWidgetParent == NULL) ? CCPointZero : ccp(m_customSize.width / m_pWidgetParent->getSize().width, m_customSize.height / m_pWidgetParent->getSize().height);   
    }
    onSizeChanged();
}
Esempio n. 28
0
void Widget::ignoreContentAdaptWithSize(bool ignore)
{
    if (_ignoreSize == ignore)
    {
        return;
    }
    _ignoreSize = ignore;
    if (_ignoreSize)
    {
        Size s = getVirtualRendererSize();
        _size = s;
    }
    else
    {
        _size = _customSize;
    }
    onSizeChanged();
}
Esempio n. 29
0
void Widget::ignoreContentAdaptWithSize(bool ignore)
{
    if (_ignoreSize == ignore)
    {
        return;
    }
    _ignoreSize = ignore;
    if (_ignoreSize)
    {
        Size s = getVirtualRendererSize();
        this->setContentSize(s);
    }
    else
    {
        this->setContentSize(_customSize);
    }
    onSizeChanged();
}
Esempio n. 30
0
void Widget::copyProperties(Widget *widget)
{
    setEnabled(widget->isEnabled());
    setVisible(widget->isVisible());
    setBright(widget->isBright());
    setTouchEnabled(widget->isTouchEnabled());
    setLocalZOrder(widget->getLocalZOrder());
    setTag(widget->getTag());
    setName(widget->getName());
    setActionTag(widget->getActionTag());
    _ignoreSize = widget->_ignoreSize;
    _size = widget->_size;
    _customSize = widget->_customSize;
    _sizeType = widget->getSizeType();
    _sizePercent = widget->_sizePercent;
    _positionType = widget->_positionType;
    _positionPercent = widget->_positionPercent;
    setPosition(widget->getPosition());
    setAnchorPoint(widget->getAnchorPoint());
    setScaleX(widget->getScaleX());
    setScaleY(widget->getScaleY());
    setRotation(widget->getRotation());
    setRotationSkewX(widget->getRotationSkewX());
    setRotationSkewY(widget->getRotationSkewY());
    setFlippedX(widget->isFlippedX());
    setFlippedY(widget->isFlippedY());
    setColor(widget->getColor());
    setOpacity(widget->getOpacity());
    _touchEventCallback = widget->_touchEventCallback;
    _touchEventListener = widget->_touchEventListener;
    _touchEventSelector = widget->_touchEventSelector;
    _focused = widget->_focused;
    _focusEnabled = widget->_focusEnabled;
    
    copySpecialProperties(widget);

    //FIXME:copy focus properties, also make sure all the subclass the copy behavior is correct
    Map<int, LayoutParameter*>& layoutParameterDic = widget->_layoutParameterDictionary;
    for (auto iter = layoutParameterDic.begin(); iter != layoutParameterDic.end(); ++iter)
    {
        setLayoutParameter(iter->second->clone());
    }
    onSizeChanged();
}