Пример #1
0
void TWidget::_handle_mouseMove(const TEvent_MouseMoved& event, bool& consume) {
    consume = false;

    if (IsVisible() == false) {
        return;
    }

    const auto& mousePosition = event;
    const auto position = GetScreenPosition();
    const auto bounds = position + GetOwnSize();
    const bool isOver = IsVisible() &&
        isPointInRect(mousePosition.x, mousePosition.y,
            position.x, position.y, bounds.x, bounds.y);

    if ((isOver == true) && (mouseOver == false)) {
        _OnHover();
        GetSignal(DefaultSignalID::MouseEntered).Send();
    } else if ((isOver == false) && (mouseOver == true)) {
        _OnMouseLeave();
        GetSignal(DefaultSignalID::MouseLeave).Send();
    } else {
        /*none*/
    }

    mouseOver = isOver;
}
Пример #2
0
void StateBehavior::StdOnSignal() {
    EmAssert(this->getParent() != NULL, "Parent NULL");
    if (p_CurrentStateItem == NULL && m_vStateItem.size() == 0) return;

    // initialize origo, this is a ugle hack
    if (m_iTick == 0) {
        this->getParent()->getTranslation(m_vtxTr.x, m_vtxTr.y, m_vtxTr.z);
        this->getParent()->getRotation(m_vtxRot.x, m_vtxRot.y, m_vtxRot.z);
    }

#if EM_DEBUG
    if (Loader::getInstance()->getSignal(GetSignal()) != NULL) {
        EM_COUT("Got signal " << Loader::getInstance()->getSignal(GetSignal()), 0);
    }
#endif

    OnSignal( PBL_SIG_RESET_ALL) {
        this->setState(m_vStateItem[0]);
        // do a fast move
        if (m_bMove) {
            this->getParent()->setTransform(m_vtxTr.x + p_CurrentStateItem->m_vtxTr.x,
                                            m_vtxTr.y + p_CurrentStateItem->m_vtxTr.y,
                                            m_vtxTr.z + p_CurrentStateItem->m_vtxTr.z,
                                            m_vtxRot.x + p_CurrentStateItem->m_vtxRot.x,
                                            m_vtxRot.y + p_CurrentStateItem->m_vtxRot.y,
                                            m_vtxRot.z + p_CurrentStateItem->m_vtxRot.z);

        }
    }
    else {
Пример #3
0
void MpHostSetupUi::initWindow() {
    window->SetStyle(Style::Fullscreen);
    window->SetRequisition(Vector2f((float)ct::WindowWidth, (float)ct::WindowHeight));

    mainBox = Box::Create(Box::Orientation::VERTICAL, 5);
    auto closeButton = Button::Create("Close");
    closeButton->GetSignal(Widget::OnLeftClick).Connect(backAction);
    mainBox->Pack(createAlignment(closeButton, Vector2f(0.0f, 0.0f), Vector2f(1.0f, 0.0f)));

    auto nameBox = Box::Create(Box::Orientation::HORIZONTAL, 5);
    nameEntry = Entry::Create("Player 1");
    nameEntry->SetMaximumLength(10);
    nameEntry->SetRequisition(Vector2f(ct::WindowWidth * 0.1f, 0.0f));
    auto createButton = Button::Create("Create");
    createButton->GetSignal(Widget::OnLeftClick).Connect(bind(&MpHostSetupUi::triggerCreateServer, this));

    nameBox->Pack(nameEntry, true, true);
    nameBox->Pack(createButton, true, true);

    nameFrame = Frame::Create("Your name:");
    nameFrame->Add(nameBox);
    nameFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.1f));
    mainBox->Pack(createAlignment(nameFrame, Vector2f(0.5f, 0.01f), Vector2f(1.0f, 0.0f)));

    window->Add(createAlignment(mainBox, Vector2f(0.5f, 0.5f), Vector2f(0.9f, 0.9f)));
}
Пример #4
0
	Button::Ptr GameUi::getNewButton(int line, int column, int size) {
		auto button = Button::Create();
		button->SetRequisition(Vector2f((float) size, (float) size));
		button->SetClass("Tile");

		button->GetSignal(Widget::OnLeftClick).Connect(bind(&GameUi::onButtonReveal, this, line, column));
		button->GetSignal(Widget::OnRightClick).Connect(bind(&GameUi::onButtonFlag, this, line, column));

		return button;
	}
