Beispiel #1
0
void GenericEditor::buttonClicked(Button* button)
{

    std::cout << "Button clicked." << std::endl;

    checkDrawerButton(button);

    buttonEvent(button); // needed to inform subclasses of
    // button event
}
void ServerDriver::openvr_buttonEvent(uint32_t unWhichDevice, ButtonEventType eventType, vr::EVRButtonId eButtonId, double eventTimeOffset) {
	auto devicePtr = this->m_openvrIdToVirtualDeviceMap[unWhichDevice];
	if (devicePtr && devicePtr->deviceType() == VirtualDeviceType::TrackedController) {
		devicePtr->buttonEvent(eventType, eButtonId, eventTimeOffset);
	} else {
		if (_openvrIdToDeviceManipulationHandleMap[unWhichDevice] && _openvrIdToDeviceManipulationHandleMap[unWhichDevice]->isValid()) {
			_openvrIdToDeviceManipulationHandleMap[unWhichDevice]->ll_sendButtonEvent(eventType, eButtonId, eventTimeOffset);
		}
	}
}
Beispiel #3
0
void SceneBase::handleMousePressed(float mouse_x, float mouse_y){
	for(int i=0;i<_mbutton;++i) 
		if(_arr_button[i].isEnable()){
			if(_arr_button[i].checkClicked(mouse_x,mouse_y)){
				_source->_soundfx[_arr_button[i].getSoundType()].play();
				buttonEvent(_arr_button[i].getIndex());
				//ptr_app->playSound(arr_button[i].getSoundType());
			}
		}
}
Beispiel #4
0
void dlgHbaConfig::OnAddUser(wxCommandEvent &ev)
{
	int sel = cbUser->GetCurrentSelection();
	if (sel < 1)
		return;

	wxString newUser;

	wxString str = cbUser->GetString(sel);
	if (str.Left(6) == wxT("group "))
	{
		if (str.Find(' ', true) > 5)
			str = wxT("+\"") + str.Mid(6) + wxT("\"");
		else
			str = wxT("+") + str.Mid(6);
	}
	else
	{
		if (str.Find(' ') >= 0)
			str = wxT("\"") + str + wxT("\"");
	}

	if (user == wxT("all"))
		newUser = str;
	else
	{
		int pos = user.Find(str);
		if (pos >= 0)
		{
			if (pos > 0  && user.Mid(pos - 1, 1) != wxT(","))
				pos = -1;
			if (user.Length() > str.Length() + pos && user.Mid(pos + str.Length(), 1) != wxT(","))
				pos = -1;
		}

		if (pos < 0)
		{
			if (!user.IsEmpty())
				user += wxT(",");
			newUser = user + str;
		}
		else
			newUser = user;
	}

	wxTheApp->Yield(true);

	user = newUser;
	userAdding = true;
	wxCommandEvent buttonEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_REFRESH);
	AddPendingEvent(buttonEvent);
}
        void BitmapToggleButton::OnMouseDown(wxMouseEvent& event) {
            if (IsBeingDeleted()) return;

            if (!IsEnabled())
                return;
            
            m_state = !m_state;
            Refresh();
            
            wxCommandEvent buttonEvent(wxEVT_BUTTON, GetId());
            buttonEvent.SetEventObject(this);
            buttonEvent.SetInt(static_cast<int>(m_state));
            
            ProcessEvent(buttonEvent);
        }
