Rename ITabsHandler to TabsDelegate.

This commit is contained in:
David Capello 2011-04-02 14:57:40 -03:00
parent ff897fea34
commit d6181d838d
4 changed files with 21 additions and 21 deletions

View File

@ -85,7 +85,7 @@ public:
RecentFiles m_recent_files;
};
class TabsBarHandler : public ITabsHandler
class AppTabsDelegate : public TabsDelegate
{
public:
void clickTab(Tabs* tabs, void* data, int button);
@ -108,8 +108,6 @@ static Tabs* tabsbar = NULL; // The tabs bar widget
static char *palette_filename = NULL;
static TabsBarHandler* tabsHandler = NULL;
// Initializes the application loading the modules, setting the
// graphics mode, loading the configuration and resources, etc.
App::App(int argc, char* argv[])
@ -185,7 +183,7 @@ int App::run()
statusbar = new StatusBar();
colorbar = new ColorBar(box_colorbar->getAlign());
toolbar = toolbar_new();
tabsbar = new Tabs(tabsHandler = new TabsBarHandler());
tabsbar = new Tabs(m_tabsDelegate = new AppTabsDelegate());
view = editor_view_new();
editor = create_new_editor();
@ -315,7 +313,7 @@ App::~App()
Editor::editor_cursor_exit();
boundary_exit();
delete tabsHandler;
delete m_tabsDelegate;
delete m_legacy;
delete m_modules;
delete m_loggerModule;
@ -488,9 +486,9 @@ int app_get_color_to_clear_layer(Layer* layer)
}
//////////////////////////////////////////////////////////////////////
// TabsBarHandler
// AppTabsDelegate
void TabsBarHandler::clickTab(Tabs* tabs, void* data, int button)
void AppTabsDelegate::clickTab(Tabs* tabs, void* data, int button)
{
Document* document = (Document*)data;
@ -506,7 +504,7 @@ void TabsBarHandler::clickTab(Tabs* tabs, void* data, int button)
}
}
void TabsBarHandler::mouseOverTab(Tabs* tabs, void* data)
void AppTabsDelegate::mouseOverTab(Tabs* tabs, void* data)
{
// Note: data can be NULL
Document* document = (Document*)data;

View File

@ -25,6 +25,7 @@
#include <vector>
class AppTabsDelegate;
class CheckArgs;
class ColorBar;
class ConfigModule;
@ -83,6 +84,7 @@ private:
LegacyModules* m_legacy;
bool m_isGui;
std::vector<base::string> m_args;
AppTabsDelegate* m_tabsDelegate;
};
void app_refresh_screen(const Document* document);

View File

@ -47,9 +47,9 @@ static int tabs_type()
return type;
}
Tabs::Tabs(ITabsHandler* handler)
Tabs::Tabs(TabsDelegate* delegate)
: Widget(tabs_type())
, m_handler(handler)
, m_delegate(delegate)
{
m_hot = NULL;
m_selected = NULL;
@ -315,10 +315,10 @@ bool Tabs::onProcessMessage(Message* msg)
invalidate();
}
if (m_selected && m_handler)
m_handler->clickTab(this,
m_selected->data,
msg->mouse.flags);
if (m_selected && m_delegate)
m_delegate->clickTab(this,
m_selected->data,
msg->mouse.flags);
}
return true;
@ -585,8 +585,8 @@ void Tabs::calculateHot()
if (m_hot != hot) {
m_hot = hot;
if (m_handler)
m_handler->mouseOverTab(this, m_hot ? m_hot->data: NULL);
if (m_delegate)
m_delegate->mouseOverTab(this, m_hot ? m_hot->data: NULL);
invalidate();
}

View File

@ -28,10 +28,10 @@ class Tabs;
class Button;
// Interface used to control notifications from the Tabs widget.
class ITabsHandler
class TabsDelegate
{
public:
virtual ~ITabsHandler() { }
virtual ~TabsDelegate() { }
// Called when the user presses a mouse button over a tab
// button & 1 => left click
@ -70,7 +70,7 @@ class Tabs : public Widget
ANI_SMOOTH_SCROLL };
public:
Tabs(ITabsHandler* handler);
Tabs(TabsDelegate* delegate);
~Tabs();
void addTab(const char* text, void* data);
@ -117,8 +117,8 @@ private:
Button* m_button_left;
Button* m_button_right;
// Handler to send notifications
ITabsHandler* m_handler;
// Delegate of notifications
TabsDelegate* m_delegate;
};
#endif