Exemplo n.º 1
0
QedStatusBar::QedStatusBar()
{
    QFont *font = QedApp::globalFont();

    setFont(*font);
    setFixedHeight(buttonSize());
    setSizeGripEnabled(false);

    my.timeButton = new QedTimeButton(this);
    my.timeButton->setFixedSize(QSize(buttonSize(), buttonSize()));
    my.timeButton->setWhatsThis(QApplication::translate("PmChart",
	"VCR state button, also used to display the time control window.",
	0, QApplication::UnicodeUTF8));
    my.timeFrame = new QToolButton(this);
    my.timeFrame->setMinimumSize(QSize(buttonSize(), buttonSize()));
    my.timeFrame->setSizePolicy(
			QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    my.timeFrame->setWhatsThis(QApplication::translate("PmChart",
	"Unified time axis, displaying the current time position at the "
	"rightmost point, and either status information or the timeframe "
	"covering all Visible Points to the left",
	0, QApplication::UnicodeUTF8));

    delete layout();
    QHBoxLayout *box = new QHBoxLayout;
    box->setMargin(0);
    box->setSpacing(1);
    box->addWidget(my.timeButton);
    box->addWidget(my.timeFrame);
    setLayout(box);

    my.gadgetLabel = new QLabel(my.timeFrame);
    my.gadgetLabel->setFont(*font);
    my.gadgetLabel->hide();	// shown with gadget Views

    my.dateLabel = new QLabel(my.timeFrame);
    my.dateLabel->setIndent(8);
    my.dateLabel->setFont(*font);
    my.dateLabel->setAlignment(Qt::AlignRight | Qt::AlignBottom);

    my.labelSpacer = new QSpacerItem(10, 0,
				QSizePolicy::Fixed, QSizePolicy::Minimum);
    my.rightSpacer = new QSpacerItem(0, 0,
				QSizePolicy::Fixed, QSizePolicy::Minimum);

    my.valueLabel = new QLabel(my.timeFrame);
    my.valueLabel->setIndent(8);
    my.valueLabel->setFont(*font);
    my.valueLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);

    my.grid = new QGridLayout;	// Grid of [5 x 3] cells
    my.grid->setMargin(0);
    my.grid->setSpacing(0);
    my.grid->addWidget(my.gadgetLabel, 0, 0, 1, 3);
    my.grid->addWidget(my.dateLabel, 2, 2, 1, 1);  // bottom row, last two cols
    my.grid->addItem(my.labelSpacer, 2, 1, 1, 1);  // bottom row, second column
    my.grid->addWidget(my.valueLabel, 2, 0, 1, 1); // bottom row, first column.
    my.grid->addItem(my.rightSpacer, 0, 4, 2, 1);  // all rows, in final column
    my.timeFrame->setLayout(my.grid);
}
Exemplo n.º 2
0
void StatusBar::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    QStyleOption opt(0);

    opt.rect.setRect(buttonSize()+2, 0, width()-buttonSize()-2, buttonSize());
    opt.palette = palette();
    opt.state = QStyle::State_None;
    style()->drawPrimitive(QStyle::PE_PanelButtonTool, &opt, &p, my.timeFrame);
}
Exemplo n.º 3
0
StatusBar::StatusBar()
{
    setFixedHeight(buttonSize());
    setSizeGripEnabled(false);

    my.timeButton = new QedTimeButton(this);
    my.timeButton->setFixedSize(QSize(buttonSize(), buttonSize()));
    my.timeButton->setWhatsThis(
	"VCR state button, also used to display the time control window.");
    my.timeFrame = new QToolButton(this);
    my.timeFrame->setMinimumSize(QSize(buttonSize(), buttonSize()));
    my.timeFrame->setSizePolicy(
			QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    my.timeFrame->setWhatsThis(
	"Unified time axis, displaying the current time position at the "
	"rightmost point, and either status information or the timeframe "
	"covering all Visible Points to the left");

    // Add the time button and the time frame to the status bar.
    addWidget(my.timeButton);
    addWidget(my.timeFrame, 1);
    clearSpacing(layout());

    my.timeAxis = new TimeAxis(my.timeFrame);
    my.timeAxis->setFixedHeight(timeAxisHeight());
    my.gadgetLabel = new QLabel(my.timeFrame);
    my.gadgetLabel->hide();	// shown with gadget Tabs

    my.dateLabel = new QLabel(my.timeFrame);
    my.dateLabel->setIndent(8);
    my.dateLabel->setAlignment(Qt::AlignRight | Qt::AlignBottom);

    my.labelSpacer = new QSpacerItem(10, 0,
				QSizePolicy::Fixed, QSizePolicy::Minimum);
    my.rightSpacer = new QSpacerItem(0, 0,
				QSizePolicy::Fixed, QSizePolicy::Minimum);

    my.valueLabel = new QLabel(my.timeFrame);
    my.valueLabel->setIndent(8);
    my.valueLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);

    my.grid = new QGridLayout;	// Grid of [5 x 3] cells
    my.grid->setMargin(0);
    my.grid->setSpacing(0);
    my.grid->addWidget(my.gadgetLabel, 0, 0, 1, 3);
    my.grid->addWidget(my.timeAxis, 0, 0, 1, 3);   // top two rows, all columns
    my.grid->addWidget(my.dateLabel, 2, 2, 1, 1);  // bottom row, last two cols
    my.grid->addItem(my.labelSpacer, 2, 1, 1, 1);  // bottom row, second column
    my.grid->addWidget(my.valueLabel, 2, 0, 1, 1); // bottom row, first column.
    my.grid->addItem(my.rightSpacer, 0, 4, 2, 1);  // all rows, in final column
    my.timeFrame->setLayout(my.grid);

    resetFont();
}
    //________________________________________________________
    bool Configuration::operator == (const Configuration& other ) const
    {

        return
            titleAlignment() == other.titleAlignment() &&
            centerTitleOnFullWidth() == other.centerTitleOnFullWidth() &&
            buttonSize() == other.buttonSize() &&
            frameBorder() == other.frameBorder() &&
            blendColor() == other.blendColor() &&
            sizeGripMode() == other.sizeGripMode() &&
            backgroundOpacity() == other.backgroundOpacity()&&
            separatorMode() == other.separatorMode() &&
            drawTitleOutline() == other.drawTitleOutline() &&
            hideTitleBar() == other.hideTitleBar() &&
            useDropShadows() == other.useDropShadows() &&
            useOxygenShadows() == other.useOxygenShadows() &&
            closeFromMenuButton() == other.closeFromMenuButton() &&
            transparencyEnabled() == other.transparencyEnabled() &&
            useNarrowButtonSpacing() == other.useNarrowButtonSpacing() &&
            useExtendedWindowBorder() == other.useExtendedWindowBorder() &&
            opacityFromStyle() == other.opacityFromStyle() &&
            backgroundOpacity() == other.backgroundOpacity() &&
            animationsEnabled() == other.animationsEnabled() &&
            buttonAnimationsEnabled() == other.buttonAnimationsEnabled() &&
            titleAnimationsEnabled() == other.titleAnimationsEnabled() &&
            shadowAnimationsEnabled() == other.shadowAnimationsEnabled() &&
            tabAnimationsEnabled() == other.tabAnimationsEnabled() &&
            buttonAnimationsDuration() == other.buttonAnimationsDuration() &&
            titleAnimationsDuration() == other.titleAnimationsDuration() &&
            shadowAnimationsDuration() == other.shadowAnimationsDuration() &&
            tabAnimationsDuration() == other.tabAnimationsDuration();

    }
