gui: Tab labels should inherit from common type

This allows me to pass a pointer to the generic type to be used by other
classes.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-04-16 14:50:21 -04:00
parent 1423fe2b6e
commit 343426ddc3
2 changed files with 29 additions and 38 deletions

View File

@ -4,39 +4,40 @@
#include <gui/queue/label.h>
CollectionLabel :: CollectionLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
QueueLabel :: QueueLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)
{
_builder->get_widget("collection_size", collection_size);
}
CollectionLabel :: ~CollectionLabel()
QueueLabel :: ~QueueLabel()
{
}
CollectionLabel :: CollectionLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: QueueLabel(cobject, builder)
{
_builder->get_widget("collection_size", collection_size);
}
HistoryLabel :: HistoryLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)
: QueueLabel(cobject, builder)
{
_builder->get_widget("history_size", history_size);
}
HistoryLabel :: ~HistoryLabel()
{
}
PlaylistLabel :: PlaylistLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)
{
}
PlaylistLabel :: ~PlaylistLabel()
const Glib::RefPtr<Gtk::Builder> builder)
: QueueLabel(cobject, builder)
{
}
@ -44,13 +45,9 @@ PlaylistLabel :: ~PlaylistLabel()
TempLabel :: TempLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder)
: QueueLabel(cobject, builder)
{
_builder->get_widget("temp_number", temp_number);
_builder->get_widget("temp_size", temp_size);
_builder->get_widget("temp_close", temp_close);
}
TempLabel :: ~TempLabel()
{
}

View File

@ -7,54 +7,48 @@
#include <gtkmm.h>
class CollectionLabel : public Gtk::HBox {
private:
class QueueLabel : public Gtk::HBox {
protected:
Glib::RefPtr<Gtk::Builder> _builder;
public:
QueueLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~QueueLabel();
};
class CollectionLabel : public QueueLabel {
public:
Gtk::Label *collection_size;
CollectionLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~CollectionLabel();
};
class HistoryLabel : public Gtk::HBox {
private:
Glib::RefPtr<Gtk::Builder> _builder;
class HistoryLabel : public QueueLabel {
public:
Gtk::Label *history_size;
HistoryLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~HistoryLabel();
};
class PlaylistLabel : public Gtk::HBox {
private:
Glib::RefPtr<Gtk::Builder> _builder;
class PlaylistLabel : public QueueLabel {
public:
PlaylistLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~PlaylistLabel();
};
class TempLabel : public Gtk::HBox {
private:
Glib::RefPtr<Gtk::Builder> _builder;
class TempLabel : public QueueLabel {
public:
Gtk::Label *temp_number;
Gtk::Label *temp_size;
Gtk::Button *temp_close;
TempLabel(BaseObjectType *, const Glib::RefPtr<Gtk::Builder>);
~TempLabel();
};
#endif /* OCARINA_GUI_QUEUE_LABEL_H */