progress towards #1641

This commit is contained in:
fgerlits 2006-03-29 09:37:23 +00:00
parent 1f3673e635
commit 30ae7df047
5 changed files with 62 additions and 12 deletions

View file

@ -65,6 +65,18 @@ namespace Widgets {
*/ */
class ScrolledWindow : public Gtk::ScrolledWindow class ScrolledWindow : public Gtk::ScrolledWindow
{ {
private:
/**
* The shadow type of the child widget.
*/
Gtk::ShadowType shadowType;
/**
* Whether the shadow type has been manually set on the child widget.
*/
bool useShadowType;
protected: protected:
/** /**
* Handle the realize event. * Handle the realize event.
@ -84,6 +96,17 @@ class ScrolledWindow : public Gtk::ScrolledWindow
*/ */
virtual virtual
~ScrolledWindow(void) throw (); ~ScrolledWindow(void) throw ();
/**
* Set the shadow_type of the child widget.
* Must be called before the window is realized.
*/
void
setShadowType(Gtk::ShadowType st) throw ()
{
shadowType = st;
useShadowType = true;
}
}; };

View file

@ -34,6 +34,7 @@
#endif #endif
#include <iostream> #include <iostream>
#include <gtkmm/viewport.h>
#include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/ScrolledWindow.h" #include "LiveSupport/Widgets/ScrolledWindow.h"
@ -57,7 +58,8 @@ using namespace LiveSupport::Widgets;
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
ScrolledWindow :: ScrolledWindow(void) throw () ScrolledWindow :: ScrolledWindow(void) throw ()
: Gtk::ScrolledWindow() : Gtk::ScrolledWindow(),
useShadowType(false)
{ {
} }
@ -80,6 +82,13 @@ ScrolledWindow :: on_realize() throw ()
Widget * child = get_child(); Widget * child = get_child();
child->modify_bg(Gtk::STATE_NORMAL, bgColor); child->modify_bg(Gtk::STATE_NORMAL, bgColor);
if (useShadowType) {
Gtk::Viewport * viewport = dynamic_cast<Gtk::Viewport*>(child);
if (viewport) {
viewport->set_shadow_type(shadowType);
}
}
Gtk::ScrolledWindow::on_realize(); Gtk::ScrolledWindow::on_realize();
} }

View file

@ -37,7 +37,10 @@
#include <curl/easy.h> #include <curl/easy.h>
#include <gtkmm/filechooserdialog.h> #include <gtkmm/filechooserdialog.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
#include <gtkmm/paned.h>
#include <gtkmm/viewport.h>
#include "LiveSupport/Widgets/ScrolledWindow.h"
#include "BackupView.h" #include "BackupView.h"
@ -65,11 +68,14 @@ BackupView :: BackupView (Ptr<GLiveSupport>::Ref gLiveSupport,
: LocalizedObject(bundle), : LocalizedObject(bundle),
gLiveSupport(gLiveSupport) gLiveSupport(gLiveSupport)
{ {
Gtk::Box * criteriaView = constructCriteriaView(); Gtk::Box * criteriaView = constructCriteriaView();
Gtk::Box * backupListView = constructBackupListView(); Gtk::Box * backupListView = constructBackupListView();
pack_start(*criteriaView, Gtk::PACK_EXPAND_WIDGET, 5); Gtk::VPaned * twoPanedView = Gtk::manage(new Gtk::VPaned);
pack_start(*backupListView, Gtk::PACK_EXPAND_WIDGET, 5); twoPanedView->pack1(*criteriaView, Gtk::PACK_EXPAND_WIDGET, 5);
twoPanedView->pack2(*backupListView, Gtk::PACK_EXPAND_WIDGET, 5);
add(*twoPanedView);
} }
@ -100,9 +106,15 @@ BackupView :: constructCriteriaView(void) throw ()
Gtk::BUTTONBOX_END )); Gtk::BUTTONBOX_END ));
criteriaButtonBox->pack_start(*backupButton, Gtk::PACK_SHRINK, 5); criteriaButtonBox->pack_start(*backupButton, Gtk::PACK_SHRINK, 5);
ScrolledWindow * criteriaWindow = Gtk::manage(new ScrolledWindow);
criteriaWindow->add(*criteriaEntry);
// NOTE: criteriaWindow->setShadowType() causes Gtk warnings here
// TODO: find out why and fix it
criteriaWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
Gtk::Box * criteriaView = Gtk::manage(new Gtk::VBox); Gtk::Box * criteriaView = Gtk::manage(new Gtk::VBox);
criteriaView->pack_start(*criteriaEntry, Gtk::PACK_SHRINK, 5); criteriaView->pack_start(*criteriaWindow, Gtk::PACK_EXPAND_WIDGET, 0);
criteriaView->pack_start(*criteriaButtonBox, Gtk::PACK_SHRINK, 5); criteriaView->pack_start(*criteriaButtonBox, Gtk::PACK_SHRINK, 5);
return criteriaView; return criteriaView;
} }
@ -140,9 +152,14 @@ BackupView :: constructBackupListView(void) throw ()
backupListButtonBox->pack_start(*deleteButton, Gtk::PACK_SHRINK, 5); backupListButtonBox->pack_start(*deleteButton, Gtk::PACK_SHRINK, 5);
backupListButtonBox->pack_start(*saveButton, Gtk::PACK_SHRINK, 5); backupListButtonBox->pack_start(*saveButton, Gtk::PACK_SHRINK, 5);
ScrolledWindow * backupListWindow = Gtk::manage(new ScrolledWindow);
backupListWindow->add(*backupList);
backupListWindow->setShadowType(Gtk::SHADOW_NONE);
backupListWindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
Gtk::Box * backupListView = Gtk::manage(new Gtk::VBox); Gtk::Box * backupListView = Gtk::manage(new Gtk::VBox);
backupListView->pack_start(*backupList, Gtk::PACK_SHRINK, 5); backupListView->pack_start(*backupListWindow, Gtk::PACK_EXPAND_WIDGET, 5);
backupListView->pack_start(*backupListButtonBox, Gtk::PACK_SHRINK, 5); backupListView->pack_start(*backupListButtonBox, Gtk::PACK_SHRINK, 5);
return backupListView; return backupListView;
} }

View file

@ -65,7 +65,8 @@ using namespace LiveSupport::Widgets;
/* =============================================================== data types */ /* =============================================================== data types */
/** /**
* The backup view. This will be contained in another window, most likely * The backup view, a subclass of Gtk::VBox.
* This will be contained in another window, most likely
* as the contents of a notebook tab. * as the contents of a notebook tab.
* *
* The layout of the view is roughly the following: * The layout of the view is roughly the following:

View file

@ -160,7 +160,7 @@ OptionsWindow :: OptionsWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
// show everything // show everything
set_name(windowName); set_name(windowName);
set_default_size(500, 400); set_default_size(700, 400);
set_modal(false); set_modal(false);
property_window_position().set_value(Gtk::WIN_POS_NONE); property_window_position().set_value(Gtk::WIN_POS_NONE);