Exemplo n.º 5
0
void MainWindow::setupFindToolBar()
{
  m_findToolBar->setObjectName("FindToolBar");
  m_findToolBar->setVisible(false);

  QLabel* findLabel = new QLabel("Find Text: ");
  m_findLineEdit = new QLineEdit();
  m_findLineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
  m_findLineEdit->setFocusPolicy(Qt::ClickFocus);
  connect(m_findLineEdit, SIGNAL(textChanged(const QString&)),
          this, SLOT(setFindText(const QString&)));

  //add a spacer
  QWidget* spacer = new QWidget();
  spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

  //set the size of the buttons and the icon based on the height of the line edit
  QSize buttonSize(m_findLineEdit->sizeHint().height()-4, m_findLineEdit->sizeHint().height()-4);
  QSize iconSize(m_findLineEdit->sizeHint().height()-8, m_findLineEdit->sizeHint().height()-8);

  QPushButton* closeButton = new QPushButton(QIcon(QString("icons/stop.png")), "");
  closeButton->setToolTip("Close the find toolbar");
  closeButton->setFlat(true);
  closeButton->setFixedSize(buttonSize);
  closeButton->setIconSize(iconSize);
  closeButton->setFocusPolicy(Qt::ClickFocus);
  connect(closeButton, SIGNAL(released()), this, SLOT(closeFindToolBar()));

  m_findToolBar->addWidget(findLabel);
  m_findToolBar->addWidget(m_findLineEdit);
  m_findToolBar->addWidget(spacer);
  m_findToolBar->addWidget(closeButton);
}
Exemplo n.º 6
0
AddVCButtonMatrix::~AddVCButtonMatrix()
{
    QSettings settings;
    settings.setValue(HORIZONTAL_COUNT, horizontalCount());
    settings.setValue(VERTICAL_COUNT, verticalCount());
    settings.setValue(BUTTON_SIZE, buttonSize());
}
Exemplo n.º 7
0
void Pager::requestResize(Widget* child,const Vector& newExteriorSize)
	{
	/* Just grant the request if nothing really changed: */
	if(!isManaged)
		{
		/* Just resize the child: */
		child->resize(Box(child->getExterior().origin,newExteriorSize));
		}
	else if(newExteriorSize[0]==child->getExterior().size[0]&&newExteriorSize[1]==child->getExterior().size[1])
		{
		/* Resize the child in its previous box: */
		child->resize(child->getExterior());
		
		/* Invalidate the visual representation: */
		update();
		}
	else
		{
		/* Calculate the new natural grid size: */
		
		/* Calculate the size of the page button box: */
		Vector buttonSize(0.0f,0.0f,0.0f);
		for(ButtonList::const_iterator pbIt=pageButtons.begin();pbIt!=pageButtons.end();++pbIt)
			{
			/* Get the button's size: */
			Vector s=*pbIt!=child?(*pbIt)->calcNaturalSize():newExteriorSize;
			
			/* Increment the box width: */
			buttonSize[0]+=s[0];
			
			/* Adjust the box height: */
			if(buttonSize[1]<s[1])
				buttonSize[1]=s[1];
			}
		
		/* Calculate the size of the child widget area: */
		Vector childSize(0.0f,0.0f,0.0f);
		for(WidgetList::const_iterator cIt=children.begin();cIt!=children.end();++cIt)
			{
			/* Get the child's size: */
			Vector s=*cIt!=child?(*cIt)->calcNaturalSize():newExteriorSize;
			
			/* Adjust the box width and height: */
			for(int i=0;i<2;++i)
				if(childSize[i]<s[i])
					childSize[i]=s[i];
			}
		
		/* Calcuate the new overall size: */
		Vector newSize=childSize;
		newSize[0]+=2.0f*marginWidth;
		newSize[1]+=2.0f*marginWidth;
		if(newSize[0]<buttonSize[0])
			newSize[0]=buttonSize[0];
		newSize[1]+=buttonSize[1];
		
		/* Try to resize the widget: */
		parent->requestResize(this,calcExteriorSize(newSize));
		}
	}
