Adding widget inside a Gtk::Frame



I have some problem with a widget derived from Gtk::Frame

I have the following (header and source):

------- .hh ----------------------------------------

#include <gtkmm.h>
#include <string>

#ifndef DESK_WIDGET
#define DESK_WIDGET

class desk_widget : public Gtk::Frame {
public:
  desk_widget();
  desk_widget(const std::string& name);

  void set_name(const std::string& name);

private:
  Gtk::VBox desk_box;    // holds label area and graphic area
  Gtk::HBox label_box;   // holds desk indicator and desk label
  Gtk::DrawingArea desk_indicator; //
  Gtk::Label label;  // the desktop name label
  Gtk::Button desk;  // will become a special widget later on...
};

#endif //DESK_WIDGET

--------- .cc -----------------------------------------

#include <iostream>
#include "desk_widget.hh"

desk_widget::desk_widget()
{
  add(desk_box);
  label_box.pack_start(desk_indicator, Gtk::PACK_SHRINK);
  label_box.pack_end(label, Gtk::PACK_SHRINK);
  desk_box.pack_start(label_box, Gtk::PACK_SHRINK);
  desk_box.pack_end(desk, Gtk::PACK_SHRINK);

  label.set_label("Desk");
  desk.set_label("Test");
  show_all();
}

desk_widget::desk_widget(const std::string& name)
{
  desk_widget::desk_widget();
  set_name(name);
}

void
desk_widget::set_name(const std::string& name)
{
  std::cerr << "Setting desk label: " << name << std::endl;
  label.set_label(name);
  show_all();
}

-----------------------------------------------------------------

but only the frame shows up.
Do I need to add the outermost box as a managed widget? Or is something else dodgy? To me it seems this should work.

Would be thankful if someone has an idea of what's wrong...

//Marcus



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]