//-------------------------------------------------------------------------
void ofxRfeUIImageButton::update(bool _bisClicked, ofPoint _mouse){
    
    bisClicked = _bisClicked;
    
    bool checkBool = buttonEvent(_mouse.x, _mouse.y);
    
    if (checkBool && bisClicked) {
        //ofSetColor(highlightColor);
        cout << "Button Clicked" << endl;
        bisHit = true;
    } else {
        //ofSetColor(buttonColor);
        bisHit = false;
        
    }
    
}
Beispiel #7
0
void dlgHbaConfig::OnAddDatabase(wxCommandEvent &ev)
{
	int sel = cbDatabase->GetCurrentSelection();
	if (sel < 3)
		return;

	wxString newDatabase;
	if (database == wxT("all") || database == wxT("sameuser") || database == wxT("samegroup")
	        || database == wxT("samerole") || database == wxT("replication") || database.Left(1) == wxT("@"))
		database = wxEmptyString;

	if (sel == 3)    // file
		newDatabase = wxT("@");
	else
	{
		wxString str = cbDatabase->GetString(sel);
		if (str.Find(' ') >= 0)
			str = wxT("\"") + str + wxT("\"");

		int pos = database.Find(str);
		if (pos >= 0)
		{
			if (pos > 0  && database.Mid(pos - 1, 1) != wxT(","))
				pos = -1;
			if (database.Length() > str.Length() + pos && database.Mid(pos + str.Length(), 1) != wxT(","))
				pos = -1;
		}
		if (pos < 0)
		{
			if (!database.IsEmpty())
				database += wxT(",");

			newDatabase = database + str;
		}
		else
			newDatabase = database;
	}

	wxTheApp->Yield(true);

	database = newDatabase;
	databaseAdding = true;
	wxCommandEvent buttonEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_REFRESH);
	AddPendingEvent(buttonEvent);
}
Beispiel #8
0
int main(int args, char* argv[]) {
	
	// initialisation composant graphique (cf gui.c)
	GUI gui;
	if (GUI_init(&gui) == -1) exit(-1);
	
	// Repeinte du fond d'écran
	FB_background(&gui, 0, 0, 0);
	
	// Recherche de la police
	char path[256]; // Dossier de recherche (doit contenir le « / » final !)
	if (args > 1) { // Si on a un arguments, on recherche dans ce dossier
		memcpy(path, argv[1], 256);
	} else { // Dossier par defaut si lancé sans arguments : /sdcard/
		memcpy(path, "/sdcard/", 256);
	}
	int size = 0; // Taille de la police
	if (getFont(path, &size) == -1) { // cf font.c
		printf("Impossible de trouver une police (dossier %s)\n", path);
		return -1;
	}
	printf("Font : %s, size : %i\n", path, size);
	// Enregistrement de la police et de la taille dans la structure gui pour utilisation lors de l'affichage
	gui.ip_size = size;
	gui.ip_font = path;
	
	// Police utilisé pour les labels de boutons, et l'affichage de la team
	FT_setFont(&gui, "/home/elie/FreeSans.ttf");
	// Ajout du bouton, avec un label utilisant la police précédement chargé
	// La fonction buttonEvent avec l'arguments &gui sera appelée sur les events (cf ts.c)
	TS_button* button = TS_addButton(&gui, 400, 222, 80, 50, "Retour", 16, -1, -1, buttonEvent, (void*)&gui);
	
	// Simulation d'un clic sur « Retour » pour afficher la page avec l'IP
	buttonEvent(button, 0, &gui);
	
	// Attente du thread d'interface graphique avant de quitter
	// (Dans les faits, le programme s'arrête là)
	pthread_join(gui.pth, NULL);
	FB_close(&gui);
	return 0;
}
Beispiel #9
0
// ---------------------------------------------------------------------
void Isigraph2::mouseMoveEvent(QMouseEvent *event)
{
  buttonEvent(QEvent::MouseMove, event);
}
Beispiel #10
0
// ---------------------------------------------------------------------
void Isigraph2::mousePressEvent(QMouseEvent *event)
{
  buttonEvent(QEvent::MouseButtonPress, event);
}
Beispiel #11
0
void Joystick::emitButtonEvent(int button, int value)
{
  emit buttonEvent(button, value);
}
Beispiel #12
0
void FakeMouse::buttonUp(int button)
{
   buttonEvent(button, ButtonRelease);
}
 void CallbackEventHandler::buttonEvent(Window *window, char event, bool pressed)
 {
     string dispatch_event;
     dispatch_event += event;
     buttonEvent(window, dispatch_event, pressed);
 }