IntRect ScrollbarThemeGtk::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool)
{
#ifndef GTK_API_VERSION_2
    if (part == ForwardButtonStartPart && !m_hasForwardButtonStartPart)
        return IntRect();
    if (part == ForwardButtonEndPart && !m_hasForwardButtonEndPart)
        return IntRect();

    IntSize size = buttonSize(scrollbar);
    if (scrollbar->orientation() == HorizontalScrollbar) {
        int y = scrollbar->y() + m_troughBorderWidth;
        if (part == ForwardButtonEndPart)
            return IntRect(scrollbar->x() + scrollbar->width() - size.width() - m_troughBorderWidth, y, size.width(), size.height());

        // ForwardButtonStartPart (alternate button)
        return IntRect(scrollbar->x() + m_troughBorderWidth + size.width(), y, size.width(), size.height());
    }

    // VerticalScrollbar
    int x = scrollbar->x() + m_troughBorderWidth;
    if (part == ForwardButtonEndPart)
        return IntRect(x, scrollbar->y() + scrollbar->height() - size.height() - m_troughBorderWidth, size.width(), size.height());

    // ForwardButtonStartPart (alternate button)
    return IntRect(x, scrollbar->y() + m_troughBorderWidth + size.height(), size.width(), size.height());
#else
    UNUSED_PARAM(scrollbar);
    UNUSED_PARAM(part);
    return IntRect();
#endif
}
IntRect ScrollbarThemeChromium::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
    // Windows and Linux just have single arrows.
    if (part == BackButtonEndPart)
        return IntRect();

    IntSize size = buttonSize(scrollbar);
    return IntRect(scrollbar->x(), scrollbar->y(), size.width(), size.height());
}
Exemplo n.º 10
0
IntRect ScrollbarThemeAura::backButtonRect(
    const ScrollbarThemeClient& scrollbar,
    ScrollbarPart part,
    bool) {
  // Windows and Linux just have single arrows.
  if (part == BackButtonEndPart)
    return IntRect();

  IntSize size = buttonSize(scrollbar);
  return IntRect(scrollbar.x(), scrollbar.y(), size.width(), size.height());
}
Exemplo n.º 11
0
/////////////////////////////////////////////////////////////////////////////
// CMainToolBarCtrl message handlers
void CMainToolBarCtrl::Init()
{
	COLORREF crMask = RGB(255, 255, 255);
	
	CSize bitmapSize(32, 32);
	SetBitmapSize(bitmapSize);
	
	CSize buttonSize(40, 40);
	SetButtonSize(buttonSize);

	
	m_normalIL.Create(32, 32, ILC_COLOR24|ILC_MASK, 6, 1);
	UINT nBtnID[] = {IDB_TB_ADD, IDB_TB_START, IDB_TB_CLEAR, IDB_TB_EXPORT, IDB_TB_OPTION, IDB_TB_EXIT};
	COLORREF nCrMask[] = {RGB(255, 255, 255), RGB(255, 0, 255), RGB(255, 0, 255), RGB(255, 255, 255), 
		RGB(255, 255, 255), RGB(255, 255, 255)};
	int i;
	for(i = 0; i < (sizeof(nBtnID)/sizeof(nBtnID[0])); i++)
	{
		CBitmap bm;
		bm.LoadBitmap(nBtnID[i]);
		m_normalIL.Add(&bm, nCrMask[i]);
	}
	SetImageList(&m_normalIL);
	
	int nFirstButtonID = IDC_MAIN_TOOLBAR_BUTTON_FIRST;
	int m_nButtonCount = IDC_MAIN_TOOLBAR_BUTTON_LAST - nFirstButtonID + 1;
	
	int nBitmapIndex[] = {0, 1, 2, 3, 4, 5};
	TBBUTTON tb;
	for (int nIndex = 0; nIndex < m_nButtonCount; nIndex++)
	{
		CString string;
		string.LoadString(nIndex + nFirstButtonID);
		
		// Add second '\0'
		int nStringLength = string.GetLength() + 1;
		TCHAR * pString = string.GetBufferSetLength(nStringLength);
		pString[nStringLength] = 0;
		
		VERIFY((tb.iString = AddStrings(pString)) != -1);
		
		string.ReleaseBuffer();
		
		tb.fsState = TBSTATE_ENABLED;
		tb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE;
		tb.dwData = 0;
		tb.iBitmap = nBitmapIndex[nIndex];
		tb.idCommand = nIndex + nFirstButtonID;
		
		AddButtons(1, &tb);
	}
}
Exemplo n.º 12
0
void ScrollBar::setSize(const sf::Vector2f& size)
{
	RectangularWidget::setSize(size);

	sf::Vector2f buttonSize(size.x, size.x);
	scrollUpButton_->setSize(buttonSize);
	scrollUpButton_->setFontSize(buttonSize.x);
	scrollDownButton_->setSize(buttonSize);
	scrollDownButton_->setFontSize(buttonSize.x);

	scrollIndicator_->setSize({this->getSize().x, 4});
	updateScrollIndicator();
}
Exemplo n.º 13
0
 int MenuSelection::select(sf::RenderWindow* window, std::vector<std::string> &buttonNames){
     int qttyButtons = buttonNames.size();
     sf::Vector2f buttonSize(window->getSize().x/(qttyButtons+2), window->getSize().y/6);
     sf::Font font;
     sf::Texture text;
     if(!font.loadFromFile("res/fonts/font.otf")){ std::cerr << "Can't find the font file" << std::endl; }
     
     std::vector<Button> buttons(qttyButtons);
     for(int i = 0; i < qttyButtons; ++i){
         buttons[i].setFont(font);
         buttons[i].setTexture("res/pics/buttons/button.png");
         buttons[i].setPressedTexture("res/pics/buttons/buttonPres.png");
         buttons[i].setText(buttonNames[i]);
         buttons[i].setSize(buttonSize.x, buttonSize.y);
         buttons[i].setPosition(buttonSize.x*(i+1), buttonSize.y*3-buttonSize.y/2);
     }
     
     open = true;
     while(open){
         
         sf::Event event;
         while (window->pollEvent(event)) {
             for(int i = 0; i < qttyButtons; ++i){
                 buttons[i].handleEvent(event);
             }
             switch (event.type) {
             case sf::Event::Closed:
                 window->close();
                 exit(0);
                 break;
             case sf::Event::KeyPressed:
                 if (event.key.code == sf::Keyboard::Escape) { window->close(); exit(0); }
                 break;
             default:
                 break;
             }
             for(int i = 0; i < qttyButtons; ++i){
                 if(!buttons[i].isClicked() && buttons[i].hasBeenClicked()){
                     return i;
                 }
             }
         }
         window->clear();
         for(int i = 0; i < qttyButtons; ++i){
             buttons[i].draw(*window);
         }
         window->display();       
     }
 }
