prettified the search window, as per #1477

This commit is contained in:
fgerlits 2005-10-13 15:47:00 +00:00
parent 198521e6df
commit beb9bbefd7
7 changed files with 205 additions and 23 deletions

View file

@ -148,7 +148,8 @@ WIDGETS_LIB_OBJS = ${TMP_DIR}/ImageButton.o \
${TMP_DIR}/Colors.o \
${TMP_DIR}/MessageWindow.o \
${TMP_DIR}/DialogWindow.o \
${TMP_DIR}/ScrolledWindow.o
${TMP_DIR}/ScrolledWindow.o \
${TMP_DIR}/ScrolledNotebook.o
TEST_EXE_OBJS = ${TMP_DIR}/TestWindow.o \
${TMP_DIR}/main.o

View file

@ -48,6 +48,7 @@
#include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Widgets/CornerImages.h"
#include "LiveSupport/Widgets/Button.h"
#include "LiveSupport/Widgets/ImageButton.h"
@ -307,7 +308,7 @@ class Notebook : public Gtk::Alignment
* @param widget the widget that is the page itself.
* @param label the label of the page.
*/
void
virtual void
appendPage(Gtk::Widget & widget,
const Glib::ustring & label) throw ();
};

View file

@ -0,0 +1,105 @@
/*------------------------------------------------------------------------------
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
#ifndef LiveSupport_Widgets_ScrolledNotebook_h
#define LiveSupport_Widgets_ScrolledNotebook_h
#ifndef __cplusplus
#error This is a C++ include file
#endif
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/Notebook.h"
namespace LiveSupport {
namespace Widgets {
/* ================================================================ constants */
/* =================================================================== macros */
/* =============================================================== data types */
/**
* A Widgets::Notebook subclass, which puts pages inside
* a Widgets::ScrolledWindow before appending them.
*
* @author $Author$
* @version $Revision$
*/
class ScrolledNotebook : public Notebook
{
public:
/**
* Constructor.
*/
ScrolledNotebook() throw ()
: Notebook()
{
}
/**
* A virtual destructor.
*/
virtual
~ScrolledNotebook(void) throw ()
{
}
/**
* Append a page to the notebook.
*
* @param widget the widget that is the page itself.
* @param label the label of the page.
*/
virtual void
appendPage(Gtk::Widget & widget,
const Glib::ustring & label) throw ();
};
/* ================================================= external data structures */
/* ====================================================== function prototypes */
} // namespace Widgets
} // namespace LiveSupport
#endif // LiveSupport_Widgets_ScrolledNotebook_h

View file