Пример #5
0
void TWidget::SetVisibility(bool value) {
    if ((IsVisible() == false) && (value == true)) {
        _OnShown();
        GetSignal(DefaultSignalID::ObjectShown).Send();
        GetSignal(DefaultSignalID::ObjectVisibilityChanged).Send();
    } else if ((IsVisible() == true) && (value == false)) {
        _OnHidden();
        GetSignal(DefaultSignalID::ObjectHidden).Send();
        GetSignal(DefaultSignalID::ObjectVisibilityChanged).Send();
    } else {
        /*none*/
    }

    visible = value;
}
Пример #6
0
void TWidget::SetParent(const TWidgetWeakRef& value) {
    const auto currentParent = parent.lock();
    if (currentParent == value.lock()) {
        return;
    }

    Child me = shared_from_this();

    if (value.expired() == false) {
        auto newParent = value.lock();
        ASSERT(newParent->HasChild(name) == false,
           "Menu object '" + newParent->name + "' already contains "
           "child with name '" + name + "'.")

        newParent->children[name] = me;
    }

    if ((currentParent != nullptr) && (currentParent->HasChild(me) == true)) {
        currentParent->children.erase(name);
    }

    parent = value;
    _OnParentChanged();
    GetSignal(DefaultSignalID::ObjectParentChanged).Send();
}
FilePickerDialog::FilePickerDialog( boost::filesystem::path initial_path ) :
    Window( Window::Style::TOPLEVEL | Window::Style::CLOSE ),
    m_main_box( sfg::Box::Create( sfg::Box::Orientation::VERTICAL, 5.f ) ),
    m_panel_box( sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 5.f ) ),
    m_locations_listbox( sfg::ListBox::Create( ) ),
    m_directory_box( sfg::Box::Create( sfg::Box::Orientation::VERTICAL, 5.f ) ),
    m_directory_entry_box( sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 5.f ) ),
    m_new_directory_button( sfg::Button::Create( "+" ) ),
    m_current_directory_entry( sfg::Entry::Create( ) ),
    m_directory_paths_listbox( sfg::ListBox::Create( ) ),
    m_filename_box( sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 5.f ) ),
    m_filename_entry( sfg::Entry::Create( ) ),
    m_buttons_box( sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 5.f ) ),
    m_ok_button( sfg::Button::Create( "Ok" ) ),
    m_cancel_button( sfg::Button::Create( "Cancel" ) ),
    m_current_path( initial_path ),
    m_show_hidden_files( false )
{
    UpdateLocationsPaths();
    UpdateCurrentDirectoryPath();
    UpdateDirectoryPaths();
    UpdateOkButtonState();

    m_locations_listbox->GetSignal( sfg::ListBox::OnSelect ).Connect( std::bind( &FilePickerDialog::OnLocationsListBoxSelectionChanged, this ) );
    m_current_directory_entry->GetSignal( sfg::Entry::OnTextChanged ).Connect( std::bind( &FilePickerDialog::OnCurrentDirectoryEntryTextChanged, this ) );
    m_directory_paths_listbox->GetSignal( sfg::ListBox::OnSelect ).Connect( std::bind( &FilePickerDialog::OnPathsListBoxSelectionChanged, this ) );
    m_filename_entry->GetSignal( sfg::Entry::OnTextChanged ).Connect( std::bind( &FilePickerDialog::OnFilenameEntryTextChanged, this ) );

    //Connect buttons and the close button
    GetSignal( sfg::Window::OnCloseButton ).Connect( std::bind( &FilePickerDialog::CancelDialog, this ) );
    m_cancel_button->GetSignal( sfg::Widget::OnLeftClick ).Connect( std::bind( &FilePickerDialog::CancelDialog, this ) );
    m_ok_button->GetSignal( sfg::Widget::OnLeftClick ).Connect( std::bind( &FilePickerDialog::OkDialog, this ) );
}
Пример #8
0
int CTechnique::GetIntensityTraceback( int nIndex, UINT * pnCode )
{
	if( pnCode )	*pnCode	=	ITSC_NOTHING;

	int	k,	nIntensity	=	ITS_NOTHING;
	UINT	nCode		=	ITSC_NOTHING;
	for(  k=nIndex; k>=0; k -- )
	{
		nIntensity	=	GetSignal(k,&nCode);
		if( ITS_NOTHING != nIntensity )
			break;
	}
	if( k < 0 )
		return ITS_NOTHING;
	for( k=k+1; k<=nIndex; k++ )
	{
		if( nIntensity > 1 )
			nIntensity	--;
		else if( nIntensity < -1  )
			nIntensity	++;
		else
			break;
	}
	if( pnCode )	*pnCode	=	nCode;
	return nIntensity;
}
Пример #9
0
TDSPSignal* TDSPAwgn::Update(TDSPSignal *input) {

  // !! This we have to change later on !!
  // 
  Reset();
  
  
  // Add the Noise
  //
  
  fInEnergy     += input->Energy();

  TDSPSignal *output=GetSignal();
  output->Configure(input);
  output->RandNC(input,fNoiseLevel*TMath::Sqrt(input->GetSamplingRate())); // that is sigma^2_n = sigma^2_N / epsilon


  // Update the Output Signal Energy
  //
  
  fEnergy       += output->Energy(); // that is x^*x * epsilon
  fTime         += output->GetTime(); // that is N * epsilon 
  

  Emit(Signal_NewData,output);

  return output;

}
Пример #10
0
Value Object_BBox::DoSetProp(Environment &env, const Symbol *pSymbol, const Value &value,
							const SymbolSet &attrs, bool &evaluatedFlag)
{
	Signal &sig = GetSignal();
	evaluatedFlag = true;
	if (pSymbol->IsIdentical(Gura_UserSymbol(xMin))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_bbox.xMin = static_cast<FT_Pos>(value.GetLong());
		return Value(_bbox.xMin);
	} else if (pSymbol->IsIdentical(Gura_UserSymbol(yMin))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_bbox.yMin = static_cast<FT_Pos>(value.GetLong());
		return Value(_bbox.yMin);
	} else if (pSymbol->IsIdentical(Gura_UserSymbol(xMax))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_bbox.xMax = static_cast<FT_Pos>(value.GetLong());
		return Value(_bbox.xMax);
	} else if (pSymbol->IsIdentical(Gura_UserSymbol(yMax))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_bbox.yMax = static_cast<FT_Pos>(value.GetLong());
		return Value(_bbox.yMax);
	}
	evaluatedFlag = false;
	return Value::Nil;
}
Пример #11
0
bool Object_content::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_UserSymbol(images));
	return true;
}
Пример #12
0
void TAbstractTextBox::SetText(const TextString& value) {
    if (text->GetText() != value) {
        text->SetText(value);
        _OnTextChanged();
        GetSignal(DefaultSignalID::ObjectTextChanged).Send();
    }
}
Пример #13
0
	void MpClientSetupUi::initWindow() {
		window->SetStyle(Style::Fullscreen);
		window->SetRequisition(Vector2f((float)ct::WindowWidth, (float)ct::WindowHeight));

		mainBox = Box::Create(Box::Orientation::VERTICAL, 5);
		auto closeButton = Button::Create("Close");
		closeButton->GetSignal(Widget::OnLeftClick).Connect(backAction);
		mainBox->Pack(createAlignment(closeButton, Vector2f(0.0f, 0.0f), Vector2f(1.0f, 0.0f)));

		nameEntry = Entry::Create("Player 1");
		nameEntry->SetMaximumLength(10);

		auto nameFrame = Frame::Create("Your name:");
		nameFrame->Add(nameEntry);
		nameFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.3f));
		mainBox->Pack(createAlignment(nameFrame, Vector2f(0.5f, 0.0f), Vector2f(1.0f, 0.0f)));

		serverBox = Box::Create(Box::Orientation::VERTICAL, 5);
		auto serverFrame = Frame::Create("Avaliable servers:");
		serverFrame->Add(serverBox);
		serverFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.5f));

		mainBox->Pack(serverFrame, true, true);
		window->Add(createAlignment(mainBox, Vector2f(0.5f, 0.5f), Vector2f(0.9f, 0.9f)));
	}