Exemplo n.º 14
0
IntRect ScrollbarThemeChromium::trackRect(ScrollbarThemeClient* scrollbar, bool)
{
    IntSize bs = buttonSize(scrollbar);
    int thickness = scrollbarThickness(scrollbar->controlSize());
    if (scrollbar->orientation() == HorizontalScrollbar) {
        // Once the scrollbar becomes smaller than the size of the
        // two buttons with a 1 pixel gap, the track disappears.
        if (scrollbar->width() <= 2 * bs.width() + 1)
            return IntRect();
        return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness);
    }
    if (scrollbar->height() <= 2 * bs.height() + 1)
        return IntRect();
    return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height());
}
Exemplo n.º 15
0
IntRect ScrollbarThemeAura::trackRect(const ScrollbarThemeClient& scrollbar,
                                      bool) {
  // The track occupies all space between the two buttons.
  IntSize bs = buttonSize(scrollbar);
  if (scrollbar.orientation() == HorizontalScrollbar) {
    if (scrollbar.width() <= 2 * bs.width())
      return IntRect();
    return IntRect(scrollbar.x() + bs.width(), scrollbar.y(),
                   scrollbar.width() - 2 * bs.width(), scrollbar.height());
  }
  if (scrollbar.height() <= 2 * bs.height())
    return IntRect();
  return IntRect(scrollbar.x(), scrollbar.y() + bs.height(), scrollbar.width(),
                 scrollbar.height() - 2 * bs.height());
}
Exemplo n.º 16
0
 void setGeometry (const QRect &rect)
 {
     int x = 0;
     int y = 0;
     const QSize &size = buttonSize();
     foreach (QWidgetItem* w, m_items) {
         if (w->isEmpty())
             continue;
         w->widget()->setGeometry(QRect(x, y, size.width(), size.height()));
         x += size.width();
         if (x + size.width() > rect.width()) {
             x = 0;
             y += size.height();
         }
     }
 }
