Esempio n. 1
0
RtPushButton* RtListBox::AddButton(RtPushButton* pButtonNew)
{
    if ( m_iItems >= __MAX_ITEMS__ )
	{
        return NULL;
	}
    m_iBoxHeight = pButtonNew->GetImageHeight();
    pButtonNew->setCheckable(true);

    connect(pButtonNew, SIGNAL(MousePress(int)),   this,       SLOT(MousePress(int)));
    connect(pButtonNew, SIGNAL(MoveInterval(int)), this,       SLOT(ScrollList(int)));
    connect(pButtonNew, SIGNAL(MouseRelease()),    this,       SLOT(MouseRelease()));
    connect(pButtonNew, SIGNAL(ButtonClick(int)),  this,       SLOT(ButtonClick(int)));
    connect(this,       SIGNAL(ButtonScroll()),    pButtonNew, SLOT(ButtonScroll()));

	//arrange item position
	pButtonNew->move(0, m_HeightUsed);
	m_HeightUsed += pButtonNew->height();
	//resize width to let mouse have reaction in all listbox
	pButtonNew->setMinimumWidth(this->width());
	//Add into list
	m_pButtonList[m_iItems] = pButtonNew;
	pButtonNew->SetListIndex(m_iItems);
	m_iItems++;
    return pButtonNew;
}
Esempio n. 2
0
void RtKeyboard::setupKeyboard09(void)
{
    QString strNumerText[__09_NUMS__] = {
        "1","2","3","4","5","6","7","8","9","0",
        "@","#","$","%","&","*","-","+","(",")",
        "!","\x22","'",":",";","/","?"
    };

    QPoint NumberPoints[__09_NUMS__] = {
        QPoint( 7,  7),QPoint(31, 7),QPoint(55,7),QPoint(79,7),QPoint(103,7),
        QPoint(127, 7),QPoint(151,7),QPoint(175,7),QPoint(199,7),QPoint(223,7),
        QPoint( 7,36),QPoint(31,36),QPoint(55,36),QPoint(79,36),QPoint(103,36),
        QPoint(127,36),QPoint(151,36),QPoint(175,36),QPoint(199,36),QPoint(223,36),
        QPoint(42,67),QPoint(66,67),QPoint(90,67),QPoint(114,67),QPoint(138,67),
        QPoint(162,67),QPoint(186,67)};

    QRect rectBtnText = QRect(5,8,15,16);

    //Key buttons
    for(int i=0;i<__09_NUMS__;i++)
    {
        m_pNumberButton[i] = new RtKeyButton(this,i);
        m_pNumberButton[i]->SetImages(&m_Key1[0],&m_Key1[0]);
        m_pNumberButton[i]->setGeometry(NumberPoints[i].x(),NumberPoints[i].y(),m_Key1[0].width(),m_Key1[0].height());
        m_pNumberButton[i]->setAlignStyle(RtKeyButton::AlignCenter);
        m_pNumberButton[i]->setButtonText(strNumerText[i],rectBtnText);
        connect(m_pNumberButton[i], SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(m_pNumberButton[i], strNumerText[i]);

        connect(m_pNumberButton[i], SIGNAL(MousePress(int,int)), this, SLOT(MousePress(int,int)));
        connect(m_pNumberButton[i], SIGNAL(MouseRelease()), this, SLOT(MouseRelease()));
        connect(m_pNumberButton[i], SIGNAL(ButtonClick(int)), this, SLOT(ButtonClick(int)));
    }
}
Esempio n. 3
0
void RtKeyboard::setupKeyboardAZ(void)
{
    QString strKeyText[__AZ_NUMS__] = {
        "Q","W","E","R","T","Y","U","I","O","P",
        "A","S","D","F","G","H","J","K","L",
        "Z","X","C","V","B","N","M"
    };

    QPoint keyPoints[__AZ_NUMS__] = {
        QPoint( 7,  7),QPoint(31, 7),QPoint(55,7),QPoint(79,7),QPoint(103,7),
        QPoint(127, 7),QPoint(151,7),QPoint(175,7),QPoint(199,7),QPoint(223,7),
        QPoint(18,36),QPoint(42,36),QPoint(66,36),QPoint(90,36),QPoint(114,36),
        QPoint(138,36),QPoint(162,36),QPoint(186,36),QPoint(210,36),QPoint(42,67),
        QPoint(66,67),QPoint(90,67),QPoint(114,67),QPoint(138,67),QPoint(162,67),
        QPoint(186,67)
    };
    QRect rectBtnText = QRect(5,8,15,15);

    //Key buttons
    for(int i=0;i<__AZ_NUMS__;i++)
    {
        m_pKeyButton[i] = new RtKeyButton(this,i);
        m_pKeyButton[i]->SetImages(&m_Key1[0],&m_Key1[0]);
        m_pKeyButton[i]->setGeometry(keyPoints[i].x(),keyPoints[i].y(),m_Key1[0].width(),m_Key1[0].height());
        m_pKeyButton[i]->setButtonText(strKeyText[i],rectBtnText);
        connect(m_pKeyButton[i], SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(m_pKeyButton[i], strKeyText[i]);
        m_pKeyButton[i]->show();

        connect(m_pKeyButton[i], SIGNAL(MousePress(int,int)), this, SLOT(MousePress(int,int)));
        connect(m_pKeyButton[i], SIGNAL(MouseRelease()), this, SLOT(MouseRelease()));
        connect(m_pKeyButton[i], SIGNAL(ButtonClick(int)), this, SLOT(ButtonClick(int)));
    }
}
Esempio n. 4
0
void CGadgetListBar::mouseReleaseEvent(QMouseEvent *event)
{
    Q_UNUSED(event)
	raise();
	QRect TabArea(TAB_AREA_X, TAB_AREA_Y, TAB_AREA_WIDTH, TAB_AREA_HEIGHT);

	if(!TabArea.contains(event->x(), event->y()))	//if mouse down is not under tab area,
	{
		if(m_timeLine->currentFrame() == FRAME_START_X)	//means closed
		{
			emit MouseRelease(event);
		}
		return;
	}

	if(m_timeLine->state() == QTimeLine::NotRunning)
	{
		if(this->pos().x() == FRAME_END_X)	//means opened
		{
			CloseBar();
		}
		else if(this->pos().x() == FRAME_START_X)	//means closed
		{
			OpenBar();
		}
	}
}
Esempio n. 5
0
bool List::HandleEventSelf(const SDL_Event& ev)
{
	switch (ev.type) {
		case SDL_MOUSEBUTTONDOWN: {
			if (gui->MouseOverElement(GetRoot(), ev.motion.x, ev.motion.y))
			{
				if(!hasFocus) {
					hasFocus = true;
					MouseMove(ev.motion.x, ev.motion.y, ev.motion.xrel, ev.motion.yrel, ev.motion.state);
				}
			}
			else {
				hasFocus = false;
			}
			if(MouseOver(ev.button.x, ev.button.y)) {
				if(hasFocus) {
					MousePress(ev.button.x, ev.button.y, ev.button.button);
					return true;
				}
			}
			break;
		}
		case SDL_MOUSEBUTTONUP: {
			if (!hasFocus)
				break;
			if (MouseOver(ev.button.x, ev.button.y) || activeScrollbar)
			{
				MouseRelease(ev.button.x, ev.button.y, ev.button.button);
				return true;
			}
			break;
		}
		case SDL_MOUSEMOTION: {
			if (!hasFocus)
				break;
			if (MouseOver(ev.button.x, ev.button.y) || activeScrollbar)
			{
				MouseMove(ev.motion.x, ev.motion.y, ev.motion.xrel, ev.motion.yrel, ev.motion.state);
				return true;
			}
			break;
		}
		case SDL_KEYDOWN: {
			if (!hasFocus)
				break;
			if(ev.key.keysym.sym == SDLK_ESCAPE)
			{
				hasFocus = false;
				break;
			}
			return KeyPressed(ev.key.keysym.sym, false);
		}
	}
	return false;
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
	MiscAppInit();
	if (SDL_Init(SDL_INIT_VIDEO) < 0) 
	{
		MiscTrace("Couldn't initialize SDL: %s\n",SDL_GetError());
		return 1;
	}
	MainFrameSetTitle(SSS_TITLE);
	s_screen = CanvasInit();
	MouseInit();
	KeyboardInit();
	s_screenArea.x = 0;
	s_screenArea.y = 0;
	s_screenArea.w = WINDOW_WIDTH;
	s_screenArea.h = WINDOW_HEIGHT;
	s_done = 0;
#if 0
	while (1) 
	{
		if(MainFrameGetMsg())
		{
			break;
		}
		{
			int k = 0;
			int width = WINDOW_WIDTH;
			int height = WINDOW_HEIGHT;
			CanvasLock();
			CanvasSetColor(CanvasRGB(0xff, 0, 0));
			CanvasMoveTo(0, 0);
			CanvasLineTo(width * 2, height * 2);
			for (k = height / 4; k < height / 2; k++)
			{
				CanvasSetPixel(width / 2, k, 
					CanvasRGB(0xff, 0, 0xff));
			}
			CanvasDrawLine(-width, height * 2, width * 2, -height, 
				CanvasRGB(0, 0, 0xff));
			CanvasUnlock();
			MainFrameRefresh();
		}
	}
#else
	ScriptRun();
#endif
	KeyboardRelease();
	MouseRelease();
	CanvasRelease();
	SDL_Quit();
	return 0;
}
Esempio n. 7
0
void RtKeyButton::mouseReleaseEvent(QMouseEvent *event)
{
    QPushButton::mouseReleaseEvent(event);
    emit MouseRelease();
}
Esempio n. 8
0
void RtKeyButton::leaveEvent ( QEvent*) ///*event*/
{
    emit MouseRelease();
}
Esempio n. 9
0
LRESULT CALLBACK WndProc(HWND hWnd, 
	UINT message, 
	WPARAM wParam, 
	LPARAM lParam)
{
	HDC hdc;
	switch(message)
	{
	case WM_COMMAND:
		{
			int wmId = LOWORD(wParam);
			/* int wmEvent = HIWORD(wParam); */
			switch (wmId)
			{
			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
			}
		}
		break;

	case WM_CREATE:
		s_hAppWnd = hWnd;
		SetWindowPos(hWnd, NULL, 0, 0, -1, -1, SWP_NOSIZE);
		s_hCanvas = CanvasInit(hWnd);
		MouseInit();
		KeyboardInit();
		break;
	
	case WM_DESTROY:
		KeyboardRelease();
		MouseRelease();
		CanvasRelease();
		PostQuitMessage(0);
		break;

	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			hdc = BeginPaint(hWnd, &ps);
			BitBlt(hdc,
				ps.rcPaint.left, ps.rcPaint.top,
				ps.rcPaint.right - ps.rcPaint.left, 
				ps.rcPaint.bottom - ps.rcPaint.top,
				s_hCanvas, 
				ps.rcPaint.left, ps.rcPaint.top, 
				SRCCOPY);
			EndPaint(hWnd, &ps);
		}
		break;

	case WM_KEYDOWN:
		{
			switch(wParam)
			{
			case VK_CONTROL:
				break;
			
			case VK_ESCAPE:
				break;
			}
		}
		break;

	case WM_CHAR:
		{
			int Key = (UINT)wParam;
			MiscTrace("WM_CHAR: %d\n", Key);
			KeyboardChar(Key);
		}
		break;

	case WM_MOUSEMOVE:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			//MiscTrace("WM_MOUSEMOVE: %d, %d\n", point.x, point.y);
			MouseMove(point.x, point.y);
		}
		break;

	case WM_LBUTTONDOWN:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			MiscTrace("WM_LBUTTONDOWN: %d, %d\n", point.x, point.y);
			MouseLButtonDown(point.x, point.y);
		}
		break;

	case WM_LBUTTONUP:
		{
			POINT point;
			point.x = LOWORD(lParam);
			point.y = HIWORD(lParam);
			MiscTrace("WM_LBUTTONUP: %d, %d\n", point.x, point.y);
			MouseLButtonUp(point.x, point.y);
		}
		break;

	default:
		return DefWindowProc(hWnd, message, wParam, lParam);
	}
	return 0;
}
Esempio n. 10
0
JNIEXPORT void JNICALL Java_JavaGL_mouseRelease( JNIEnv *env, jobject object )
{
	MouseRelease();
}
Esempio n. 11
0
void RtKeyboard::setupFuncKey(void)
{  
    QPoint FuncPoints[__FUN_NUMS__] = {
        QPoint(91,97),QPoint(7,67),QPoint(210,67),QPoint(8,97),QPoint(196,97),
        QPoint(58,97),QPoint(163,97)
    };

    // Func #0 -> Space Key
    QString strSpace = " ";
    QRect rectBtnText = QRect(0,0,0,0);
    m_pFuncButton[__FUN_KEY_0__] = new RtKeyButton(this,__FUN_KEY_0__);
    m_pFuncButton[__FUN_KEY_0__]->SetImages(&m_Key4[0],&m_Key4[0]);
    m_pFuncButton[__FUN_KEY_0__]->setGeometry(FuncPoints[__FUN_KEY_0__].x(),FuncPoints[__FUN_KEY_0__].y(),m_Key4[0].width(),m_Key4[0].height());
    m_pFuncButton[__FUN_KEY_0__]->setButtonText(strSpace,rectBtnText);
    connect(m_pFuncButton[__FUN_KEY_0__], SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(m_pFuncButton[__FUN_KEY_0__], strSpace);

    // Func #1 -> Switch ABC to abc Key
    m_pFuncButton[__FUN_KEY_1__] = new RtKeyButton(this,__FUN_KEY_1__);
    m_pFuncButton[__FUN_KEY_1__]->SetImages(&m_Key_Switch[0],&m_Key_Switch[0]);
    m_pFuncButton[__FUN_KEY_1__]->setGeometry(FuncPoints[__FUN_KEY_1__].x(),FuncPoints[__FUN_KEY_1__].y(),m_Key_Switch[0].width(),m_Key_Switch[0].height());
    connect(m_pFuncButton[__FUN_KEY_1__], SIGNAL(clicked()), this, SLOT(switchUpperLower()));

    // Func #2 -> Delete Key
    m_pFuncButton[__FUN_KEY_2__] = new RtKeyButton(this,__FUN_KEY_2__);
    m_pFuncButton[__FUN_KEY_2__]->SetImages(&m_Key_Del[0],&m_Key_Del[0]);
    m_pFuncButton[__FUN_KEY_2__]->setGeometry(FuncPoints[__FUN_KEY_2__].x(),FuncPoints[__FUN_KEY_2__].y(),m_Key_Del[0].width(),m_Key_Del[0].height());
    connect(m_pFuncButton[__FUN_KEY_2__], SIGNAL(clicked()), this, SIGNAL(backspace()));

    // Func #3 -> Switch between ABC and 123 Key
    QString strFun3 = "?123";
    QRect rectFun3 = QRect(8,6,35,16);

    m_pFuncButton[__FUN_KEY_3__] = new RtKeyButton(this,__FUN_KEY_3__);
    m_pFuncButton[__FUN_KEY_3__]->SetImages(&m_Key7[0],&m_Key7[0]);
    m_pFuncButton[__FUN_KEY_3__]->setGeometry(FuncPoints[__FUN_KEY_3__].x(),FuncPoints[__FUN_KEY_3__].y(),m_Key7[0].width(),m_Key7[0].height());
    m_pFuncButton[__FUN_KEY_3__]->setButtonText(strFun3,rectFun3);
    connect(m_pFuncButton[__FUN_KEY_3__], SIGNAL(clicked()), this, SLOT(switchAZ09()));

    // Func #4 -> Enter Key
    m_pFuncButton[__FUN_KEY_4__] = new RtKeyButton(this,__FUN_KEY_4__);
    m_pFuncButton[__FUN_KEY_4__]->SetImages(&m_Key_Enter[0],&m_Key_Enter[0]);
    m_pFuncButton[__FUN_KEY_4__]->setGeometry(FuncPoints[__FUN_KEY_4__].x(),FuncPoints[__FUN_KEY_4__].y(),m_Key_Enter[0].width(),m_Key_Enter[0].height());

  // Func #5 -> "," Key
    QString strFun5 = ",";
    QRect rectFun5 = QRect(8,6,20,16);

    m_pFuncButton[__FUN_KEY_5__] = new RtKeyButton(this,__FUN_KEY_5__);
    m_pFuncButton[__FUN_KEY_5__]->SetImages(&m_Key3[0],&m_Key3[0]);
    m_pFuncButton[__FUN_KEY_5__]->setGeometry(FuncPoints[__FUN_KEY_5__].x(),FuncPoints[__FUN_KEY_5__].y(),m_Key3[0].width(),m_Key3[0].height());
    m_pFuncButton[__FUN_KEY_5__]->setButtonText(strFun5,rectFun5);
    m_pFuncButton[__FUN_KEY_5__]->show();
    connect(m_pFuncButton[__FUN_KEY_5__], SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(m_pFuncButton[__FUN_KEY_5__], strFun5);

  // Func #6 -> "." Key
    QString strFun6 = ".";
    QRect rectFun6 = QRect(8,6,20,16);

    m_pFuncButton[__FUN_KEY_6__] = new RtKeyButton(this,__FUN_KEY_6__);
    m_pFuncButton[__FUN_KEY_6__]->SetImages(&m_Key3[0],&m_Key3[0]);
    m_pFuncButton[__FUN_KEY_6__]->setGeometry(FuncPoints[__FUN_KEY_6__].x(),FuncPoints[__FUN_KEY_6__].y(),m_Key3[0].width(),m_Key3[0].height());
    m_pFuncButton[__FUN_KEY_6__]->setButtonText(strFun6,rectFun6);
    connect(m_pFuncButton[__FUN_KEY_6__], SIGNAL(clicked()), signalMapper, SLOT(map()));
    signalMapper->setMapping(m_pFuncButton[__FUN_KEY_6__], strFun6);

    for(int i=0;i<__FUN_NUMS__;i++)
    {
        m_pFuncButton[i]->show();
        connect(m_pFuncButton[i], SIGNAL(MousePress(int,int)), this, SLOT(MouseFuncPress(int,int)));
        connect(m_pFuncButton[i], SIGNAL(MouseRelease()), this, SLOT(MouseRelease()));
//        connect(m_pKeyButton[i], SIGNAL(ButtonClick(int)), this, SLOT(ButtonClick(int)));
    }
}