Пример #14
0
void MpHostSetupUi::createServer() {
    string name = nameEntry->GetText();
    if (name.empty()) {
        return;
    }
    nameEntry = nullptr;

    nameFrame->RemoveAll();
    auto nameLabel = Label::Create(name);
    nameLabel->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.05f));
    nameLabel->SetAlignment(Vector2f(0.5f, 0.5f));
    nameFrame->Add(createAlignment(nameLabel, Vector2f(0.5f, 0.5f), Vector2f(0.0f, 0.0f)));


    mainBox->Pack(Label::Create("Waiting for players..."), false, false);
    playerBox = Box::Create(Box::Orientation::VERTICAL, 5);

    auto playerFrame = Frame::Create("Currently connected:");
    playerFrame->SetRequisition(Vector2f(0.0f, ct::WindowHeight * 0.5f));
    playerFrame->Add(playerBox);

    mainBox->Pack(playerFrame, true, true);

    auto startButton = Button::Create("Start game!");
    startButton->GetSignal(Widget::OnLeftClick).Connect(startGameAction);

    mainBox->Pack(startButton, false, false);

    createServerAction(name);
}
Пример #15
0
bool Object_Vector::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_Symbol(x));
	symbols.insert(Gura_Symbol(y));
	return true;
}
Пример #16
0
bool Object_mpq::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_Symbol(numer));
	symbols.insert(Gura_Symbol(denom));
	return true;
}
Пример #17
0
	void MpClientSetupUi::addServer(string name) {
		auto serverButton = Button::Create(name);
		serverButton->GetSignal(Widget::OnLeftClick).Connect(
			bind(&MpClientSetupUi::selectServer, this, serverCount));
		serverCount++;

		serverBox->Pack(serverButton);
	}
