added audio clip and playlist icons in place of the "audioclip" and
"playlist" texts (see bug #1154)
This commit is contained in:
parent
c8159a7323
commit
2aed43ffe0
10 changed files with 150 additions and 66 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.23 $
|
||||
Version : $Revision: 1.24 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -92,7 +92,7 @@ class ZebraTreeView;
|
|||
* </code></pre>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.23 $
|
||||
* @version $Revision: 1.24 $
|
||||
*/
|
||||
class WidgetFactory :
|
||||
virtual public Configurable
|
||||
|
@ -123,7 +123,9 @@ class WidgetFactory :
|
|||
searchWindowTitleImage,
|
||||
liveModeWindowTitleImage,
|
||||
playlistsWindowTitleImage,
|
||||
schedulerWindowTitleImage }
|
||||
schedulerWindowTitleImage,
|
||||
audioClipIconImage,
|
||||
playlistIconImage }
|
||||
ImageType;
|
||||
|
||||
|
||||
|
@ -188,6 +190,12 @@ class WidgetFactory :
|
|||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf> comboBoxRightImage;
|
||||
|
||||
/**
|
||||
* A container holding the miscallenous image pixbuf references.
|
||||
*/
|
||||
std::map<ImageType, Glib::RefPtr<Gdk::Pixbuf> >
|
||||
imageTypePixbufs;
|
||||
|
||||
/**
|
||||
* The default constructor.
|
||||
*/
|
||||
|
@ -352,6 +360,14 @@ class WidgetFactory :
|
|||
return whiteWindowImages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a smart pointer to a Gdk::Pixbuf holding a named image.
|
||||
*
|
||||
* @return the image.
|
||||
*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
getPixbuf(ImageType imageName) throw ();
|
||||
|
||||
/**
|
||||
* Create and return a container holding an image.
|
||||
* It is the reponsibility of the caller to dispose of the created
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.13 $
|
||||
Version : $Revision: 1.14 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/include/LiveSupport/Widgets/ZebraTreeView.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -92,7 +92,7 @@ using namespace LiveSupport::Core;
|
|||
* 3) connected with a TreeModelColumn using set_renderer().
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.13 $
|
||||
* @version $Revision: 1.14 $
|
||||
*/
|
||||
class ZebraTreeView : public Gtk::TreeView
|
||||
{
|
||||
|
@ -162,6 +162,23 @@ class ZebraTreeView : public Gtk::TreeView
|
|||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Add an image column to the TreeView.
|
||||
*
|
||||
* @param title the title of the column
|
||||
* @param image the type of button this view will display
|
||||
* @param minimumWidth the minimum width of the column, in pixels
|
||||
* (optional)
|
||||
* @return the number of columns after adding this one
|
||||
*/
|
||||
int
|
||||
appendColumn(
|
||||
const Glib::ustring& title,
|
||||
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
|
||||
modelColumn,
|
||||
int minimumWidth = 0)
|
||||
throw ();
|
||||
|
||||
/**
|
||||
* Add a button column to the TreeView.
|
||||
*
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.26 $
|
||||
Version : $Revision: 1.27 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/WidgetFactory.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -268,6 +268,16 @@ static const std::string liveModeWindowTitleImageName
|
|||
static const std::string playlistsWindowTitleImageName
|
||||
= "titleImages/playlistsWindowTitle.png";
|
||||
|
||||
/**
|
||||
* The name of the image for the audio clip icon.
|
||||
*/
|
||||
static const std::string audioClipIconImageName = "icons/audioClipIcon.gif";
|
||||
|
||||
/**
|
||||
* The name of the image for the playlist icon.
|
||||
*/
|
||||
static const std::string playlistIconImageName = "icons/playlistIcon.gif";
|
||||
|
||||
/**
|
||||
* The name of the image for the title of the scheduler window.
|
||||
*/
|
||||
|
@ -367,6 +377,23 @@ WidgetFactory :: configure(const xmlpp::Element & element)
|
|||
|
||||
// load the white window corner images
|
||||
whiteWindowImages.reset(new CornerImages(path + whiteWindowPath));
|
||||
|
||||
// load the miscellaneous images
|
||||
imageTypePixbufs[resizeImage] = loadImage(resizeImageName);
|
||||
imageTypePixbufs[scratchpadWindowTitleImage]
|
||||
= loadImage(scratchpadWindowTitleImageName);
|
||||
imageTypePixbufs[searchWindowTitleImage]
|
||||
= loadImage(searchWindowTitleImageName);
|
||||
imageTypePixbufs[liveModeWindowTitleImage]
|
||||
= loadImage(liveModeWindowTitleImageName);
|
||||
imageTypePixbufs[playlistsWindowTitleImage]
|
||||
= loadImage(playlistsWindowTitleImageName);
|
||||
imageTypePixbufs[schedulerWindowTitleImage]
|
||||
= loadImage(schedulerWindowTitleImageName);
|
||||
imageTypePixbufs[audioClipIconImage]
|
||||
= loadImage(audioClipIconImageName);
|
||||
imageTypePixbufs[playlistIconImage]
|
||||
= loadImage(playlistIconImageName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -568,44 +595,22 @@ WidgetFactory :: createButton(ImageButtonType type) throw ()
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a resize image
|
||||
* Return a Gdk::Pixbuf reference to a named image
|
||||
*----------------------------------------------------------------------------*/
|
||||
Glib::RefPtr<Gdk::Pixbuf>
|
||||
WidgetFactory :: getPixbuf(ImageType imageName) throw ()
|
||||
{
|
||||
return imageTypePixbufs[imageName];
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Create a Gtk::Image
|
||||
*----------------------------------------------------------------------------*/
|
||||
Gtk::Image *
|
||||
WidgetFactory :: createImage(ImageType imageName) throw ()
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> rawImage;
|
||||
|
||||
switch (imageName) {
|
||||
|
||||
case resizeImage:
|
||||
rawImage = loadImage(resizeImageName);
|
||||
break;
|
||||
|
||||
case scratchpadWindowTitleImage:
|
||||
rawImage = loadImage(scratchpadWindowTitleImageName);
|
||||
break;
|
||||
|
||||
case searchWindowTitleImage:
|
||||
rawImage = loadImage(searchWindowTitleImageName);
|
||||
break;
|
||||
|
||||
case liveModeWindowTitleImage:
|
||||
rawImage = loadImage(liveModeWindowTitleImageName);
|
||||
break;
|
||||
|
||||
case playlistsWindowTitleImage:
|
||||
rawImage = loadImage(playlistsWindowTitleImageName);
|
||||
break;
|
||||
|
||||
case schedulerWindowTitleImage:
|
||||
rawImage = loadImage(schedulerWindowTitleImageName);
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new Gtk::Image(rawImage);
|
||||
return new Gtk::Image(getPixbuf(imageName));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.16 $
|
||||
Version : $Revision: 1.17 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ZebraTreeView.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -74,7 +74,7 @@ ZebraTreeView :: ~ZebraTreeView(void) throw ()
|
|||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a column to the TreeView.
|
||||
* Add a text column to the TreeView.
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
ZebraTreeView :: appendColumn(
|
||||
|
@ -87,8 +87,8 @@ ZebraTreeView :: appendColumn(
|
|||
Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText);
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
|
||||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// and then we associate this renderer with the model column
|
||||
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
|
||||
|
@ -107,6 +107,42 @@ ZebraTreeView :: appendColumn(
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add an image column to the TreeView.
|
||||
*----------------------------------------------------------------------------*/
|
||||
int
|
||||
ZebraTreeView :: appendColumn(
|
||||
const Glib::ustring& title,
|
||||
const Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > &
|
||||
modelColumn,
|
||||
int minimumWidth)
|
||||
throw ()
|
||||
{
|
||||
// a standard cell renderer; can be replaced with a ZebraCellRenderer
|
||||
Gtk::CellRendererPixbuf* renderer = Gtk::manage(
|
||||
new Gtk::CellRendererPixbuf );
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// and then we associate this renderer with the model column
|
||||
viewColumn->add_attribute(renderer->property_pixbuf(), modelColumn);
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
viewColumn->set_cell_data_func(
|
||||
*renderer,
|
||||
sigc::mem_fun(*this, &ZebraTreeView::cellDataFunction) );
|
||||
|
||||
// set the minimum width of the column
|
||||
if (minimumWidth) {
|
||||
viewColumn->set_min_width(minimumWidth);
|
||||
}
|
||||
|
||||
return append_column(*viewColumn);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Add a button column to the TreeView.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
@ -130,8 +166,8 @@ ZebraTreeView :: appendColumn(
|
|||
renderer->property_pixbuf() = passiveImage;
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
|
||||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
viewColumn->set_cell_data_func(
|
||||
|
@ -180,8 +216,8 @@ ZebraTreeView :: appendCenteredColumn(
|
|||
renderer->property_xalign() = 0.5;
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
|
||||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// and then we associate this renderer with the model column
|
||||
viewColumn->add_attribute(renderer->property_markup(), modelColumn);
|
||||
|
@ -217,8 +253,8 @@ ZebraTreeView :: appendLineNumberColumn(
|
|||
renderer->property_xalign() = 0.5;
|
||||
|
||||
// the constructor packs the renderer into the TreeViewColumn
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(new
|
||||
Gtk::TreeViewColumn(title, *renderer) );
|
||||
Gtk::TreeViewColumn* viewColumn = Gtk::manage(
|
||||
new Gtk::TreeViewColumn(title, *renderer) );
|
||||
|
||||
// this cell data function will do the blue-gray zebra stripes
|
||||
// and fill in the line number from the model.rowNumberColumn
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue