}
-void GuiToolbar::focusCommandBuffer()
-{
- if (command_buffer_)
- command_buffer_->setFocus();
-}
-
-
Action * GuiToolbar::addItem(ToolbarItem const & item)
{
Action * act = new Action(owner_,
#ifndef GUITOOLBAR_H
#define GUITOOLBAR_H
+#include "GuiCommandBuffer.h"
+
#include "Session.h"
#include <QList>
namespace frontend {
-class GuiCommandBuffer;
-class GuiLayoutBox;
class GuiViewBase;
class Action;
/// Refresh the contents of the bar.
void updateContents();
GuiLayoutBox * layout() const { return layout_; }
- /// Set the focus on the command buffer, if any.
- void focusCommandBuffer();
+ ///
+ GuiCommandBuffer * commandBuffer() { return command_buffer_; }
Q_SIGNALS:
void updated();
layout_->setEnabled(enable);
}
+
+void GuiToolbars::showCommandBuffer(bool show_it)
+{
+ ToolbarsMap::const_iterator it = toolbars_.begin();
+ ToolbarsMap::const_iterator const end = toolbars_.end();
+ for (; it != end; ++it) {
+ GuiCommandBuffer * cb = it->second->commandBuffer();
+ if (!cb)
+ continue;
+ if (!show_it) {
+ it->second->hide();
+ return;
+ }
+ if (!it->second->isVisible())
+ it->second->show();
+ cb->setFocus();
+ return;
+ }
+}
+
} // namespace frontend
} // namespace lyx
/// Erase the layout list.
void clearLayoutList();
+ /// Show or hide the command buffer.
+ void showCommandBuffer(bool show_it);
+
+
private:
/// Add a new toolbar. if newline==true, start from a new line
void add(ToolbarInfo const & tbinfo, bool newline);
void GuiViewBase::showMiniBuffer(bool visible)
{
- d.toolbars_->display("minibuffer", visible);
-
- // FIXME: do something about command buffer focus.
-// if (t)
-// t->focusCommandBuffer();
+ d.toolbars_->showCommandBuffer(visible);
}