Пример #18
0
std::string CGovernanceVote::ToString() const
{
    std::ostringstream ostr;
    ostr << masternodeOutpoint.ToStringShort() << ":"
         << nTime << ":"
         << CGovernanceVoting::ConvertOutcomeToString(GetOutcome()) << ":"
         << CGovernanceVoting::ConvertSignalToString(GetSignal());
    return ostr.str();
}
Пример #19
0
void TWidget::_handle_mouseButtonReleased(
    const TEvent_MouseClick& event, bool& consume
) {
    consume = false;

    if (IsVisible() == false) {
        return;
    }

    if (clicked == true) {
        if ((mouseOver == true) && (_isMouseOverChild() == false)) {
            _OnClick();
            GetSignal(DefaultSignalID::MouseClick).Send();
        }

        _OnMouseButtonUp(event);
        GetSignal(DefaultSignalID::MouseButtonUp).Send(&event);
    }
}
Пример #20
0
bool Object_DisplayMode::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_UserSymbol(format));
	symbols.insert(Gura_UserSymbol(w));
	symbols.insert(Gura_UserSymbol(h));
	symbols.insert(Gura_UserSymbol(refresh_rate));
	return true;
}
Пример #21
0
bool Object_BBox::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_UserSymbol(xMin));
	symbols.insert(Gura_UserSymbol(yMin));
	symbols.insert(Gura_UserSymbol(xMax));
	symbols.insert(Gura_UserSymbol(yMax));
	return true;
}
Пример #22
0
bool Object_FTC_Manager::DoDirProp(Environment &env, SymbolSet &symbols)
{
    Signal &sig = GetSignal();
    if (!Object::DoDirProp(env, symbols)) return false;
#if 0
    symbols.insert(Gura_Symbol(x));
    symbols.insert(Gura_Symbol(y));
#endif
    return true;
}
Пример #23
0
//_________________________________________________________________________________
void KVFAZIADetector::SetSignal(KVSignal* signal,const Char_t* type)
{	
	if (!fSignals)	
   	return;
	
   KVSignal* sig = GetSignal(type);
   if (sig)
   	sig->SetData(signal->GetN(),signal->GetX(),signal->GetY());
   else
   	Warning("SetSignal","%s : No signal of type %s is available",GetName(),type);   
}
Пример #24
0
void CustomWidget::Run() {
	// Create SFML's window.
	sf::RenderWindow render_window( sf::VideoMode( SCREEN_WIDTH, SCREEN_HEIGHT ), "Custom Widget" );

	// Create our custom widget.
	m_custom_widget = MyCustomWidget::Create( "Custom Text" );

	// Create a simple button and connect the click signal.
	auto button = sfg::Button::Create( "Button" );
	button->GetSignal( sfg::Widget::OnLeftClick ).Connect( std::bind( &CustomWidget::OnButtonClick, this ) );

	// Create a vertical box layouter with 5 pixels spacing and add our custom widget and button
	// and button to it.
	auto box = sfg::Box::Create( sfg::Box::Orientation::VERTICAL, 5.0f );
	box->Pack( m_custom_widget );
	box->Pack( button, false );

	// Create a window and add the box layouter to it. Also set the window's title.
	auto window = sfg::Window::Create();
	window->SetTitle( "Custom Widget" );
	window->Add( box );

	// Create a desktop and add the window to it.
	sfg::Desktop desktop;
	desktop.Add( window );

	// We're not using SFML to render anything in this program, so reset OpenGL
	// states. Otherwise we wouldn't see anything.
	render_window.resetGLStates();

	// Main loop!
	sf::Event event;
	sf::Clock clock;

	while( render_window.isOpen() ) {
		// Event processing.
		while( render_window.pollEvent( event ) ) {
			desktop.HandleEvent( event );

			// If window is about to be closed, leave program.
			if( event.type == sf::Event::Closed ) {
				render_window.close();
			}
		}

		// Update SFGUI with elapsed seconds since last call.
		desktop.Update( clock.restart().asSeconds() );

		// Rendering.
		render_window.clear();
		m_sfgui.Display( render_window );
		render_window.display();
	}
}
Пример #25
0
bool Object_GlyphSlot::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_UserSymbol(advance));
	symbols.insert(Gura_UserSymbol(format));
	symbols.insert(Gura_UserSymbol(bitmap));
	symbols.insert(Gura_UserSymbol(bitmap_left));
	symbols.insert(Gura_UserSymbol(bitmap_top));
	symbols.insert(Gura_UserSymbol(outline));
	return true;
}
Пример #26
0
void IHM::packFile(File f_)
{
    auto box = sfg::Box::Create( sfg::Box::Orientation::HORIZONTAL, 50.f);
    box->Pack( sfg::Label::Create( f_.getFilename() ), true, true );
    box->Pack( sfg::Label::Create( f_.getFilepath() ), true, true );
    auto button = sfg::Button::Create( L"Load" );
    //auto funct = std::bind( &IHM::OnLoadMusicBtnClick, f_.getFilename());
    auto funct = std::bind(&IHM::OnLoadMusicBtnClick,this, f_.getFilename());//need to try this
    button->GetSignal( sfg::Widget::OnLeftClick ).Connect( funct );
    box->Pack( button, false );
    _listFiles->Pack( box, false);
Пример #27
0
void TWidget::SetPosition(const TCoordinate& temp) {
    TCoordinate value(
        std::max(0.f, temp.x),
        std::max(0.f, temp.y)
    );

    if (position != value) {
        position = std::move(value);
        _checkBorders();
        _OnPositionChanged();
        GetSignal(DefaultSignalID::ObjectPositionChanged).Send();
    }
}
Пример #28
0
bool Object_AudioCVT::DoDirProp(Environment &env, SymbolSet &symbols)
{
	Signal &sig = GetSignal();
	if (!Object::DoDirProp(env, symbols)) return false;
	symbols.insert(Gura_UserSymbol(needed));
	symbols.insert(Gura_UserSymbol(src_format));
	symbols.insert(Gura_UserSymbol(dst_format));
	symbols.insert(Gura_UserSymbol(rate_incr));
	symbols.insert(Gura_UserSymbol(buf));
	symbols.insert(Gura_UserSymbol(len));
	symbols.insert(Gura_UserSymbol(len_cvt));
	symbols.insert(Gura_UserSymbol(len_mult));
	symbols.insert(Gura_UserSymbol(len_ratio));
	return true;
}
Пример #29
0
void TWidget::_handle_mouseButtonPressed(
    const TEvent_MouseClick& event, bool& consume
) {
    consume = false;

    if (IsVisible() == false) {
        return;
    }

    if ((mouseOver == true) && (_isMouseOverChild() == false)) {
        _OnMouseButtonDown(event);
        GetSignal(DefaultSignalID::MouseButtonDown).Send(&event);

        consume = true;
    }
}
Пример #30
0
Value Object_Vector::DoSetProp(Environment &env, const Symbol *pSymbol, const Value &value,
							const SymbolSet &attrs, bool &evaluatedFlag)
{
	Signal &sig = GetSignal();
	evaluatedFlag = true;
	if (pSymbol->IsIdentical(Gura_Symbol(x))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_pVector->x = static_cast<FT_Pos>(value.GetLong());
		return Value(_pVector->x);
	} else if (pSymbol->IsIdentical(Gura_Symbol(y))) {
		if (!value.MustBe_number(sig)) return Value::Nil;
		_pVector->y = static_cast<FT_Pos>(value.GetLong());
		return Value(_pVector->y);
	}
	evaluatedFlag = false;
	return Value::Nil;
}