created LoginWindow
renamed HelloWorld to UiTestMainWindow, enabling testing of UI components
This commit is contained in:
parent
9f62679393
commit
663ac89c7d
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: maroy $
|
||||||
# Version : $Revision: 1.2 $
|
# Version : $Revision: 1.3 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -103,7 +103,8 @@ LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} \
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Dependencies
|
# Dependencies
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
G_LIVESUPPORT_OBJS = ${TMP_DIR}/HelloWorld.o
|
G_LIVESUPPORT_OBJS = ${TMP_DIR}/UiTestMainWindow.o \
|
||||||
|
${TMP_DIR}/LoginWindow.o
|
||||||
|
|
||||||
|
|
||||||
G_LIVESUPPORT_EXE_OBJS = ${G_LIVESUPPORT_OBJS} \
|
G_LIVESUPPORT_EXE_OBJS = ${G_LIVESUPPORT_OBJS} \
|
||||||
|
|
|
@ -21,7 +21,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl Author : $Author: maroy $
|
dnl Author : $Author: maroy $
|
||||||
dnl Version : $Revision: 1.2 $
|
dnl Version : $Revision: 1.3 $
|
||||||
dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/configure.ac,v $
|
dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/configure.ac,v $
|
||||||
dnl-----------------------------------------------------------------------------
|
dnl-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ dnl-----------------------------------------------------------------------------
|
||||||
AC_INIT(gLiveSupport, 0.1, bugs@campware.org)
|
AC_INIT(gLiveSupport, 0.1, bugs@campware.org)
|
||||||
AC_PREREQ(2.59)
|
AC_PREREQ(2.59)
|
||||||
AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL])
|
AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL])
|
||||||
AC_REVISION($Revision: 1.2 $)
|
AC_REVISION($Revision: 1.3 $)
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR(../src/main.cxx)
|
AC_CONFIG_SRCDIR(../src/main.cxx)
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ AC_PROG_CXX()
|
||||||
AC_CHECK_HEADERS(sys/types.h unistd.h getopt.h signal.h sys/stat.h time.h)
|
AC_CHECK_HEADERS(sys/types.h unistd.h getopt.h signal.h sys/stat.h time.h)
|
||||||
AC_CHECK_HEADERS(stdio.h fcntl.h pthread.h sys/time.h)
|
AC_CHECK_HEADERS(stdio.h fcntl.h pthread.h sys/time.h)
|
||||||
|
|
||||||
PKG_CHECK_MODULES(GTKMM,[gtkmm-2.0 >= 2.2.0])
|
PKG_CHECK_MODULES(GTKMM,[gtkmm-2.4 >= 2.4.0])
|
||||||
AC_SUBST(GTKMM_CFLAGS)
|
AC_SUBST(GTKMM_CFLAGS)
|
||||||
AC_SUBST(GTKMM_LIBS)
|
AC_SUBST(GTKMM_LIBS)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,175 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "LoginWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Constructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
LoginWindow :: LoginWindow (void) throw ()
|
||||||
|
{
|
||||||
|
table.reset(new Gtk::Table(2, 2, false));
|
||||||
|
loginLabel.reset(new Gtk::Label("login:"));
|
||||||
|
passwordLabel.reset(new Gtk::Label("password:"));
|
||||||
|
loginEntry.reset(new Gtk::Entry());
|
||||||
|
passwordEntry.reset(new Gtk::Entry());
|
||||||
|
okButton.reset(new Gtk::Button("OK"));
|
||||||
|
|
||||||
|
// set up the login label
|
||||||
|
loginLabel->set_name("loginLabel");
|
||||||
|
loginLabel->set_alignment(0, 0.5);
|
||||||
|
loginLabel->set_padding(0, 0);
|
||||||
|
loginLabel->set_justify(Gtk::JUSTIFY_RIGHT);
|
||||||
|
loginLabel->set_line_wrap(false);
|
||||||
|
loginLabel->set_use_markup(false);
|
||||||
|
loginLabel->set_selectable(false);
|
||||||
|
|
||||||
|
// set up the password label
|
||||||
|
passwordLabel->set_name("passwordLabel");
|
||||||
|
passwordLabel->set_alignment(0, 0.5);
|
||||||
|
passwordLabel->set_padding(0, 0);
|
||||||
|
passwordLabel->set_justify(Gtk::JUSTIFY_RIGHT);
|
||||||
|
passwordLabel->set_line_wrap(false);
|
||||||
|
passwordLabel->set_use_markup(false);
|
||||||
|
passwordLabel->set_selectable(false);
|
||||||
|
|
||||||
|
// set up the login text entry area
|
||||||
|
loginEntry->set_name("loginEntry");
|
||||||
|
loginEntry->set_flags(Gtk::CAN_FOCUS|Gtk::HAS_FOCUS);
|
||||||
|
loginEntry->set_visibility(true);
|
||||||
|
loginEntry->set_editable(true);
|
||||||
|
loginEntry->set_max_length(0);
|
||||||
|
loginEntry->set_text("");
|
||||||
|
loginEntry->set_has_frame(true);
|
||||||
|
loginEntry->set_activates_default(true);
|
||||||
|
|
||||||
|
// set up the password text entry area
|
||||||
|
passwordEntry->set_name("passwordEntry");
|
||||||
|
passwordEntry->set_flags(Gtk::CAN_FOCUS);
|
||||||
|
passwordEntry->set_visibility(false);
|
||||||
|
passwordEntry->set_editable(true);
|
||||||
|
passwordEntry->set_max_length(0);
|
||||||
|
passwordEntry->set_text("");
|
||||||
|
passwordEntry->set_has_frame(true);
|
||||||
|
passwordEntry->set_activates_default(true);
|
||||||
|
|
||||||
|
// set up the OK button
|
||||||
|
okButton->set_name("okButton");
|
||||||
|
okButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT);
|
||||||
|
okButton->set_relief(Gtk::RELIEF_NORMAL);
|
||||||
|
// Register the signal handler for the button getting clicked.
|
||||||
|
okButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&LoginWindow::onOkButtonClicked));
|
||||||
|
|
||||||
|
// set up the table, which provides the layout, and place the widgets
|
||||||
|
// inside the table
|
||||||
|
table->set_name("table");
|
||||||
|
table->set_row_spacings(0);
|
||||||
|
table->set_col_spacings(0);
|
||||||
|
table->attach(*loginLabel,
|
||||||
|
0, 1, 0, 1,
|
||||||
|
Gtk::FILL, Gtk::AttachOptions(), 0, 0);
|
||||||
|
table->attach(*passwordLabel,
|
||||||
|
0, 1, 1, 2,
|
||||||
|
Gtk::FILL, Gtk::AttachOptions(), 0, 0);
|
||||||
|
table->attach(*loginEntry,
|
||||||
|
1, 2, 0, 1,
|
||||||
|
Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
|
||||||
|
table->attach(*passwordEntry,
|
||||||
|
1, 2, 1, 2,
|
||||||
|
Gtk::EXPAND|Gtk::FILL, Gtk::AttachOptions(), 0, 0);
|
||||||
|
table->attach(*okButton,
|
||||||
|
1, 2, 2, 3,
|
||||||
|
Gtk::FILL, Gtk::AttachOptions(), 0, 0);
|
||||||
|
|
||||||
|
// set up the window itself
|
||||||
|
set_name("loginWindow");
|
||||||
|
set_title("LiveSupport login");
|
||||||
|
set_modal(true);
|
||||||
|
property_window_position().set_value(Gtk::WIN_POS_NONE);
|
||||||
|
set_resizable(false);
|
||||||
|
property_destroy_with_parent().set_value(false);
|
||||||
|
set_default(*okButton);
|
||||||
|
|
||||||
|
// add the table to the window, and show everything
|
||||||
|
add(*table);
|
||||||
|
loginLabel->show();
|
||||||
|
passwordLabel->show();
|
||||||
|
loginEntry->show();
|
||||||
|
passwordEntry->show();
|
||||||
|
okButton->show();
|
||||||
|
table->show();
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Destructor.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
LoginWindow :: ~LoginWindow (void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
LoginWindow :: onOkButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
loginText.reset(new std::string(loginEntry->get_text()));
|
||||||
|
passwordText.reset(new std::string(passwordEntry->get_text()));
|
||||||
|
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Copyright (c) 2004 Media Development Loan Fund
|
||||||
|
|
||||||
|
This file is part of the LiveSupport project.
|
||||||
|
http://livesupport.campware.org/
|
||||||
|
To report bugs, send an e-mail to bugs@campware.org
|
||||||
|
|
||||||
|
LiveSupport is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
LiveSupport is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with LiveSupport; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Author : $Author: maroy $
|
||||||
|
Version : $Revision: 1.1 $
|
||||||
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef LoginWindow_h
|
||||||
|
#define LoginWindow_h
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
#error This is a C++ include file
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <gtkmm/window.h>
|
||||||
|
#include <gtkmm/button.h>
|
||||||
|
#include <gtkmm/label.h>
|
||||||
|
#include <gtkmm/entry.h>
|
||||||
|
#include <gtkmm/table.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
namespace LiveSupport {
|
||||||
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A window, handling user login.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
class LoginWindow : public Gtk::Window
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* The table, which provides the layout for the window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Table>::Ref table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login label in the window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref loginLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The password label in the window.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Label>::Ref passwordLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login text entry area.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Entry>::Ref loginEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The password text entry area.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Entry>::Ref passwordEntry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OK button.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref okButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login text, that was entered by the user.
|
||||||
|
*/
|
||||||
|
Ptr<std::string>::Ref loginText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The password text, that was entered by the user.
|
||||||
|
*/
|
||||||
|
Ptr<std::string>::Ref passwordText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the ok button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onOkButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
LoginWindow(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Virtual destructor.
|
||||||
|
*/
|
||||||
|
virtual
|
||||||
|
~LoginWindow(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the login entered by the user.
|
||||||
|
*
|
||||||
|
* @return the login entered by the user.
|
||||||
|
*/
|
||||||
|
Ptr<const std::string>::Ref
|
||||||
|
getLogin(void) const throw ()
|
||||||
|
{
|
||||||
|
return loginText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the password entered by the user.
|
||||||
|
*
|
||||||
|
* @return the password entered by the user.
|
||||||
|
*/
|
||||||
|
Ptr<const std::string>::Ref
|
||||||
|
getPassword(void) const throw ()
|
||||||
|
{
|
||||||
|
return passwordText;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ================================================= external data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace GLiveSupport
|
||||||
|
} // namespace LiveSupport
|
||||||
|
|
||||||
|
#endif // LoginWindow_h
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.1 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/HelloWorld.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "HelloWorld.h"
|
#include <gtkmm/main.h>
|
||||||
|
|
||||||
|
#include "LoginWindow.h"
|
||||||
|
#include "UiTestMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace LiveSupport::GLiveSupport;
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
@ -45,11 +48,6 @@ using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
/* ================================================ local constants & macros */
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
/**
|
|
||||||
* The Hello, World! string
|
|
||||||
*/
|
|
||||||
static std::string helloWorld("Hello, World!");
|
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -59,37 +57,66 @@ static std::string helloWorld("Hello, World!");
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
HelloWorld :: HelloWorld (void) throw ()
|
UiTestMainWindow :: UiTestMainWindow (void) throw ()
|
||||||
: button(helloWorld)
|
|
||||||
{
|
{
|
||||||
// Sets the border width of the window.
|
// set up the quit button
|
||||||
|
quitButton.reset(new Gtk::Button("quit"));
|
||||||
|
quitButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&UiTestMainWindow::onQuitButtonClicked));
|
||||||
|
|
||||||
|
// set up the login button
|
||||||
|
loginButton.reset(new Gtk::Button("loginWindow"));
|
||||||
|
loginButton->signal_clicked().connect(sigc::mem_fun(*this,
|
||||||
|
&UiTestMainWindow::onLoginButtonClicked));
|
||||||
|
|
||||||
|
// set up the layout, which is a button box
|
||||||
|
layout.reset(new Gtk::VButtonBox());
|
||||||
|
|
||||||
|
// set up the main window, and show everything
|
||||||
set_border_width(10);
|
set_border_width(10);
|
||||||
|
layout->add(*loginButton);
|
||||||
|
layout->add(*quitButton);
|
||||||
|
add(*layout);
|
||||||
|
|
||||||
// Register the signal handler for the button getting clicked.
|
// show everything
|
||||||
button.signal_clicked().connect(slot(*this, &HelloWorld::onButtonClicked));
|
loginButton->show();
|
||||||
|
quitButton->show();
|
||||||
// This packs the button into the Window (a container).
|
layout->show();
|
||||||
add(button);
|
show();
|
||||||
|
|
||||||
// The final step is to display this newly created widget...
|
|
||||||
button.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
HelloWorld :: ~HelloWorld (void) throw ()
|
UiTestMainWindow :: ~UiTestMainWindow (void) throw ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Event handler for the button getting clicked.
|
* Event handler for the quit getting clicked.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
HelloWorld :: onButtonClicked (void) throw ()
|
UiTestMainWindow :: onQuitButtonClicked (void) throw ()
|
||||||
{
|
{
|
||||||
std::cout << helloWorld << std::endl;
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Event handler for the login button getting clicked.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
UiTestMainWindow :: onLoginButtonClicked (void) throw ()
|
||||||
|
{
|
||||||
|
std::cout << "invoking loginWindow" << std::endl;
|
||||||
|
|
||||||
|
Ptr<LoginWindow>::Ref loginWindow(new LoginWindow());
|
||||||
|
|
||||||
|
Gtk::Main::run(*loginWindow);
|
||||||
|
|
||||||
|
std::cout << "login: " << *loginWindow->getLogin() << std::endl;
|
||||||
|
std::cout << "password: " << *loginWindow->getPassword() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,11 @@
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.1 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/HelloWorld.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
#ifndef HelloWorld_h
|
#ifndef UiTestMainWindow_h
|
||||||
#define HelloWorld_h
|
#define UiTestMainWindow_h
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#error This is a C++ include file
|
#error This is a C++ include file
|
||||||
|
@ -41,11 +41,16 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gtkmm/button.h>
|
#include <gtkmm/button.h>
|
||||||
|
#include <gtkmm/buttonbox.h>
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
namespace LiveSupport {
|
namespace LiveSupport {
|
||||||
namespace GLiveSupport {
|
namespace GLiveSupport {
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
|
|
||||||
/* ================================================================ constants */
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,38 +60,53 @@ namespace GLiveSupport {
|
||||||
/* =============================================================== data types */
|
/* =============================================================== data types */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple window, just saying "Hello, World!"
|
* A window, enabling interactive testing of UI components.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.1 $
|
* @version $Revision: 1.1 $
|
||||||
*/
|
*/
|
||||||
class HelloWorld : public Gtk::Window
|
class UiTestMainWindow : public Gtk::Window
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* The only button in the window.
|
* The layout used in the window.
|
||||||
*/
|
*/
|
||||||
Gtk::Button button;
|
Ptr<Gtk::VButtonBox>::Ref layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for the only button clicked.
|
* The to quit the applicaiton.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref quitButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The button invoking the LoginWindow.
|
||||||
|
*/
|
||||||
|
Ptr<Gtk::Button>::Ref loginButton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the quit button clicked.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void
|
||||||
onButtonClicked(void) throw ();
|
onQuitButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the login button clicked.
|
||||||
|
*/
|
||||||
|
virtual void
|
||||||
|
onLoginButtonClicked(void) throw ();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
HelloWorld(void) throw ();
|
UiTestMainWindow(void) throw ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual destructor.
|
* Virtual destructor.
|
||||||
*/
|
*/
|
||||||
virtual
|
virtual
|
||||||
~HelloWorld(void) throw ();
|
~UiTestMainWindow(void) throw ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,5 +119,5 @@ class HelloWorld : public Gtk::Window
|
||||||
} // namespace GLiveSupport
|
} // namespace GLiveSupport
|
||||||
} // namespace LiveSupport
|
} // namespace LiveSupport
|
||||||
|
|
||||||
#endif // HelloWorld_h
|
#endif // UiTestMainWindow_h
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -39,8 +39,11 @@
|
||||||
|
|
||||||
#include <gtkmm/main.h>
|
#include <gtkmm/main.h>
|
||||||
|
|
||||||
#include "HelloWorld.h"
|
#include "LiveSupport/Core/Ptr.h"
|
||||||
|
|
||||||
|
#include "UiTestMainWindow.h"
|
||||||
|
|
||||||
|
using namespace LiveSupport::Core;
|
||||||
using namespace LiveSupport::GLiveSupport;
|
using namespace LiveSupport::GLiveSupport;
|
||||||
|
|
||||||
/* =================================================== local data structures */
|
/* =================================================== local data structures */
|
||||||
|
@ -65,9 +68,10 @@ int main ( int argc,
|
||||||
{
|
{
|
||||||
Gtk::Main kit(argc, argv);
|
Gtk::Main kit(argc, argv);
|
||||||
|
|
||||||
HelloWorld helloworld;
|
Ptr<UiTestMainWindow>::Ref mainWindow(new UiTestMainWindow());
|
||||||
|
|
||||||
// Shows the window and returns when it is closed.
|
// Shows the window and returns when it is closed.
|
||||||
Gtk::Main::run(helloworld);
|
Gtk::Main::run(*mainWindow);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue