Rename PopupWindow to PopupFrame.

This commit is contained in:
David Capello 2011-01-22 11:28:40 -03:00
parent 05cc6f6ba6
commit 1e88a438eb
7 changed files with 39 additions and 38 deletions

View File

@ -29,7 +29,6 @@ add_library(gui-lib
jmenu.cpp
jmessage.cpp
jpanel.cpp
jpopup_window.cpp
jquickmenu.cpp
jrect.cpp
jregion.cpp
@ -40,6 +39,7 @@ add_library(gui-lib
jtooltips.cpp
jview.cpp
label.cpp
popup_frame.cpp
preferred_size_event.cpp
property.cpp
slider.cpp

View File

@ -29,7 +29,6 @@
#include "gui/jmenu.h"
#include "gui/jmessage.h"
#include "gui/jpanel.h"
#include "gui/jpopup_window.h"
#include "gui/jquickmenu.h"
#include "gui/jrect.h"
#include "gui/jregion.h"
@ -40,6 +39,7 @@
#include "gui/jtooltips.h"
#include "gui/jview.h"
#include "gui/label.h"
#include "gui/popup_frame.h"
#include "gui/slider.h"
#include "gui/theme.h"
#include "gui/widget.h"

View File

@ -15,7 +15,7 @@
using namespace gfx;
PopupWindow::PopupWindow(const char* text, bool close_on_buttonpressed)
PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed)
: Frame(false, text)
{
m_close_on_buttonpressed = close_on_buttonpressed;
@ -36,7 +36,7 @@ PopupWindow::PopupWindow(const char* text, bool close_on_buttonpressed)
jwidget_noborders(this);
}
PopupWindow::~PopupWindow()
PopupFrame::~PopupFrame()
{
if (m_filtering) {
m_filtering = false;
@ -53,7 +53,7 @@ PopupWindow::~PopupWindow()
* @param region The new hot-region. This pointer is holded by the @a widget.
* So you cannot destroy it after calling this routine.
*/
void PopupWindow::setHotRegion(JRegion region)
void PopupFrame::setHotRegion(JRegion region)
{
ASSERT(region != NULL);
@ -69,7 +69,7 @@ void PopupWindow::setHotRegion(JRegion region)
m_hot_region = region;
}
bool PopupWindow::onProcessMessage(JMessage msg)
bool PopupFrame::onProcessMessage(JMessage msg)
{
switch (msg->type) {
@ -164,7 +164,7 @@ bool PopupWindow::onProcessMessage(JMessage msg)
return Frame::onProcessMessage(msg);
}
void PopupWindow::onPreferredSize(PreferredSizeEvent& ev)
void PopupFrame::onPreferredSize(PreferredSizeEvent& ev)
{
Size resultSize(0, 0);

View File

@ -4,26 +4,27 @@
// This source file is ditributed under a BSD-like license, please
// read LICENSE.txt for more information.
#ifndef GUI_JPOPUP_WINDOW_H_INCLUDED
#define GUI_JPOPUP_WINDOW_H_INCLUDED
#ifndef GUI_POPUP_FRAME_H_INCLUDED
#define GUI_POPUP_FRAME_H_INCLUDED
#include "gui/frame.h"
class PopupWindow : public Frame
class PopupFrame : public Frame
{
bool m_close_on_buttonpressed;
JRegion m_hot_region;
bool m_filtering;
public:
PopupWindow(const char* text, bool close_on_buttonpressed);
~PopupWindow();
PopupFrame(const char* text, bool close_on_buttonpressed);
~PopupFrame();
void setHotRegion(JRegion region);
protected:
bool onProcessMessage(JMessage msg);
void onPreferredSize(PreferredSizeEvent& ev);
private:
bool m_close_on_buttonpressed;
JRegion m_hot_region;
bool m_filtering;
};
#endif

View File

@ -242,7 +242,7 @@ void ColorButton::openSelectorDialog()
JRegion rgn = jregion_new(rc, 1);
jrect_free(rc);
static_cast<PopupWindow*>(window)->setHotRegion(rgn);
static_cast<PopupFrame*>(window)->setHotRegion(rgn);
}
}

View File

@ -83,7 +83,7 @@ static Model models[] = {
Frame* colorselector_new()
{
Frame* window = new PopupWindow(NULL, false);
Frame* window = new PopupFrame(NULL, false);
Widget* grid1 = jgrid_new(2, false);
Widget* grid2 = jgrid_new(5, false);
Widget* models_box = jbox_new(JI_HORIZONTAL);

View File

@ -56,7 +56,7 @@ class ToolBar : public Widget
bool m_open_on_hot;
// Window displayed to show a tool-group
PopupWindow* m_popup_window;
PopupFrame* m_popupFrame;
// Tool-tip window
TipWindow* m_tipWindow;
@ -79,14 +79,14 @@ protected:
private:
int getToolGroupIndex(ToolGroup* group);
void openPopupWindow(int group_index, ToolGroup* group);
void openPopupFrame(int group_index, ToolGroup* group);
Rect getToolGroupBounds(int group_index);
void openTipWindow(int group_index, Tool* tool);
void onClosePopup();
};
// Class to show a group of tools (horizontally)
// This widget is inside the ToolBar::m_popup_window
// This widget is inside the ToolBar::m_popupFrame
class ToolStrip : public Widget
{
ToolGroup* m_group;
@ -148,7 +148,7 @@ ToolBar::ToolBar()
m_hot_tool = NULL;
m_hot_conf = false;
m_open_on_hot = false;
m_popup_window = NULL;
m_popupFrame = NULL;
m_tipWindow = NULL;
m_tipTimerId = jmanager_add_timer(this, 300);
m_tipOpened = false;
@ -164,7 +164,7 @@ ToolBar::ToolBar()
ToolBar::~ToolBar()
{
jmanager_remove_timer(m_tipTimerId);
delete m_popup_window;
delete m_popupFrame;
delete m_tipWindow;
}
@ -270,7 +270,7 @@ bool ToolBar::onProcessMessage(JMessage msg)
UIContext::instance()->getSettings()->setCurrentTool(tool);
invalidate();
openPopupWindow(c, tool_group);
openPopupFrame(c, tool_group);
}
}
@ -303,7 +303,7 @@ bool ToolBar::onProcessMessage(JMessage msg)
hot_tool = tool;
if ((m_open_on_hot) && (m_hot_tool != hot_tool))
openPopupWindow(c, tool_group);
openPopupFrame(c, tool_group);
tip_index = c;
break;
@ -336,7 +336,7 @@ bool ToolBar::onProcessMessage(JMessage msg)
case JM_MOUSELEAVE:
closeTipWindow();
if (!m_popup_window)
if (!m_popupFrame)
m_tipOpened = false;
m_hot_tool = NULL;
@ -375,13 +375,13 @@ int ToolBar::getToolGroupIndex(ToolGroup* group)
return -1;
}
void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
void ToolBar::openPopupFrame(int group_index, ToolGroup* tool_group)
{
// Close the current popup window
if (m_popup_window) {
m_popup_window->closeWindow(NULL);
delete m_popup_window;
m_popup_window = NULL;
if (m_popupFrame) {
m_popupFrame->closeWindow(NULL);
delete m_popupFrame;
m_popupFrame = NULL;
}
// Close tip window
@ -400,11 +400,11 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
// In case this tool contains more than just one tool, show the popup window
m_open_on_hot = true;
m_popup_window = new PopupWindow(NULL, false);
m_popup_window->Close.connect(Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this));
m_popupFrame = new PopupFrame(NULL, false);
m_popupFrame->Close.connect(Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this));
ToolStrip* toolstrip = new ToolStrip(tool_group, this);
jwidget_add_child(m_popup_window, toolstrip);
jwidget_add_child(m_popupFrame, toolstrip);
Rect rc = getToolGroupBounds(group_index);
int w = 0;
@ -436,13 +436,13 @@ void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
{
jrect rc2 = { rc.x, rc.y, this->rc->x2, rc.y+rc.h };
JRegion hotregion = jregion_new(&rc2, 1);
m_popup_window->setHotRegion(hotregion);
m_popupFrame->setHotRegion(hotregion);
}
m_popup_window->set_autoremap(false);
m_popup_window->setBounds(rc);
m_popupFrame->set_autoremap(false);
m_popupFrame->setBounds(rc);
toolstrip->setBounds(rc);
m_popup_window->open_window();
m_popupFrame->open_window();
toolstrip->setBounds(rc);
}