WinMissionWindow::WinMissionWindow(Widget* p, const std::string& newTitle, const std::string& winText, bool mayContinue )
  : Window( p, Rect( 0, 0, 540, 240 ), "" ), _d( new Impl )
{
  setupUI( ":/gui/winmission.gui" );

  Logger::warning( "WinMissionWindow: show" );
  _d->locker.activate();

  setCenter( p->center() );

  Label* lbNewTitle;
  GET_WIDGET_FROM_UI( lbNewTitle )
  if( lbNewTitle ) lbNewTitle->setText( _( newTitle ) );

  PushButton* btnAccept;
  GET_WIDGET_FROM_UI( btnAccept )

  CONNECT( btnAccept, onClicked(), &_d->onNextMissionSignal, Signal0<>::_emit );
  CONNECT( btnAccept, onClicked(), this, WinMissionWindow::deleteLater );

  if( !winText.empty() )
  {
    Label* lbWin = new Label( this, Rect( 30, 30, width()-30, height()-30 ), _(winText), false, Label::bgWhiteFrame );
    lbWin->setTextAlignment( align::center, align::center );
    lbWin->setWordwrap( true );
    WidgetDeleter::assignTo( lbWin, 3000 );
  }
}
ChangeSalary::ChangeSalary(Widget* p, unsigned int salary)
  : Window( p, Rect(), "" ), __INIT_IMPL(ChangeSalaryWindow)
{
  setupUI( ":/gui/changesalary.gui");
  setCenter( parent()->center() );

  _dfunc()->newSalary = salary;

  ListBox* lbxTitles;
  GET_WIDGET_FROM_UI( lbxTitles )
  if( lbxTitles )
  {
    world::GovernorRanks ranks = world::EmpireHelper::ranks();
    for( auto rank : ranks )
    {
      std::string salaryStr = _( "##" + rank.rankName + "_salary##" );
      ListBoxItem& item = lbxTitles->addItem( salaryStr + "   " + utils::i2str( rank.salary ) );
      item.setTag( rank.salary );
      if( rank.salary == salary )
      {
        lbxTitles->setSelected( lbxTitles->itemsCount() - 1 );
      }
    }
  }

  INIT_WIDGET_FROM_UI( PushButton*, btnCancel  )
  INIT_WIDGET_FROM_UI( PushButton*, btnOk )

  CONNECT( btnCancel, onClicked(), this, ChangeSalary::deleteLater );
  CONNECT( btnOk, onClicked(), _dfunc().data(), Impl::setNewSalary );
  CONNECT( btnOk, onClicked(), this, ChangeSalary::deleteLater  );
  CONNECT( lbxTitles, onItemSelected(), _dfunc().data(), Impl::resolveSalaryChange );
}
DefaultTableComponent::DefaultTableComponent(const QRectF &a_rect,
                                             LayoutType type,
                                             QGraphicsItem *parent)
    : UIKit::TableViewItem(a_rect, parent),
      m_priv_ptr(new PrivateTableComponent) {
  m_priv_ptr->m_current_geometry = a_rect;
  m_priv_ptr->m_current_item_selection = false;
  m_priv_ptr->m_current_item_visibility = true;
  m_priv_ptr->m_current_layout_type = type;

  m_priv_ptr->m_layout_base = new QGraphicsWidget(this);
  m_priv_ptr->m_layout_base->setGeometry(a_rect);

  m_priv_ptr->m_linear_layout =
      new QGraphicsLinearLayout(m_priv_ptr->m_layout_base);

  m_priv_ptr->m_image_view_widget =
      new UIKit::ImageView(m_priv_ptr->m_layout_base);
  m_priv_ptr->m_image_view_widget->set_pixmap(
      UIKit::Theme::instance()->drawable("setup-wizard.png", "hdpi"));

  m_priv_ptr->m_label_widget = new UIKit::Label(m_priv_ptr->m_layout_base);

  m_priv_ptr->m_option_button = new UIKit::Button(m_priv_ptr->m_layout_base);

  connect(m_priv_ptr->m_image_view_widget, SIGNAL(clicked()), this,
          SLOT(onClicked()));
  connect(m_priv_ptr->m_label_widget, SIGNAL(clicked()), this,
          SLOT(onClicked()));
  connect(m_priv_ptr->m_option_button, SIGNAL(clicked()), this,
          SLOT(onClicked()));

  if (type == kGridLayout) {
    m_priv_ptr->m_linear_layout->setOrientation(Qt::Vertical);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button);
    m_priv_ptr->m_label_widget->set_size(QSize(64, a_rect.height()));
    m_priv_ptr->m_option_button->hide();
  } else {
    m_priv_ptr->m_label_widget->set_size(QSize(150, a_rect.height()));
    // d->m_image_view_widget->setSize(QSizeF(48.0, 48.0));
    m_priv_ptr->m_linear_layout->setOrientation(Qt::Horizontal);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_image_view_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_label_widget);
    m_priv_ptr->m_linear_layout->addItem(m_priv_ptr->m_option_button);
  }

  setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
  setFlag(QGraphicsItem::ItemIsMovable, false);
  setFlag(QGraphicsItem::ItemIsFocusable, true);
  setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);

  setFiltersChildEvents(false);
  setAcceptTouchEvents(true);
  setAcceptHoverEvents(true);
}
GranarySpecialOrdersWindow::GranarySpecialOrdersWindow( Widget* parent, const Point& pos, GranaryPtr granary )
: BaseSpecialOrdersWindow( parent, pos, defaultHeight ), __INIT_IMPL(GranarySpecialOrdersWindow)
{
  __D_IMPL(d, GranarySpecialOrdersWindow)

  setupUI( ":/gui/granaryspecial.gui" );

  setTitle( _("##granary_orders##") );
  int index=0;
  d->granary = granary;
  for( auto& goodType : good::foods() )
  {
    const good::Orders::Order rule = granary->store().getOrder( goodType );
    
    if( rule != good::Orders::none )
    {
      OrderGoodWidget::create( index, goodType, _ordersArea(), granary->store() );
      index++;
    }
  }

  d->btnToggleDevastation = new PushButton( this, Rect( 80, height() - 45, width() - 80, height() - 25 ),
                                             "", -1, false, PushButton::whiteBorderUp );

  CONNECT( d->btnToggleDevastation, onClicked(), this, GranarySpecialOrdersWindow::toggleDevastation );
  _updateBtnDevastation();
}
/*************************************************************************
	Handler for mouse button release events
*************************************************************************/
void PushButton::onMouseButtonUp(MouseEventArgs& e)
{
	if ((e.button == LeftButton) && isPushed())
	{
		Window* sheet = getGUIContext().getRootWindow();

		if (sheet)
		{
			// if mouse was released over this widget
            // (use position from mouse, as e.position has been unprojected)
			if (this == sheet->getTargetChildAtPosition(
                getGUIContext().getMouseCursor().getPosition()))
			{
				// fire event
				WindowEventArgs args(this);
				onClicked(args);
			}

		}

		++e.handled;
	}

	// default handling
	ButtonBase::onMouseButtonUp(e);
}
AdvisorsWindow::AdvisorsWindow( Widget* parent, int id )
: Widget( parent, id, Rect( Point(0, 0), parent->getSize() ) ), _d( new Impl )
{
  // use some clipping to remove the right and bottom areas
  _d->background.reset( Picture::create( getSize() ) );
  _d->advisorPanel = 0;

  Picture& backgr = Picture::load( "senate", 1 );

  _d->background->draw( backgr, Rect( Point( 0, 0), backgr.getSize() ), Rect( Point( 0,0), getSize() ) ); 

  Point tabButtonPos( (getWidth() - 636) / 2, getHeight() / 2 + 192);

  _d->background->draw( Picture::load( ResourceGroup::menuMiddleIcons, 14 ), tabButtonPos.getX(), tabButtonPos.getY() );
  addButton( ADV_EMPLOYERS, 255 );
  addButton( ADV_LEGION, 256 );
  addButton( ADV_EMPIRE, 257 );
  addButton( ADV_RATINGS, 258 );
  addButton( ADV_TRADING, 259 );
  addButton( ADV_POPULATION, 260 );
  addButton( ADV_HEALTH, 261 );
  addButton( ADV_EDUCATION, 262 );
  addButton( ADV_ENTERTAINMENT, 263 );
  addButton( ADV_RELIGION, 264 );
  addButton( ADV_FINANCE, 265 );
  addButton( ADV_MAIN, 266 );

  PushButton* btn = addButton( ADV_COUNT, 609 );
  btn->setIsPushButton( false );

  CONNECT( btn, onClicked(), this, AdvisorsWindow::deleteLater );
}
Beispiel #7
0
/**
* \class ds::ui::LayoutButton
*/
LayoutButton::LayoutButton(SpriteEngine& eng, const float widdy, const float hiddy)
	: ds::ui::LayoutSprite(eng)
	, mDown(*(new ds::ui::LayoutSprite(eng)))
	, mUp(*(new ds::ui::LayoutSprite(eng)))
	, mButtonBehaviour(*this)
	, mAnimDuration(0.1f)
{

	setLayoutType(ds::ui::LayoutSprite::kLayoutNone);

	mUp.mExportWithXml = false;
	mUp.mLayoutUserType = ds::ui::LayoutSprite::kFillSize;
	mUp.setLayoutType(ds::ui::LayoutSprite::kLayoutSize);
	addChild(mUp);

	mDown.mExportWithXml = false;
	mDown.mLayoutUserType = ds::ui::LayoutSprite::kFillSize;
	mDown.setLayoutType(ds::ui::LayoutSprite::kLayoutSize);
	mDown.setOpacity(0.0f);
	addChild(mDown);

	mButtonBehaviour.setOnClickFn([this](){onClicked(); });
	// Purely for visual state
	mButtonBehaviour.setOnDownFn([this](const ds::ui::TouchInfo&){showDown(); });
	mButtonBehaviour.setOnEnterFn([this](){showDown(); });
	mButtonBehaviour.setOnExitFn([this](){showUp(); });
	mButtonBehaviour.setOnUpFn([this](){showUp(); });

}
WarehouseSpecialOrdersWindow::WarehouseSpecialOrdersWindow( Widget* parent, const Point& pos, WarehousePtr warehouse )
: BaseSpecialOrdersWindow( parent, pos, defaultHeight ), __INIT_IMPL(WarehouseSpecialOrdersWindow)
{
  __D_IMPL(d, WarehouseSpecialOrdersWindow)

  setupUI( ":/gui/warehousespecial.gui");
  setTitle( _("##warehouse_orders##") );

  d->warehouse = warehouse;
  int index=0;
  for( int goodType=Good::wheat; goodType <= Good::marble; goodType++ )
  {
    const GoodOrders::Order rule = d->warehouse->store().getOrder( (Good::Type)goodType );

    if( rule != GoodOrders::none )
    {
      addOrderWidget<WarehousePtr>( index, (Good::Type)goodType, _ordersArea(), d->warehouse );
      index++;
    }
  }

  GET_DWIDGET_FROM_UI( d, btnToggleDevastation )
  GET_DWIDGET_FROM_UI( d, btnTradeCenter )

  CONNECT( d->btnToggleDevastation, onClicked(), this, WarehouseSpecialOrdersWindow::toggleDevastation );
  _updateBtnDevastation();
}
PopupMessageBox::PopupMessageBox( Widget* parent, const std::string& title, 
                                 const std::string& text, 
                                 const std::string& time,
                                 const std::string& receiver, int id ) 
  : Widget( parent, id, Rect( 0, 0, 590, 320 ) ), _d( new Impl )
{
  setPosition( Point( (parent->getWidth() - getWidth())/2, (parent->getHeight() - getHeight()) / 2 ) );
  
  Label* lbTitle = new Label( this, Rect( 10, 10, getWidth() - 10, 10 + 30), title );
  lbTitle->setFont( Font::create( FONT_3 ) );
  lbTitle->setTextAlignment( alignCenter, alignCenter );

  _d->background.reset( Picture::create( getSize() ) );
  //main _d->_d->background
  PictureDecorator::draw( *_d->background, Rect( Point( 0, 0 ), getSize() ), PictureDecorator::whiteFrame );
  PictureDecorator::draw( *_d->background, Rect( Point( 18, 50 ), Size( getWidth() - 34, 220 ) ), PictureDecorator::blackFrame );

  _d->btnExit = new TexturedButton( this, Point( getWidth() - 40, getHeight() - 40 ), Size( 24 ), -1, ResourceMenu::exitInfBtnPicId );
  _d->btnExit->setTooltipText( _("##infobox_tooltip_exit##") );
  CONNECT( _d->btnExit, onClicked(), this, PopupMessageBox::deleteLater );

  _d->btnHelp = new TexturedButton( this, Point( 18, getHeight() - 40 ), Size( 24 ), -1, ResourceMenu::helpInfBtnPicId );
  _d->btnHelp->setTooltipText( _("##infobox_tooltip_help##") );

  Font font2 = Font::create( FONT_2_WHITE );
  font2.draw( *_d->background, time, 20, 50 );
  font2.draw( *_d->background, receiver, 180, 50 );

  _d->lbText = new Label( this, Rect( Point( 20, 100 ), Size( 550, 165 )), text );
}
WarehouseSpecialOrdersWindow::WarehouseSpecialOrdersWindow( Widget* parent, const Point& pos, WarehousePtr warehouse )
: BaseSpecialOrdersWindow( parent, pos )
{
  setTitle( _("##warehouse_orders##") );

  _warehouse = warehouse;
  int index=0;
  for( int goodType=G_WHEAT; goodType <= G_MARBLE; goodType++ )
  {
    const GoodOrders::Order rule = _warehouse->getGoodStore().getOrder( (GoodType)goodType );

    if( rule != GoodOrders::none )
    {
      _d->addOrderWidget<WarehousePtr>( index, (GoodType)goodType, _warehouse );
      index++;
    }
  }

  _btnToggleDevastation = new PushButton( this, Rect( 80, getHeight() - 45, getWidth() - 80, getHeight() - 25 ),
                                          "", -1, false, PushButton::whiteBorderUp );

  _btnTradeCenter = new PushButton( this, Rect( 80, getHeight() - 70, getWidth() - 80, getHeight() - 50 ),
                                   _("##Trace center##"), -1, false, PushButton::whiteBorderUp );

  CONNECT( _btnToggleDevastation, onClicked(), this, WarehouseSpecialOrdersWindow::toggleDevastation );
  _updateBtnDevastation();
}
Beispiel #11
0
Checkbox::Checkbox(QWidget *parent, const QString &text, bool checked, const style::Checkbox &st) : Button(parent)
, _st(st)
, a_over(0)
, a_checked(checked ? 1 : 0)
, _a_over(animation(this, &Checkbox::step_over))
, _a_checked(animation(this, &Checkbox::step_checked))
, _text(text)
, _fullText(text)
, _textWidth(st.font->width(text))
, _checked(checked) {
	if (_st.width <= 0) {
		resize(_textWidth - _st.width, _st.height);
	} else {
		if (_st.width < _st.textPosition.x() + _textWidth + (_st.textPosition.x() - _st.diameter)) {
			_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1));
			_textWidth = _st.font->width(_text);
		}
		resize(_st.width, _st.height);
	}
	_checkRect = myrtlrect(0, 0, _st.diameter, _st.diameter);

	connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));

	setCursor(style::cur_pointer);

	setAttribute(Qt::WA_OpaquePaintEvent);
}
Beispiel #12
0
Radiobutton::Radiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::Radiobutton &st) : Button(parent),
_st(st),
a_over(0), a_checked(checked ? 1 : 0),
_a_over(animFunc(this, &Radiobutton::animStep_over)), _a_checked(animFunc(this, &Radiobutton::animStep_checked)),
_text(text), _fullText(text), _textWidth(st.font->width(text)),
_checked(checked), _group(radiobuttons.reg(group)), _value(value) {
	if (_st.width <= 0) {
		resize(_textWidth - _st.width, _st.height);
	} else {
		if (_st.width < _st.textPosition.x() + _textWidth + (_st.textPosition.x() - _st.diameter)) {
			_text = _st.font->elided(_fullText, qMax(_st.width - (_st.textPosition.x() + (_st.textPosition.x() - _st.diameter)), 1.));
			_textWidth = _st.font->width(_text);
		}
		resize(_st.width, _st.height);
	}
	_checkRect = myrtlrect(0, 0, _st.diameter, _st.diameter);

	connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));

	setCursor(style::cur_pointer);

	setAttribute(Qt::WA_OpaquePaintEvent);

	reinterpret_cast<RadiobuttonGroup*>(_group)->insert(this, true);
	if (_checked) onChanged();
}
void TabButton::onCursorActivate(CursorInputEventArgs& e)
{
    if ((e.source == CIS_Left) && isPushed())
	{
		Window* sheet = getGUIContext().getRootWindow();

		if (sheet)
		{
            // if cursor was released over this widget
            // (use cursor position, as e.position has been unprojected)
			if (this == sheet->getTargetChildAtPosition(
                                    getGUIContext().getCursor().getPosition()))
			{
				// fire event
				WindowEventArgs args(this);
				onClicked(args);
			}
		}

		++e.handled;
    }
    else if (e.source == CIS_Middle)
    {
        d_dragging = false;
        releaseInput ();
        ++e.handled;
    }

	// default handling
    ButtonBase::onCursorActivate(e);
}
Beispiel #14
0
ColorButton::ColorButton(QWidget *parent, QColor color) :
    QPushButton(parent)
{
    setColor(color);

    connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
}
Beispiel #15
0
// MyButton
MyButton::MyButton(const QString &text, QWidget *parent) :
    QPushButton(text, parent)
{
    setFlat(true);
    setFocusPolicy(Qt::NoFocus);
    connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
}
Beispiel #16
0
MainWindow::MainWindow(QWidget* parent)
	: QWidget(parent)
{
	m_tdc.name = "Joonhwan";
	m_tdc.children << "Seyeon"
				<< "Eunseo";
	m_tdc.age = 42;
	m_tdc.level = 5;

	QPushButton* button1 = new QPushButton("Test1");
	connect(button1, SIGNAL(clicked()), SLOT(onClicked()));
	QPushButton* button2 = new QPushButton("Test2");
	connect(button2, SIGNAL(clicked()), SLOT(onClicked2()));

	// - 비 포인터형을 받을 때는 반드시 const T& 형으로 signal/slot이
	//   되어야 한다.  signal/slot에서 Queuedconnection이 된 경우,
	//   호출측에서 받는 non-const 참조형은 아무런 의미가
	//   없다. 호출측이 전달한 객체에 대한 참조가 아니라, 새로이
	//   만들어진 객체에 대한 참조를 하기 때문이다.

	// enum을 전달할 때도 사용자 타입설정과 동일한 느낌으로 하면 된다.
	qRegisterMetaType<MyEnum::Type>("MyEnum::Type");
	connect(this, SIGNAL(testSignal(const MyEnum::Type&)),
			this, SLOT(testSlot(const MyEnum::Type&)),
			Qt::QueuedConnection);

	// 아래의 내용은 qRegisterMetaType()의 호출과는 상관없이 가능하다.
	// 1. const 참조형.
	connect(this, SIGNAL(testSignal2(const TestDataClass&)),
			this, SLOT(testSlot2(const TestDataClass&)));
	// 2a. non-const 참조형 - Direct
	connect(this, SIGNAL(testSignal2_NonConst(TestDataClass&)),
			this, SLOT(testSlot2_NonConst(TestDataClass&)));
	// 2b. non-const 참조형 - Queueud
	//  ---> 동작하지 않는다. 아래와 같은 경고가 뜬다. 하지만,
	//  qRegisterMetaType<TestDataClass&>("TestDataClass&")는 컴파일이 안된다.
	//  따라서 쓸 수가 없다.
	//  QObject::connect: Cannot queue arguments of type 'TestDataClass&'
	// (Make sure 'TestDataClass&' is registered using qRegisterMetaType().)
	//
	// connect(this, SIGNAL(testSignal2_NonConst(TestDataClass&)),
	// 		this, SLOT(testSlot2_NonConst(TestDataClass&)),
	// 		Qt::QueuedConnection);

	// 3. 포인터형(const 이 아니어도 동작한다).
	connect(this, SIGNAL(testSignal3(TestDataClass*)),
			this, SLOT(testSlot_Pointer_Queued(TestDataClass*)),
			Qt::QueuedConnection);

	// 아래의 내용을 처리하지 않으면, testSlot2_Queued()는 동작하지 않는다.
	qRegisterMetaType<TestDataClass>("TestDataClass");
	connect(this, SIGNAL(testSignal2(const TestDataClass&)),
			this, SLOT(testSlot2_Queued(const TestDataClass&)),
			Qt::QueuedConnection);

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addWidget(button1);
	layout->addWidget(button2);
}
Beispiel #17
0
void pColorButton::init( const QColor& color )
{
    connect( this, SIGNAL( clicked() ), this, SLOT( onClicked() ) );
    
    mColorNameHidden = false;
    
    setColor( color );
}
Beispiel #18
0
ImageButton::ImageButton(QWidget* parent)
    : QPushButton(parent)
{
    setAutoDefault(false);
    setIconSize(QSize(100, 100));
    unsetImage();
    connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
}
Beispiel #19
0
OpenFileDlg::OpenFileDlg(QWidget* parent, CR3View* docView, const QString& path, const QString& file)
    : Dialog(parent)
    , ui(new Ui::OpenFileDlg)
{
    ui->setupUi(this);

    QFont f(ui->lblPosition->font());
    f.setPointSize(f.pointSize()/2);
    ui->lblPosition->setFont(f);

    f = ui->lblTitle->font();
    f.setBold(true);
    ui->lblTitle->setFont(f);

    iconFile = QIcon(":/icons/book.png");
    iconFolder = QIcon(":/icons/folder.png");

    model.setIconProvider(this);

    model.setNameFilterDisables(false);
    model.setRootPath("/");
    ui->fileList->setModel( &model );
    ui->fileList->setRootIndex(model.index(path));
    if ( !file.isEmpty() )
    {
        ui->fileList->setCurrentIndex(model.index(path + QDir::separator() + file));
    }

    model.setFilter( QDir::AllDirs | QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks | QDir::Hidden );
    model.setNameFilters( QStringList() << "*.zip" << "*.fb2" << "*.epub" << "*.rtf" << "*.txt" << "*.html" << "*.htm" << "*.tcr" << "*.pdb" << "*.chm" << "*.mobi" << "*.doc" << "*.azw" );

    QObject::connect( ui->fileList, SIGNAL(clicked(QModelIndex)), this, SLOT(onClicked(QModelIndex)));
    QObject::connect( ui->fileList, SIGNAL(activated(QModelIndex)), this, SLOT(onClicked(QModelIndex)));
    QObject::connect( &model, SIGNAL(layoutChanged()), this, SLOT(onLayoutChanged()));

    ui->navBar->setControls(ui->fileList, ui->lblPosition,
                            QSize( docView->getOptions()->getIntDef(PROP_APP_UI_SWIPES_X_WEIGHT, 1),
                                   docView->getOptions()->getIntDef(PROP_APP_UI_SWIPES_Y_WEIGHT, 1) ) );

    ui->fileList->setEditFocus(true);

    ui->fileList->setTextElideMode(Qt::ElideRight);

    init();
}
Beispiel #20
0
FilmWidget::FilmWidget(Widget* parent, io::FilePath film )
    : Widget( parent, -1, Rect( 0, 0, 1, 1 ) ), _d( new Impl )
{
    _d->lbMessage = 0;

    setupUI( GameSettings::rcpath( "/gui/filmwidget.gui" ) );

    setPosition( Point( parent->getWidth() - getWidth(), parent->getHeight() - getHeight() ) / 2 );

    _d->lbTitle = findChild<Label*>( "lbTitle", true );
    _d->btnExit = findChild<TexturedButton*>( "btnExit", true );
    _d->lbTime = findChild<Label*>( "lbTime", true );
    _d->lbReceiver = findChild<Label*>( "lbReceiver", true );
    _d->lbMessage = findChild<Label*>( "lbMessage", true );

    CONNECT( _d->btnExit, onClicked(), &_d->onCloseSignal, Signal0<>::emit );
    CONNECT( _d->btnExit, onClicked(), this, FilmWidget::deleteLater );
}
TabButtonWidget::TabButtonWidget(TabWidget *parent) :
    PushButton(parent),
    m_minSize(size()),
    m_tabWidget(parent)
{
    sizeHint();
    this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
}
FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent),
	_text(text), _checked(checked), _st(st), _opacity(1), a_over(0, 0) {
	connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
	setCursor(_st.cursor);
	int32 w = _st.width, h = _st.height;
	if (w <= 0) w = _st.textLeft + _st.font->m.width(_text);
	if (h <= 0) h = qMax(_st.font->height, _st.imageRect.height());
	resize(QSize(w, h));
}
Beispiel #23
0
LabelBtn::LabelBtn(const QString& pngFile, const QString& soundFile, QWidget *parent)	
	: QLabel(parent)
{
	m_SoundFile = soundFile;
	setCursor(Qt::PointingHandCursor);
	this->setPixmap(QPixmap(pngFile));
	this->resize(QPixmap(pngFile).size());
	this->setAttribute(Qt::WA_TranslucentBackground,true);
    connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
}
Beispiel #24
0
void BoardWidget::mouseReleaseEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton && !mouseDownPoint.isNull()) {
        int dx = event->pos().x() - mouseDownPoint.x();
        int dy = event->pos().y() - mouseDownPoint.y();
        if (dx * dx + dy * dy <= 5 * 5) {
            onClicked(event->pos());
        }
        mouseDownPoint = QPoint();
    }
}
Trade::Trade(PlayerCityPtr city, Widget* parent, int id )
    : Base( parent, city, id ), _d( new Impl )
{
    setupUI( ":/gui/tradeadv.gui" );

    _d->city = city;
    _d->allgoods = city->statistic().goods.details( false );

    GET_DWIDGET_FROM_UI( _d, btnEmpireMap  )
    GET_DWIDGET_FROM_UI( _d, btnPrices )
    GET_DWIDGET_FROM_UI( _d, gbInfo )

    CONNECT( _d->btnEmpireMap, onClicked(), this, Trade::deleteLater );
    CONNECT( _d->btnPrices, onClicked(), _d.data(), Impl::showGoodsPriceWindow );

    _d->updateGoodsInfo();

    TexturedButton* btnHelp = new TexturedButton( this, Point( 12, height() - 39), Size( 24 ), -1, ResourceMenu::helpInfBtnPicId );
    CONNECT( btnHelp, onClicked(), this, Trade::_showHelp );
}
void LoadChemStationDataDialog::expandToPath(const QString &path)
{
  const QModelIndex &index = m_fsModel->index(path);

  if (!index.isValid())
    return;

  qtrv_fileSystem->setCurrentIndex(index);
  qtrv_fileSystem->scrollTo(index);
  onClicked(index);
}
Beispiel #27
0
void FalagardActionButton::onMouseButtonUp(MouseEventArgs& e)
{
    //		FalagardButton::onMouseButtonUp(e);下面就是pushbutton中的部分
    if ((e.button == LeftButton) && isPushed())
    {
        Window* sheet = System::getSingleton().getGUISheet();

        if (sheet != NULL)
        {
            // if mouse was released over this widget
            if (this == sheet->getChildAtPosition(e.position))
            {
                // fire event
                WindowEventArgs args(this);
                onClicked(args);
            }

        }

        e.handled = true;
    }

    if(e.button == RightButton)
    {
        Window* sheet = System::getSingleton().getGUISheet();

        if (sheet != NULL)
        {
            // if mouse was released over this widget
            if (this == sheet->getChildAtPosition(e.position))
            {
                // fire event
                WindowEventArgs args(this);
                onRBClicked(args);
            }

        }

    }

    // default handling
    //		ButtonBase::onMouseButtonUp(e);下面就是buttonbase中的部分
    Window::onMouseButtonUp(e);

    if (e.button == LeftButton || e.button == RightButton)
    {
        releaseInput();

        // event was handled by us.
        e.handled = true;
    }

    d_leftMouseDown = false;
}
///////// tid filters
void FilterTid::setupModel ()
{
	if (!m_model)
		m_model = new QStandardItemModel;
	m_ui->view->setModel(m_model);

	m_ui->view->setEditTriggers(QAbstractItemView::NoEditTriggers);
	connect(m_ui->view, SIGNAL(clicked(QModelIndex)), this, SLOT(onClicked(QModelIndex)));
	connect(m_ui->allButton, SIGNAL(clicked()), this, SLOT(onSelectAll()));
	connect(m_ui->noneButton, SIGNAL(clicked()), this, SLOT(onSelectNone()));
}
Beispiel #29
0
void CHilitButton::OnLButtonDown(UINT nFlags, CPoint point)
{
	CMFCButton::OnLButtonDown(nFlags, point);

	if (!m_bEnableDoubleClick && onClicked) {
		onClicked();
	}

	if (m_bEnableDoubleClick) {
		SetTimer(DelayClickTimer, 150, NULL);
	}
}
Beispiel #30
0
	bool GUIColor::_mouseEvent(const GUIMouseEvent& ev)
	{
		if(ev.getType() == GUIMouseEventType::MouseUp)
		{
			if (!_isDisabled())
				onClicked();

			return true;
		}

		return false;
	}