Exemplo n.º 17
0
IntRect ScrollbarThemeChromium::trackRect(Scrollbar* scrollbar, bool)
{
    IntSize bs = buttonSize(scrollbar);
    // The buttons at the top and bottom of the scrollbar are square, so the
    // thickness of the scrollbar is also their height.
    int thickness = scrollbarThickness(scrollbar->controlSize());
    if (scrollbar->orientation() == HorizontalScrollbar) {
        // Once the scrollbar becomes smaller than the natural size of the
        // two buttons, the track disappears.
        if (scrollbar->width() < 2 * thickness)
            return IntRect();
        return IntRect(scrollbar->x() + bs.width(), scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness);
    }
    if (scrollbar->height() < 2 * thickness)
        return IntRect();
    return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height());
}
IntRect ScrollbarThemeChromium::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
    // Windows and Linux just have single arrows.
    if (part == ForwardButtonStartPart)
        return IntRect();

    IntSize size = buttonSize(scrollbar);
    int x, y;
    if (scrollbar->orientation() == HorizontalScrollbar) {
        x = scrollbar->x() + scrollbar->width() - size.width();
        y = scrollbar->y();
    } else {
        x = scrollbar->x();
        y = scrollbar->y() + scrollbar->height() - size.height();
    }
    return IntRect(x, y, size.width(), size.height());
}
Exemplo n.º 19
0
void Pager::resize(const Box& newExterior)
	{
	/* Resize the parent class widget: */
	Container::resize(newExterior);
	
	/* Calculate the natural size of the page button box: */
	Vector buttonSize(0.0f,0.0f,0.0f);
	for(ButtonList::iterator pbIt=pageButtons.begin();pbIt!=pageButtons.end();++pbIt)
		{
		/* Get the button's size: */
		Vector s=(*pbIt)->calcNaturalSize();
		
		/* Increment the box width: */
		buttonSize[0]+=s[0];
		
		/* Adjust the box height: */
		if(buttonSize[1]<s[1])
			buttonSize[1]=s[1];
		}
	
	/* Resize and reposition the page buttons: */
	buttonBox=getInterior();
	buttonBox.origin[1]+=buttonBox.size[1]-buttonSize[1];
	buttonBox.size[1]=buttonSize[1];
	Box pbBox=buttonBox;
	for(ButtonList::iterator pbIt=pageButtons.begin();pbIt!=pageButtons.end();++pbIt)
		{
		/* Get the button's natural size: */
		Vector s=(*pbIt)->calcNaturalSize();
		
		/* Resize the current button: */
		pbBox.size[0]=s[0];
		(*pbIt)->resize(pbBox);
		
		/* Advance the button box position to the next button: */
		pbBox.origin[0]+=pbBox.size[0];
		}
	
	/* Resize and reposition all child widgets: */
	childBox=getInterior();
	childBox.size[1]-=buttonSize[1];
	childBox.doInset(Vector(marginWidth,marginWidth,0.0f));
	for(WidgetList::iterator cIt=children.begin();cIt!=children.end();++cIt)
		(*cIt)->resize(childBox);
	}
Exemplo n.º 20
0
IntRect ScrollbarThemeGtk::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
    if (part == BackButtonEndPart && !m_hasBackButtonEndPart)
        return IntRect();

    int x = scrollbar->x() + m_troughBorderWidth;
    int y = scrollbar->y() + m_troughBorderWidth;
    IntSize size = buttonSize(scrollbar);
    if (part == BackButtonStartPart)
        return IntRect(x, y, size.width(), size.height());

    // BackButtonEndPart (alternate button)
    if (scrollbar->orientation() == HorizontalScrollbar)
        return IntRect(scrollbar->x() + scrollbar->width() - m_troughBorderWidth - (2 * size.width()), y, size.width(), size.height());

    // VerticalScrollbar alternate button
    return IntRect(x, scrollbar->y() + scrollbar->height() - m_troughBorderWidth - (2 * size.height()), size.width(), size.height());
}
Exemplo n.º 21
0
IntRect ScrollbarThemeWx::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
    // FIXME: Handling this case is needed when there are two sets of arrow buttons
    // on Mac, one at the top and one at the bottom.
    if (part == ForwardButtonStartPart)
        return IntRect();

    IntSize size = buttonSize(scrollbar);
    int x, y;
    if (scrollbar->orientation() == HorizontalScrollbar) {
        x = scrollbar->x() + scrollbar->width() - size.width();
        y = scrollbar->y();
    } else {
        x = scrollbar->x();
        y = scrollbar->y() + scrollbar->height() - size.height();
    }
    return IntRect(x, y, size.width(), size.height());
}
    //__________________________________________________
    void Configuration::write( KConfigGroup& group ) const
    {

        Configuration defaultConfiguration;

        if( titleAlignment() != defaultConfiguration.titleAlignment() ) group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
        if( centerTitleOnFullWidth() != defaultConfiguration.centerTitleOnFullWidth() ) group.writeEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH, centerTitleOnFullWidth() );
        if( buttonSize() != defaultConfiguration.buttonSize() ) group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
        if( blendColor() != defaultConfiguration.blendColor() ) group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
        if( frameBorder() != defaultConfiguration.frameBorder() ) group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
        if( sizeGripMode() != defaultConfiguration.sizeGripMode() ) group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );

        if( backgroundOpacity() != defaultConfiguration.backgroundOpacity() ) group.writeEntry( OxygenConfig::BACKGROUND_OPACITY, backgroundOpacity() );
        if( opacityFromStyle() != defaultConfiguration.opacityFromStyle() ) group.writeEntry( OxygenConfig::OPACITY_FROM_STYLE, opacityFromStyle() );

        if( separatorMode() != defaultConfiguration.separatorMode() )
        {
            group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever );
            group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive );
        }

        if( drawTitleOutline() != defaultConfiguration.drawTitleOutline() ) group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
        if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
        if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
        if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
        if( closeFromMenuButton() != defaultConfiguration.closeFromMenuButton() ) group.writeEntry( OxygenConfig::CLOSE_FROM_MENU_BUTTON, closeFromMenuButton() );
        if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
        if( useExtendedWindowBorder() != defaultConfiguration.useExtendedWindowBorder() ) group.writeEntry( OxygenConfig::EXTENDED_WINDOW_BORDERS, useExtendedWindowBorder() );

        // animations
        if( animationsEnabled() != defaultConfiguration.animationsEnabled() ) group.writeEntry( OxygenConfig::ANIMATIONS_ENABLED, animationsEnabled() );
        if( buttonAnimationsEnabled() != defaultConfiguration.buttonAnimationsEnabled() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_ENABLED, buttonAnimationsEnabled() );
        if( titleAnimationsEnabled() != defaultConfiguration.titleAnimationsEnabled() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_ENABLED, titleAnimationsEnabled() );
        if( shadowAnimationsEnabled() != defaultConfiguration.shadowAnimationsEnabled() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_ENABLED, shadowAnimationsEnabled() );
        if( tabAnimationsEnabled() != defaultConfiguration.tabAnimationsEnabled() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_ENABLED, tabAnimationsEnabled() );

        // animations duration
        if( buttonAnimationsDuration() != defaultConfiguration.buttonAnimationsDuration() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_DURATION, buttonAnimationsDuration() );
        if( titleAnimationsDuration() != defaultConfiguration.titleAnimationsDuration() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_DURATION, titleAnimationsDuration() );
        if( shadowAnimationsDuration() != defaultConfiguration.shadowAnimationsDuration() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_DURATION, shadowAnimationsDuration() );
        if( tabAnimationsDuration() != defaultConfiguration.tabAnimationsDuration() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_DURATION, tabAnimationsDuration() );

    }