Beispiel #14
0
void SpaceNavigatorPollingThread::run()
{
    m_stopped = false;
    if(spnav_open() == -1)
        return;

    qreal posfactor = 0.1;
    int currX = 0, currY = 0, currZ = 0;
    int currRX = 0, currRY = 0, currRZ = 0;
    Qt::MouseButtons buttons = Qt::NoButton;

    kDebug() << "started spacenavigator polling thread";
    while( ! m_stopped )
    {
        spnav_event event;

        if( spnav_poll_event( &event ) )
        {
            if( event.type == SPNAV_EVENT_MOTION )
            {
                /*
                 * The coordinate system of the space navigator is like the following:
                 * x-axis : from left to right
                 * y-axis : from down to up
                 * z-axis : from front to back
                 * We probably want to make sure that the x- and y-axis match Qt widget
                 * coordinate system:
                 * x-axis : from left to right
                 * y-axis : from back to front
                 * The z-axis would then go from up to down in a right handed coordinate system.
                 * z-axis : from up to down
                 */
                //kDebug() << "got motion event: t("<< event.motion.x << event.motion.y << event.motion.z << ") r(" << event.motion.rx << event.motion.ry << event.motion.rz << ")";
                currX = static_cast<int>( posfactor * event.motion.x );
                currY = -static_cast<int>( posfactor * event.motion.z );
                currZ = -static_cast<int>( posfactor * event.motion.y );
                currRX = static_cast<int>( posfactor * event.motion.rx );
                currRY = static_cast<int>( -posfactor * event.motion.rz );
                currRZ = static_cast<int>( -posfactor * event.motion.ry );
                emit moveEvent( currX, currY, currZ, currRX, currRY, currRZ, buttons );
            }
            else
            {
                /* SPNAV_EVENT_BUTTON */
                Qt::MouseButton button = event.button.bnum == 0 ? Qt::LeftButton : Qt::RightButton;
                KoDeviceEvent::Type type;
                if( event.button.press )
                {
                    //kDebug() << "got button press event b(" << event.button.bnum << ")";
                    buttons |= button;
                    type = KoDeviceEvent::ButtonPressed;
                }
                else
                {
                    //kDebug() << "got button release event b(" << event.button.bnum << ")";
                    buttons &= ~button;
                    type = KoDeviceEvent::ButtonReleased;
                }
                emit buttonEvent( currX, currY, currZ, currRX, currRY, currRZ, buttons, button, type );
            }
            spnav_remove_events( event.type );
        }
        msleep(10);
    }

    kDebug() << "finished spacenavigator polling thread";
}
Beispiel #15
0
void dbgPgThread::noticeHandler( void *arg, const char *message )
{
	// Remove the last char from the message as it'll be a \n
	wxString msg = wxString(message, wxConvUTF8);

	if (msg.EndsWith(wxT("\n")))
		msg.RemoveLast();

	wxLogInfo(wxT("%s"), msg.c_str());

	dbgPgThread    *thread = (dbgPgThread *)arg;
	wxEvtHandler *caller = thread->m_currentCommand->getCaller();

	if( strstr( message, "PLDBGBREAK" ))
	{
		wxStringTokenizer    tokens( wxString( message, wxConvUTF8 ), wxT( ":\n" ));

		wxString NOTICE     = tokens.GetNextToken();        // NOTICE:
		wxString PLDBGBREAK = tokens.GetNextToken();        // PLDBGBREAK:
		wxString PORT       = tokens.GetNextToken();        // port

		PGconn *conn = thread->m_owner.getConnection();

		// Create a dbgConnProp object that contains the same information in a
		// more convenient format

		dbgConnProp *debugProps = new dbgConnProp;

		debugProps->m_host         = wxString( PQhost( conn ), wxConvUTF8 );
		debugProps->m_database     = wxString( PQdb( conn ),   wxConvUTF8 );
		debugProps->m_userName     = wxString( PQuser( conn ), wxConvUTF8 );
		debugProps->m_debugPort = PORT;
		debugProps->m_port         = wxString( PQport( conn ), wxConvUTF8 );
		debugProps->m_password  = wxString( PQpass( conn ), wxConvUTF8 );

		wxCommandEvent buttonEvent( wxEVT_COMMAND_BUTTON_CLICKED, MENU_ID_SPAWN_DEBUGGER );
		buttonEvent.SetClientData((wxClientData *)debugProps );
		caller->AddPendingEvent( buttonEvent );
	}
	else if( strstr( message, "INFO" ))
	{
		if( strstr( message, "CONTEXT:" ) == NULL )
		{
			wxCommandEvent buttonEvent( wxEVT_COMMAND_BUTTON_CLICKED, MENU_ID_NOTICE_RECEIVED );

			wxString strippedMessage( wxString( message, wxConvUTF8 ));

			strippedMessage.Replace( wxT( "INFO:  " ), wxT( "" ), false );

			buttonEvent.SetString( strippedMessage );
			caller->AddPendingEvent( buttonEvent );
		}
	}
	else
	{
		wxCommandEvent buttonEvent( wxEVT_COMMAND_BUTTON_CLICKED, MENU_ID_NOTICE_RECEIVED );

		buttonEvent.SetString( wxString( message, wxConvUTF8 ) );
		caller->AddPendingEvent( buttonEvent );
	}
}
Beispiel #16
0
// ---------------------------------------------------------------------
void Isigraph2::mouseDoubleClickEvent(QMouseEvent *event)
{
  buttonEvent(QEvent::MouseButtonDblClick, event);
}
Beispiel #17
0
// ---------------------------------------------------------------------
void Isigraph2::mouseReleaseEvent(QMouseEvent *event)
{
  buttonEvent(QEvent::MouseButtonRelease, event);
}
Beispiel #18
0
void FakeMouse::buttonDown(int button)
{
   buttonEvent(button, ButtonPress);
}