@ -47,8 +47,6 @@
namespace LiveSupport {
namespace Widgets {
using namespace LiveSupport::Core;
/* ================================================================ constants */

View file

@ -0,0 +1,67 @@
/*------------------------------------------------------------------------------
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$
Version : $Revision$
Location : $URL$
------------------------------------------------------------------------------*/
/* ============================================================ include files */
#ifdef HAVE_CONFIG_H
#include "configure.h"
#endif
#include "LiveSupport/Widgets/ScrolledWindow.h"
#include "LiveSupport/Widgets/ScrolledNotebook.h"
using namespace LiveSupport::Widgets;
/* =================================================== local data structures */
/* ================================================ local constants & macros */
/* =============================================== local function prototypes */
/* ============================================================= module code */
/*------------------------------------------------------------------------------
* Append a page to the notebook
*----------------------------------------------------------------------------*/
void
ScrolledNotebook :: appendPage(Gtk::Widget & widget,
const Glib::ustring & label) throw ()
{
ScrolledWindow * scrolledWindow = Gtk::manage(new ScrolledWindow);
scrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
scrolledWindow->add(widget);
Notebook::appendPage(*scrolledWindow, label);
}

View file

@ -80,10 +80,10 @@ AdvancedSearchItem :: AdvancedSearchItem(
pack_start(*searchByLabel, Gtk::PACK_SHRINK, 5);
metadataEntry = Gtk::manage(wf->createMetadataComboBoxText(metadataTypes));
pack_start(*metadataEntry, Gtk::PACK_EXPAND_WIDGET, 5);
pack_start(*metadataEntry, Gtk::PACK_SHRINK, 5);
operatorEntry = Gtk::manage(wf->createOperatorComboBoxText(bundle));
pack_start(*operatorEntry, Gtk::PACK_EXPAND_WIDGET, 5);
pack_start(*operatorEntry, Gtk::PACK_SHRINK, 5);
valueEntry = Gtk::manage(wf->createEntryBin());
pack_start(*valueEntry, Gtk::PACK_EXPAND_WIDGET, 5);

View file

@ -38,7 +38,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/Notebook.h"
#include "LiveSupport/Widgets/ScrolledNotebook.h"
#include "LiveSupport/Widgets/Button.h"
#include "LiveSupport/Widgets/ZebraTreeView.h"
#include "SearchWindow.h"
@ -74,18 +74,18 @@ SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
LocalizedObject(bundle),
gLiveSupport(gLiveSupport)
{
Gtk::Box * simpleSearchView = constructSimpleSearchView();
Gtk::Box * advancedSearchView = constructAdvancedSearchView();
Gtk::Box * browseView = constructBrowseView();
Gtk::Box * simpleSearchView = constructSimpleSearchView();
Gtk::Box * advancedSearchView = constructAdvancedSearchView();
Gtk::Box * browseView = constructBrowseView();
Notebook * views = Gtk::manage(new Notebook);
ScrolledNotebook * searchInput = Gtk::manage(new ScrolledNotebook);
try {
set_title(*getResourceUstring("windowTitle"));
views->appendPage(*simpleSearchView, *getResourceUstring(
searchInput->appendPage(*simpleSearchView, *getResourceUstring(
"simpleSearchTab"));
views->appendPage(*advancedSearchView, *getResourceUstring(
searchInput->appendPage(*advancedSearchView, *getResourceUstring(
"advancedSearchTab"));
views->appendPage(*browseView, *getResourceUstring(
searchInput->appendPage(*browseView, *getResourceUstring(
"browseTab"));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
@ -94,19 +94,23 @@ SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// set up the search results box
ZebraTreeView * searchResultsView = constructSearchResultsView();
Gtk::ScrolledWindow * scrolledWindow = Gtk::manage(new Gtk::ScrolledWindow);
scrolledWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
scrolledWindow->add(*searchResultsView);
Gtk::ScrolledWindow * searchResults = Gtk::manage(
new Gtk::ScrolledWindow);
searchResults->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
searchResults->add(*searchResultsView);
// set the sizes of the two parts of the window
searchInput ->set_size_request(750, 240);
searchResults->set_size_request(750, 300);
// put them in one big box
Gtk::VBox * bigBox = Gtk::manage(new Gtk::VBox);
bigBox->pack_start(*views, Gtk::PACK_SHRINK);
bigBox->pack_start(*scrolledWindow);
bigBox->pack_start(*searchInput, Gtk::PACK_SHRINK);
bigBox->pack_start(*searchResults);
add(*bigBox);
// show
set_name("searchWindow");
set_default_size(600, 500);
set_modal(false);
property_window_position().set_value(Gtk::WIN_POS_NONE);
@ -148,12 +152,18 @@ SearchWindow :: constructSimpleSearchView(void) throw ()
*this, &SearchWindow::onSimpleSearch ));
Gtk::HBox * entryBox = Gtk::manage(new Gtk::HBox);
entryBox->pack_start(*simpleSearchEntry, Gtk::PACK_SHRINK, 5);
entryBox->pack_start(*searchButton, Gtk::PACK_SHRINK, 5);
entryBox->pack_start(*simpleSearchEntry, Gtk::PACK_EXPAND_WIDGET, 5);
entryBox->pack_start(*searchButton, Gtk::PACK_SHRINK, 5);
// make the search entry + button take up 50% of the window horizontally
Gtk::Alignment * entryAlignment = Gtk::manage(new Gtk::Alignment(
0, 0, 0.5, 0));
entryAlignment->add(*entryBox);
// make a new box and pack the main components into it
Gtk::VBox * view = Gtk::manage(new Gtk::VBox);
view->pack_start(*entryBox, Gtk::PACK_EXPAND_WIDGET, 5);
view->pack_start(*entryAlignment, Gtk::PACK_SHRINK, 5);
return view;
}