Exemplo n.º 23
0
void MainWindow::setup_gui()
{
	wxFlexGridSizer *sizer = new wxFlexGridSizer(3, 3, 0, 0);
	SetSizer(sizer);

	// Top left, top, top right and middle left
	sizer->AddGrowableCol(0);
	sizer->AddGrowableRow(0);
	for(int i=0; i<4; ++i) sizer->AddSpacer(50);

	// Middle
	wxPanel *panel = new wxPanel(this);
	panel->SetBackgroundColour(GetBackgroundColour());
	sizer->Add(panel);

	wxGridSizer *panelSizer = new wxGridSizer(0, 1, 10, 0);
	panel->SetSizer(panelSizer);

	wxSize buttonSize(300, 50);

	std::vector<wxString> buttonCaptions;
	buttonCaptions.push_back(wxT("Open DICOMDIR..."));
	buttonCaptions.push_back(wxT("Open Saved Volume Choice..."));
	buttonCaptions.push_back(wxT("Open Test Volume 1"));
	buttonCaptions.push_back(wxT("Exit"));

	for(size_t i=0, size=buttonCaptions.size(); i<size; ++i)
	{
		wxButton *button = new wxButton(panel, BUTTONID_BASE + 1 + i, buttonCaptions[i], wxDefaultPosition, buttonSize);
		wxFont font = button->GetFont();
		font.SetPointSize(14);
		button->SetFont(font);
		panelSizer->Add(button, 0, wxALIGN_CENTER_HORIZONTAL);
	}

	// Middle right, bottom left, bottom and bottom right
	sizer->AddGrowableCol(2);
	sizer->AddGrowableRow(2);
	for(int i=0; i<4; ++i) sizer->AddSpacer(50);

	sizer->Fit(this);
}
Exemplo n.º 24
0
IntRect ScrollbarThemeWx::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
{
    // FIXME: Handling this case is needed when there are two sets of arrow buttons
    // on Mac, one at the top and one at the bottom.
    if (part == BackButtonEndPart)
        return IntRect();

    IntSize size = buttonSize(scrollbar);
    int x = scrollbar->x();
    int y = scrollbar->y();
    
#if __WXMAC__
    if (scrollbar->orientation() == HorizontalScrollbar)
        x += scrollbar->width() - (size.width() * 2) + cMacButtonOverlap;
    else
        y += scrollbar->height() - (size.height() * 2) + cMacButtonOverlap;
#endif
    
    return IntRect(x, y, size.width(), size.height());
}
Exemplo n.º 25
0
void MainWindow::onAddedMaterial(std::string material)
{
    std::map<std::string,int>::const_iterator it = storage->materials().find(material);
    if(it != storage->materials().end()) {
        QString buttonName(material.c_str());
        QPushButton* pb = ui->storage->findChild<QPushButton*>(buttonName);

        if(pb == 0) {
            int buttons = storage->materials().size();
            QPushButton *pb = new QPushButton(buttonName);
            pb->setObjectName(buttonName);
            connect(pb, SIGNAL(clicked()), signalMapper, SLOT(map()));
            signalMapper->setMapping(pb, buttonName);
            QSize buttonSize(90, 70);
            ui->storageLayout->addWidget(pb, (buttons - 1) / 7, (buttons - 1) % 7);
            pb->setFixedSize(buttonSize);
        } else if (!pb->isEnabled()) {
            pb->setEnabled(true);
        }
    }
}
Exemplo n.º 26
0
//---------------------------------------------------------------------------------------
void IdfyScalesCtrol::create_answer_buttons(LUnits height, LUnits spacing)
{
    //create buttons for the answers, two rows

    ImoStyle* pDefStyle = m_pDoc->get_default_style();
    ImoInlineWrapper* pBox;

    ImoStyle* pBtStyle = m_pDoc->create_private_style();
    pBtStyle->font_name("sans")->font_size(8.0f);

    ImoStyle* pRowStyle = m_pDoc->create_private_style();
    pRowStyle->font_size(10.0f)->margin_bottom(100.0f);

    USize buttonSize(3400.0f, height);
    LUnits rowWidth = 3520.0f;

    //rows with buttons
    LibraryScope* pLibScope = m_appScope.get_lomse().get_library_scope();
    int iB=0;
    for (int iRow=0; iRow < k_num_rows; iRow++)
    {
        ImoParagraph* pKeyboardRow = m_pDyn->add_paragraph(pRowStyle);

        pBox = pKeyboardRow->add_inline_box(rowWidth, pDefStyle);
        m_pRowLabel[iRow] = pBox->add_text_item("?", pRowStyle);

        // the buttons for this row
        for (int iCol=0; iCol < k_num_cols; iCol++)
        {
            iB = iCol + iRow * k_num_cols;
            pBox = pKeyboardRow->add_inline_box(rowWidth, pDefStyle);
            m_pAnswerButton[iB] = pBox->add_button(*pLibScope, "?", buttonSize, pBtStyle);
        }
    }

    set_event_handlers();

    //inform base class about the settings
    set_buttons(m_pAnswerButton, k_num_buttons);
}
Exemplo n.º 27
0
Vector Pager::calcNaturalSize(void) const
	{
	/* Calculate the size of the page button box: */
	Vector buttonSize(0.0f,0.0f,0.0f);
	for(ButtonList::const_iterator pbIt=pageButtons.begin();pbIt!=pageButtons.end();++pbIt)
		{
		/* Get the button's size: */
		Vector s=(*pbIt)->calcNaturalSize();
		
		/* Increment the box width: */
		buttonSize[0]+=s[0];
		
		/* Adjust the box height: */
		if(buttonSize[1]<s[1])
			buttonSize[1]=s[1];
		}
	
	/* Calculate the size of the child widget area: */
	Vector childSize(0.0f,0.0f,0.0f);
	for(WidgetList::const_iterator cIt=children.begin();cIt!=children.end();++cIt)
		{
		/* Get the child's size: */
		Vector s=(*cIt)->calcNaturalSize();
		
		/* Adjust the box width and height: */
		for(int i=0;i<2;++i)
			if(childSize[i]<s[i])
				childSize[i]=s[i];
		}
	
	/* Calcuate the total interior size: */
	Vector result=childSize;
	result[0]+=2.0f*marginWidth;
	result[1]+=2.0f*marginWidth;
	if(result[0]<buttonSize[0])
		result[0]=buttonSize[0];
	result[1]+=buttonSize[1];
	return calcExteriorSize(result);
	}
