예제 #1
0
/*
* Defining the window procedure (= special function each window has to handle event messages)
* CALLBACK: 
*      -> will be called by the win32 API when a message from the message loop is dispatched to it
* WPARAM
*      -> 32 bit value; information depending on the message
* LPARAM
*      -> 32 bit-value; information depending on the message
*/
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
    case WM_LBUTTONDOWN:
        //MessageBox(0, "WM_LBUTTONDOWN message", "Msg", MB_OK);
        handleButtonDown();
        return 0;
        break;

    case WM_KEYDOWN:
        if(wParam == VK_ESCAPE) 
        {
            int youSrs = MessageBox(0, "Are you sure?" , "sure?", MB_YESNO);

            if(youSrs == IDYES)
            {
                // will send a WM_DESTROY message
                DestroyWindow(ghMainWnd);
            }
            return 0;
        }
        break;

    case WM_DESTROY:            // coming from clicking the "X"-Button or by calling DestroyWindow(HWND hwnd);
        PostQuitMessage(0);     // adds a WM_QUIT message to the message queue (parameter = exit code)
        return 0;

    }

    return DefWindowProc(hwnd, msg, wParam, lParam);        // passes message on to "default implementation"
}
예제 #2
0
OpenGUI::OpenGUI(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::OpenGUI)
{
    admin = new MediaControl();
    ui->setupUi(this);
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(handleButton()));
    connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(handleButtonPause()));
    connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(handleButtonUp()));
    connect(ui->pushButton_6, SIGNAL(clicked()), this, SLOT(handleButtonDown()));
}
예제 #3
0
AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
	QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
	Ui::AddClientDialog(),
	m_AddResult(kAddClientIgnore),
	m_IgnoreAutoConfigClient(false)
{
	setupUi(this);

	m_pLabelHead->setText("A client wants to connect. "
					"Please choose a location for " + clientName + ".");

	QIcon icon(":res/icons/64x64/video-display.png");
	QSize IconSize(32,32);

	m_pButtonLeft = new QPushButton(this);
	m_pButtonLeft->setIcon(icon);
	m_pButtonLeft->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonLeft, 2, 0, 1, 1, Qt::AlignCenter);
	connect(m_pButtonLeft, SIGNAL(clicked()), this, SLOT(handleButtonLeft()));

	m_pButtonUp = new QPushButton(this);
	m_pButtonUp->setIcon(icon);
	m_pButtonUp->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonUp, 1, 1, 1, 1, Qt::AlignCenter);
	connect(m_pButtonUp, SIGNAL(clicked()), this, SLOT(handleButtonUp()));

	m_pButtonRight = new QPushButton(this);
	m_pButtonRight->setIcon(icon);
	m_pButtonRight->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonRight, 2, 2, 1, 1, Qt::AlignCenter);
	connect(m_pButtonRight, SIGNAL(clicked()), this, SLOT(handleButtonRight()));

	m_pButtonDown = new QPushButton(this);
	m_pButtonDown->setIcon(icon);
	m_pButtonDown->setIconSize(IconSize);
	gridLayout->addWidget(m_pButtonDown, 3, 1, 1, 1, Qt::AlignCenter);
	connect(m_pButtonDown, SIGNAL(clicked()), this, SLOT(handleButtonDown()));

	m_pLabelCenter = new QLabel(this);
	m_pLabelCenter->setPixmap(QPixmap(":res/icons/64x64/video-display.png"));
	gridLayout->addWidget(m_pLabelCenter, 2, 1, 1, 1, Qt::AlignCenter);

#if defined(Q_OS_MAC)
	m_pDialogButtonBox->setLayoutDirection(Qt::RightToLeft);
#endif

	QPushButton* advanced = m_pDialogButtonBox->addButton("Advanced",
													QDialogButtonBox::HelpRole);
	connect(advanced, SIGNAL(clicked()), this, SLOT(handleButtonAdvanced()));
}