void StatusBarManager::addTextElement(const std::string& name, const std::string& icon, int pos) { // Get a free position int freePos = getFreePosition(pos); Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); if (!icon.empty()) { Gtk::Image* img = Gtk::manage(new Gtk::Image( GlobalUIManager().getLocalPixbuf(icon) )); hbox->pack_start(*img, false, false, 0); } Gtk::Label* label = Gtk::manage(new Gtk::Label); hbox->pack_start(*label, false, false, 0); StatusBarElementPtr element(new StatusBarElement(Gtk::manage(new gtkutil::FramedWidget(*hbox)), label)); // Store this element _elements.insert(ElementMap::value_type(name, element)); _positions.insert(PositionMap::value_type(freePos, element)); rebuildStatusBar(); }
void StatusBarManager::addElement(const std::string& name, wxWindow* widget, int pos) { // Get a free position int freePos = getFreePosition(pos); StatusBarElementPtr element(new StatusBarElement(widget)); // Store this element _elements.insert(ElementMap::value_type(name, element)); _positions.insert(PositionMap::value_type(freePos, element)); rebuildStatusBar(); }
void StatusBarManager::addTextElement(const std::string& name, const std::string& icon, int pos, const std::string& description) { // Get a free position int freePos = getFreePosition(pos); wxPanel* textPanel = new wxPanel(_statusBar, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSTATIC_BORDER | wxWANTS_CHARS); textPanel->SetSizer(new wxBoxSizer(wxHORIZONTAL)); textPanel->SetName("Statusbarconainer " + name); if (!description.empty()) { textPanel->SetToolTip(description); } if (!icon.empty()) { wxStaticBitmap* img = new wxStaticBitmap(textPanel, wxID_ANY, wxArtProvider::GetBitmap(LocalBitmapArtProvider::ArtIdPrefix() + icon)); textPanel->GetSizer()->Add(img, 0, wxEXPAND | wxALL, 1); } wxStaticText* label = new wxStaticText(textPanel, wxID_ANY, ""); textPanel->GetSizer()->Add(label, 1, wxEXPAND | wxALL, 1); if (!description.empty()) { label->SetToolTip(description); } StatusBarElementPtr element(new StatusBarElement(textPanel, label)); // Store this element _elements.insert(ElementMap::value_type(name, element)); _positions.insert(PositionMap::value_type(freePos, element)); rebuildStatusBar(); }