Exemplo n.º 28
0
IntRect ScrollbarThemeWx::trackRect(Scrollbar* scrollbar, bool)
{
    IntSize bs = buttonSize(scrollbar);
    int trackStart = 0;
    if (scrollbar->orientation() == HorizontalScrollbar)
        trackStart = bs.width();
    else
        trackStart = bs.height();
        
#if __WXMAC__
    trackStart = 0;
#endif
    
    int thickness = scrollbarThickness(scrollbar->controlSize());
    if (scrollbar->orientation() == HorizontalScrollbar) {
        if (scrollbar->width() < 2 * thickness)
            return IntRect();
        return IntRect(scrollbar->x() + trackStart, scrollbar->y(), scrollbar->width() - 2 * bs.width(), thickness);
    }
    if (scrollbar->height() < 2 * thickness)
        return IntRect();
    return IntRect(scrollbar->x(), scrollbar->y() + trackStart, thickness, scrollbar->height() - 2 * bs.height());
}
Exemplo n.º 29
0
    InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
        : WindowModal("openmw_interactive_messagebox.layout")
      , mMessageBoxManager(parMessageBoxManager)
      , mButtonPressed(-1)
        , mTextButtonPadding(0)
    {
        WindowModal::open();

        int fixedWidth = 500;
        int textPadding = 10; // padding between text-widget and main-widget
        int textButtonPadding = 20; // padding between the text-widget und the button-widget
        int buttonLeftPadding = 10; // padding between the buttons if horizontal
        int buttonTopPadding = 5; // ^-- if vertical
        int buttonPadding = 5; // padding between button label and button itself
        int buttonMainPadding = 10; // padding between buttons and bottom of the main widget

        mMarkedToDelete = false;


        getWidget(mMessageWidget, "message");
        getWidget(mButtonsWidget, "buttons");

        mMessageWidget->setOverflowToTheLeft(true);
        mMessageWidget->setCaptionWithReplacing(message);

        MyGUI::IntSize textSize = mMessageWidget->getTextSize();

        MyGUI::IntSize gameWindowSize = MyGUI::RenderManager::getInstance().getViewSize();

        int biggestButtonWidth = 0;
        int buttonWidth = 0;
        int buttonsWidth = 0;
        int buttonHeight = 0;
        MyGUI::IntCoord dummyCoord(0, 0, 0, 0);

        std::vector<std::string>::const_iterator it;
        for(it = buttons.begin(); it != buttons.end(); ++it)
        {
            MyGUI::Button* button = mButtonsWidget->createWidget<MyGUI::Button>(
                MyGUI::WidgetStyle::Child,
                std::string("MW_Button"),
                dummyCoord,
                MyGUI::Align::Default);
            button->setCaptionWithReplacing(*it);

            button->eventMouseButtonClick += MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);

            mButtons.push_back(button);

            buttonWidth = button->getTextSize().width + 2*buttonPadding + buttonLeftPadding;
            buttonsWidth += buttonWidth;
            buttonHeight = button->getTextSize().height + 2*buttonPadding + buttonTopPadding;

            if(buttonWidth > biggestButtonWidth)
            {
                biggestButtonWidth = buttonWidth;
            }
        }
        buttonsWidth += buttonLeftPadding;

        MyGUI::IntSize mainWidgetSize;
        if(buttonsWidth < fixedWidth)
        {
            // on one line
            if(textSize.width + 2*textPadding < buttonsWidth)
            {
                mainWidgetSize.width = buttonsWidth;
            }
            else
            {
                mainWidgetSize.width = textSize.width + 3*textPadding;
            }
            mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding;

            MyGUI::IntPoint absPos;
            absPos.left = (gameWindowSize.width - mainWidgetSize.width)/2;
            absPos.top = (gameWindowSize.height - mainWidgetSize.height)/2;

            mMainWidget->setPosition(absPos);
            mMainWidget->setSize(mainWidgetSize);

            MyGUI::IntCoord messageWidgetCoord;
            messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
            messageWidgetCoord.top = textPadding;
            mMessageWidget->setCoord(messageWidgetCoord);

            mMessageWidget->setSize(textSize);

            MyGUI::IntCoord buttonCord;
            MyGUI::IntSize buttonSize(0, buttonHeight);
            int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;

            std::vector<MyGUI::Button*>::const_iterator button;
            for(button = mButtons.begin(); button != mButtons.end(); ++button)
            {
                buttonCord.left = left;
                buttonCord.top = textSize.height + textButtonPadding;

                buttonSize.width = (*button)->getTextSize().width + 2*buttonPadding;
                buttonSize.height = (*button)->getTextSize().height + 2*buttonPadding;

                (*button)->setCoord(buttonCord);
                (*button)->setSize(buttonSize);

                left += buttonSize.width + buttonLeftPadding;
            }
        }
        else
        {
            // among each other
            if(biggestButtonWidth > textSize.width) {
                mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
            }
            else {
                mainWidgetSize.width = textSize.width + 3*textPadding;
            }

            MyGUI::IntCoord buttonCord;
            MyGUI::IntSize buttonSize(0, buttonHeight);

            int top = textButtonPadding + buttonTopPadding + textSize.height;

            std::vector<MyGUI::Button*>::const_iterator button;
            for(button = mButtons.begin(); button != mButtons.end(); ++button)
            {
                buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
                buttonSize.height = (*button)->getTextSize().height + buttonPadding*2;

                buttonCord.top = top;
                buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/

                (*button)->setCoord(buttonCord);
                (*button)->setSize(buttonSize);

                top += buttonSize.height + 2*buttonTopPadding;
            }

            mainWidgetSize.height = top + buttonMainPadding;
            mMainWidget->setSize(mainWidgetSize);

            MyGUI::IntPoint absPos;
            absPos.left = (gameWindowSize.width - mainWidgetSize.width)/2;
            absPos.top = (gameWindowSize.height - mainWidgetSize.height)/2;

            mMainWidget->setPosition(absPos);

            MyGUI::IntCoord messageWidgetCoord;
            messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
            messageWidgetCoord.top = textPadding;
            messageWidgetCoord.width = textSize.width;
            messageWidgetCoord.height = textSize.height;
            mMessageWidget->setCoord(messageWidgetCoord);
        }

        // Set key focus to "Ok" button
        std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
        std::vector<MyGUI::Button*>::const_iterator button;
        for(button = mButtons.begin(); button != mButtons.end(); ++button)
        {
            if(Misc::StringUtils::ciEqual((*button)->getCaption(), ok))
            {
                MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(*button);
                (*button)->eventKeyButtonPressed += MyGUI::newDelegate(this, &InteractiveMessageBox::onKeyPressed);
                break;
            }
        }
    }
