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> #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) : 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, HistoryLabel :: HistoryLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder) const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder) : QueueLabel(cobject, builder)
{ {
_builder->get_widget("history_size", history_size); _builder->get_widget("history_size", history_size);
} }
HistoryLabel :: ~HistoryLabel()
{
}
PlaylistLabel :: PlaylistLabel(BaseObjectType *cobject, PlaylistLabel :: PlaylistLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder) const Glib::RefPtr<Gtk::Builder> builder)
: Gtk::HBox(cobject), _builder(builder) : QueueLabel(cobject, builder)
{
}
PlaylistLabel :: ~PlaylistLabel()
{ {
} }
@ -44,13 +45,9 @@ PlaylistLabel :: ~PlaylistLabel()
TempLabel :: TempLabel(BaseObjectType *cobject, TempLabel :: TempLabel(BaseObjectType *cobject,
const Glib::RefPtr<Gtk::Builder> builder) 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_number", temp_number);
_builder->get_widget("temp_size", temp_size); _builder->get_widget("temp_size", temp_size);
_builder->get_widget("temp_close", temp_close); _builder->get_widget("temp_close", temp_close);
} }
TempLabel :: ~TempLabel()
{
}

View File

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