2007-11-30 15:04:01 +00:00
|
|
|
#ifndef SIDEBARTOOLBOX_H_
|
|
|
|
#define SIDEBARTOOLBOX_H_
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2007-12-04 21:35:01 +00:00
|
|
|
#include <map>
|
2007-11-30 15:04:01 +00:00
|
|
|
#include <list>
|
2007-12-04 21:35:01 +00:00
|
|
|
#include "EditManager.h"
|
2007-11-30 15:04:01 +00:00
|
|
|
#include "Sidebar.h"
|
|
|
|
#include "Tool.h"
|
2007-12-05 18:34:01 +00:00
|
|
|
#include "ToolSelector.h"
|
2007-11-30 15:04:01 +00:00
|
|
|
|
2007-12-05 22:02:03 +00:00
|
|
|
|
|
|
|
class Window;
|
|
|
|
|
|
|
|
|
2007-12-04 21:35:01 +00:00
|
|
|
class SidebarToolbox : Sidebar {
|
2007-11-30 15:04:01 +00:00
|
|
|
private:
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
2007-12-05 22:02:03 +00:00
|
|
|
Window *window;
|
|
|
|
|
2007-12-04 21:35:01 +00:00
|
|
|
std::list<Tool*> tools;
|
|
|
|
std::map<Tool*, GtkWidget*> buttons;
|
2007-12-05 18:34:01 +00:00
|
|
|
std::map<GtkWidget*, Tool*> buttonsRev;
|
|
|
|
|
|
|
|
Tool *activeTool;
|
|
|
|
|
|
|
|
ToolSelector toolSelector;
|
2007-12-04 21:35:01 +00:00
|
|
|
|
|
|
|
int cols, rows;
|
|
|
|
|
|
|
|
void updateRows(bool changed);
|
2007-12-05 18:34:01 +00:00
|
|
|
void activateTool(Tool *tool);
|
2007-11-30 15:04:01 +00:00
|
|
|
|
|
|
|
// prevent shallow copy
|
|
|
|
SidebarToolbox(const SidebarToolbox &w);
|
|
|
|
const SidebarToolbox& operator=(const SidebarToolbox &w);
|
|
|
|
|
2007-12-05 18:34:01 +00:00
|
|
|
static void buttonToggled(GtkWidget *button, SidebarToolbox *toolbox);
|
2007-12-04 21:35:01 +00:00
|
|
|
static void sizeAllocate(GtkWidget *widget, GtkAllocation *allocation, SidebarToolbox *toolbox);
|
|
|
|
|
2007-11-30 15:04:01 +00:00
|
|
|
public:
|
2007-12-05 22:02:03 +00:00
|
|
|
SidebarToolbox(Window *window);
|
2007-11-30 15:04:01 +00:00
|
|
|
virtual ~SidebarToolbox();
|
|
|
|
|
|
|
|
GtkWidget* getWidget() {
|
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
2007-12-25 03:27:03 +00:00
|
|
|
void resetTool() {
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(buttons[&toolSelector]), TRUE);
|
|
|
|
}
|
|
|
|
|
2007-12-24 00:04:02 +00:00
|
|
|
Tool& getActiveTool() {
|
|
|
|
return *activeTool;
|
2007-12-05 22:02:03 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 21:35:01 +00:00
|
|
|
void addTool(Tool *tool);
|
|
|
|
void removeTool(Tool *tool);
|
2007-11-30 15:04:01 +00:00
|
|
|
|
2007-12-04 21:35:01 +00:00
|
|
|
void update();
|
2007-11-30 15:04:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*SIDEBARTOOLBOX_H_*/
|