// addVehicleButtons
//---------------------------------------------------------------------------
void HostJoinTemplateView::addVehicleButtons(const iXY &pos)
{
    // Add the vehicle buttons.
    // Get the dimensions of the buttons to draw.
    Surface tempSurface;
    if (!tempSurface.loadTIL("pics/vehicleSelectionMenu/light.til")) {
        throw Exception("ERROR: Unable to open pics/vehicleSelectionMenu/light.til to find the size to make the buttons.");
    }

    iXY buttonSize(tempSurface.getPix());
    int arrowButtonWidth =  16;

    int x;
    int y;

    x = pos.x;

    y = pos.y;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/humvee.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/light.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/medium.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/heavy.til", "", 0);
    x += buttonSize.x + 1;

    addButtonTILBordered(iXY(x, y), "pics/vehicleSelectionMenu/missle.til", "", 0);
    x += buttonSize.x + 1;

    // Draw the arrows to change the numbers.
    x = pos.x;
    y = pos.y + buttonSize.y;

    x = pos.x + (buttonSize.x + 1) * 0;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseHumvee);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseHumvee);

    x = pos.x + (buttonSize.x + 1) * 1;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseLightTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseLightTank);

    x = pos.x + (buttonSize.x + 1) * 2;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseMediumTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseMediumTank);

    x = pos.x + (buttonSize.x + 1) * 3;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseHeavyTank);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseHeavyTank);

    x = pos.x + (buttonSize.x + 1) * 4;
    x += (buttonSize.x - (arrowButtonWidth * 2)) / 2;
    addButtonCenterText(iXY(x, y), arrowButtonWidth, "<", "", bDecreaseMissleLauncher);
    addButtonCenterText(iXY(x + arrowButtonWidth, y), arrowButtonWidth, ">", "", bIncreaseMissleLauncher);


} // end HostJoinTemplateView::addVehicleButtons