]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/gtk/GToolbar.h
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / gtk / GToolbar.h
index 01b82a44c4c6c346e0472136b6fc3fefb8fcaa45..414cd7a26ca2435b9636d5f7560b7d6d07466c0e 100644 (file)
@@ -5,57 +5,80 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Huang Ying
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef TOOLBAR_PIMPL_H
-#define TOOLBAR_PIMPL_H
+#ifndef GTOOLBAR_H
+#define GTOOLBAR_H
+
+#include "frontends/Toolbars.h"
 
 #include <gtkmm.h>
-#include "frontends/Toolbar.h"
-#include "ToolbarBackend.h"
 
+#include <boost/scoped_ptr.hpp>
 
-class GToolbar : public Toolbar, public SigC::Object
-{
-public:
-       GToolbar(LyXView * o, int x, int y);
+namespace lyx {
+namespace frontend {
 
-       ~GToolbar();
+class GView;
 
-       // add a new toolbar
-       void add(ToolbarBackend::Toolbar const & tb);
+class stringcolumns : public Gtk::TreeModel::ColumnRecord {
+public:
+       stringcolumns()
+       {
+               add(name);
+       }
 
-       /// add a new button to the toolbar.
-       void add(Gtk::Toolbar * toolbar,
-                ToolbarBackend::Item const & item);
+       Gtk::TreeModelColumn<Glib::ustring> name;
+};
 
-       /// display toolbar, not implemented
-       void displayToolbar(ToolbarBackend::Toolbar const & tb, bool show);
 
-       /// update the state of the icons
+class GLayoutBox: public LayoutBox, public sigc::trackable {
+public:
+       GLayoutBox(LyXView &, Gtk::Toolbar &, FuncRequest const &);
+
+       /// select the right layout in the combox.
+       void set(std::string const & layout);
+       /// Populate the layout combox.
        void update();
+       /// Erase the layout list.
+       void clear();
+       /// Display the layout list.
+       void open();
+       ///
+       void setEnabled(bool);
+private:
+       ///
+       void selected();
 
-       /// select the right layout in the combox
-       void setLayout(std::string const & layout);
+       Gtk::ComboBox combo_;
+       Glib::RefPtr<Gtk::ListStore> model_;
+       stringcolumns cols_;
 
-       /// Populate the layout combox; re-do everything if force is true.
-       void updateLayoutList();
+       LyXView & owner_;
+       bool internal_;
+};
 
-       /// Drop down the layout list
-       void openLayoutList();
 
-       /// Erase the layout list
-       void clearLayoutList();
+class GToolbar : public Toolbar, public sigc::trackable {
+public:
+       GToolbar(ToolbarBackend::Toolbar const &, LyXView &);
+       void add(FuncRequest const & func, std::string const & tooltip);
+       void hide(bool);
+       void show(bool);
+       void update();
+       LayoutBox * layout() const { return layout_.get(); }
 private:
-       void onButtonClicked(FuncRequest);
-       void onLayoutSelected();
-       Gtk::VBox vbox_;
-       std::vector<Gtk::Toolbar*> toolbars_;
-       Gtk::Combo combo_;
-       LyXView * view_;
-       bool internal_;
+       void clicked(FuncRequest);
+
+       GView & owner_;
+       Gtk::Toolbar toolbar_;
+       boost::scoped_ptr<GLayoutBox> layout_;
 };
 
-#endif
+} // namespace frontend
+} // namespace lyx
+
+#endif // NOT GTOOLBAR_H