Rename ui::Frame to ui::Window.

This commit is contained in:
David Capello 2012-07-08 23:24:42 -03:00
parent a35aa7559a
commit 91bf74350e
77 changed files with 415 additions and 419 deletions

View File

@ -382,7 +382,7 @@ add_library(aseprite-library
widgets/hex_color_entry.cpp
widgets/menuitem2.cpp
widgets/palette_view.cpp
widgets/popup_frame_pin.cpp
widgets/popup_window_pin.cpp
widgets/status_bar.cpp
widgets/tabs.cpp
widgets/toolbar.cpp)

View File

@ -100,7 +100,7 @@ public:
App* App::m_instance = NULL;
static Frame* top_window = NULL; /* top level window (the desktop) */
static Window* top_window = NULL; // Top level window (the desktop)
static Widget* box_menubar = NULL; /* box where the menu bar is */
static Widget* box_colorbar = NULL; /* box where the color bar is */
static Widget* box_toolbar = NULL; /* box where the tools bar is */
@ -185,7 +185,7 @@ int App::run()
ui::Manager::getDefault()->invalidate();
// Load main window
top_window = app::load_widget<Frame>("main_window.xml", "main_window");
top_window = app::load_widget<Window>("main_window.xml", "main_window");
box_menubar = top_window->findChild("menubar");
box_editors = top_window->findChild("editor");
@ -238,7 +238,7 @@ int App::run()
set_current_editor(editor);
// Open the window
top_window->open_window();
top_window->openWindow();
// Redraw the whole screen.
ui::Manager::getDefault()->invalidate();
@ -482,7 +482,7 @@ PixelFormat app_get_current_pixel_format()
return IMAGE_RGB;
}
Frame* app_get_top_window() { return top_window; }
Window* app_get_top_window() { return top_window; }
MenuBar* app_get_menubar() { return menubar; }
StatusBar* app_get_statusbar() { return statusbar; }
ColorBar* app_get_colorbar() { return colorbar; }

View File

@ -40,8 +40,9 @@ class StatusBar;
class Tabs;
namespace ui {
class Frame;
class MenuBar;
class Widget;
class Window;
}
namespace tools { class ToolBox; }
@ -102,7 +103,7 @@ bool app_rebuild_recent_list();
PixelFormat app_get_current_pixel_format();
ui::Frame* app_get_top_window();
ui::Window* app_get_top_window();
ui::MenuBar* app_get_menubar();
StatusBar* app_get_statusbar();
ColorBar* app_get_colorbar();

View File

@ -370,9 +370,9 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
bool desktop = bool_attr_is_true(elem, "desktop");
if (desktop)
widget = new Frame(true, NULL);
widget = new Window(true, NULL);
else
widget = new Frame(false, TRANSLATE_ATTR(text));
widget = new Window(false, TRANSLATE_ATTR(text));
}
}
/* colorpicker */

View File

@ -50,7 +50,7 @@ AboutCommand::AboutCommand()
void AboutCommand::onExecute(Context* context)
{
UniquePtr<Frame> frame(new Frame(false, "About " PACKAGE));
UniquePtr<Window> window(new Window(false, "About " PACKAGE));
Box* box1 = new Box(JI_VERTICAL);
Grid* grid = new Grid(2, false);
Label* title = new Label(PACKAGE " v" VERSION);
@ -92,7 +92,7 @@ void AboutCommand::onExecute(Context* context)
bottom_box1->addChild(bottom_box3);
box1->addChild(grid);
frame->addChild(box1);
window->addChild(box1);
jwidget_set_border(close_button,
close_button->border_width.l + 16*jguiscale(),
@ -100,9 +100,9 @@ void AboutCommand::onExecute(Context* context)
close_button->border_width.r + 16*jguiscale(),
close_button->border_width.b);
close_button->Click.connect(Bind<void>(&Frame::closeWindow, frame.get(), close_button));
close_button->Click.connect(Bind<void>(&Window::closeWindow, window.get(), close_button));
frame->open_window_fg();
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////

View File

@ -74,7 +74,7 @@ void AdvancedModeCommand::onExecute(Context* context)
char key[1024];
char buf[1024];
UniquePtr<Frame> window(app::load_widget<Frame>("advanced_mode.xml", "advanced_mode_warning"));
UniquePtr<Window> window(app::load_widget<Window>("advanced_mode.xml", "advanced_mode_warning"));
Widget* warning_label = app::find_widget<Widget>(window, "warning_label");
Widget* donot_show = app::find_widget<Widget>(window, "donot_show");
@ -84,7 +84,7 @@ void AdvancedModeCommand::onExecute(Context* context)
warning_label->setText(buf);
window->open_window_fg();
window->openWindowInForeground();
set_config_bool("AdvancedMode", "Warning", !donot_show->isSelected());
}

View File

@ -43,13 +43,13 @@ using namespace ui;
// Disable warning about usage of "this" in initializer list.
#pragma warning(disable:4355)
// Frame used to show canvas parameters.
class CanvasSizeFrame : public Frame
, public SelectBoxDelegate
// Window used to show canvas parameters.
class CanvasSizeWindow : public Window
, public SelectBoxDelegate
{
public:
CanvasSizeFrame(int left, int top, int right, int bottom)
: Frame(false, "Canvas Size")
CanvasSizeWindow(int left, int top, int right, int bottom)
: Window(false, "Canvas Size")
, m_editor(current_editor)
, m_rect(-left, -top,
current_editor->getSprite()->getWidth() + left + right,
@ -71,15 +71,15 @@ public:
m_top->setTextf("%d", top);
m_bottom->setTextf("%d", bottom);
m_left ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_right ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_top ->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_bottom->EntryChange.connect(Bind<void>(&CanvasSizeFrame::onEntriesChange, this));
m_left ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_right ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_top ->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_bottom->EntryChange.connect(Bind<void>(&CanvasSizeWindow::onEntriesChange, this));
m_editor->setState(m_selectBoxState);
}
~CanvasSizeFrame()
~CanvasSizeWindow()
{
m_editor->backToPreviousState();
}
@ -120,7 +120,7 @@ protected:
virtual void onBroadcastMouseMessage(WidgetsList& targets) OVERRIDE
{
Frame::onBroadcastMouseMessage(targets);
Window::onBroadcastMouseMessage(targets);
// Add the editor as receptor of mouse events too.
targets.push_back(View::getView(m_editor));
@ -174,14 +174,14 @@ void CanvasSizeCommand::onExecute(Context* context)
if (context->isUiAvailable()) {
// load the window widget
UniquePtr<CanvasSizeFrame> window(new CanvasSizeFrame(0, 0, 0, 0));
UniquePtr<CanvasSizeWindow> window(new CanvasSizeWindow(0, 0, 0, 0));
window->remap_window();
window->center_window();
load_window_pos(window, "CanvasSize");
window->setVisible(true);
window->open_window_fg();
window->openWindowInForeground();
save_window_pos(window, "CanvasSize");
if (!window->pressedOk())

View File

@ -71,7 +71,7 @@ void CelPropertiesCommand::onExecute(Context* context)
// Get current cel (can be NULL)
const Cel* cel = static_cast<const LayerImage*>(layer)->getCel(sprite->getCurrentFrame());
UniquePtr<Frame> window(app::load_widget<Frame>("cel_properties.xml", "cel_properties"));
UniquePtr<Window> window(app::load_widget<Window>("cel_properties.xml", "cel_properties"));
Widget* label_frame = app::find_widget<Widget>(window, "frame");
Widget* label_pos = app::find_widget<Widget>(window, "pos");
Widget* label_size = app::find_widget<Widget>(window, "size");
@ -122,7 +122,7 @@ void CelPropertiesCommand::onExecute(Context* context)
slider_opacity->setEnabled(false);
}
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
DocumentWriter document_writer(document);

View File

@ -53,7 +53,7 @@ using namespace gfx;
using namespace ui;
using namespace tools;
static Frame* window = NULL;
static Window* window = NULL;
static bool window_close_hook(Widget* widget, void *data);
@ -270,7 +270,7 @@ void ConfigureTools::onExecute(Context* context)
bool first_time = false;
if (!window) {
window = app::load_widget<Frame>("tools_configuration.xml", "configure_tool");
window = app::load_widget<Window>("tools_configuration.xml", "configure_tool");
first_time = true;
}
/* if the window is opened, close it */
@ -385,7 +385,7 @@ void ConfigureTools::onExecute(Context* context)
// Load window configuration
load_window_pos(window, "ConfigureTool");
window->open_window_bg();
window->openWindow();
}
void ConfigureTools::onWindowClose()

View File

@ -25,15 +25,15 @@
#include "ui/box.h"
#include "ui/button.h"
#include "ui/combobox.h"
#include "ui/frame.h"
#include "ui/window.h"
using namespace ui;
class DeveloperConsole : public Frame
class DeveloperConsole : public Window
{
public:
DeveloperConsole()
: Frame(false, "Developer Console")
: Window(false, "Developer Console")
, m_vbox(JI_VERTICAL)
{
m_vbox.addChild(&m_docs);
@ -96,7 +96,7 @@ void DeveloperConsoleCommand::onExecute(Context* context)
}
m_devConsole->updateDocuments(context);
m_devConsole->open_window_bg();
m_devConsole->openWindow();
}
//////////////////////////////////////////////////////////////////////

View File

@ -66,7 +66,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
char buf[1024];
/* load the window widget */
UniquePtr<Frame> window(app::load_widget<Frame>("duplicate_sprite.xml", "duplicate_sprite"));
UniquePtr<Window> window(app::load_widget<Window>("duplicate_sprite.xml", "duplicate_sprite"));
src_name = window->findChild("src_name");
dst_name = window->findChild("dst_name");
@ -81,7 +81,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
flatten->setSelected(true);
/* open the window */
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == window->findChild("ok")) {
set_config_bool("DuplicateSprite", "Flatten", flatten->isSelected());

View File

@ -42,14 +42,14 @@ using namespace ui;
//////////////////////////////////////////////////////////////////////
// ExportSpriteSheetFrame
class ExportSpriteSheetFrame : public Frame
class ExportSpriteSheetWindow : public Window
{
enum SpriteSheetType { HorizontalStrip, VerticalStrip, Matrix };
enum ExportAction { SaveCopyAs, SaveAs, Save, DoNotSave };
public:
ExportSpriteSheetFrame(Context* context)
: Frame(false, "Export Sprite Sheet")
ExportSpriteSheetWindow(Context* context)
: Window(false, "Export Sprite Sheet")
, m_context(context)
, m_document(context->getActiveDocument())
, m_grid(4, false)
@ -87,14 +87,14 @@ public:
m_grid.addChildInCell(hbox1, 4, 1, 0);
}
m_sheetType.Change.connect(&ExportSpriteSheetFrame::onSheetTypeChange, this);
m_export.Click.connect(Bind<void>(&ExportSpriteSheetFrame::onExport, this));
m_cancel.Click.connect(Bind<void>(&ExportSpriteSheetFrame::onCancel, this));
m_sheetType.Change.connect(&ExportSpriteSheetWindow::onSheetTypeChange, this);
m_export.Click.connect(Bind<void>(&ExportSpriteSheetWindow::onExport, this));
m_cancel.Click.connect(Bind<void>(&ExportSpriteSheetWindow::onCancel, this));
onSheetTypeChange();
}
~ExportSpriteSheetFrame()
~ExportSpriteSheetWindow()
{
}
@ -316,8 +316,8 @@ bool ExportSpriteSheetCommand::onEnabled(Context* context)
void ExportSpriteSheetCommand::onExecute(Context* context)
{
UniquePtr<Frame> frame(new ExportSpriteSheetFrame(context));
frame->open_window_fg();
UniquePtr<Window> window(new ExportSpriteSheetWindow(context));
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////

View File

@ -89,7 +89,7 @@ void FramePropertiesCommand::onExecute(Context* context)
const ActiveDocumentReader document(context);
const Sprite* sprite = document->getSprite();
UniquePtr<Frame> window(app::load_widget<Frame>("frame_duration.xml", "frame_duration"));
UniquePtr<Window> window(app::load_widget<Window>("frame_duration.xml", "frame_duration"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* frlen = app::find_widget<Widget>(window, "frlen");
Widget* ok = app::find_widget<Widget>(window, "ok");
@ -110,13 +110,13 @@ void FramePropertiesCommand::onExecute(Context* context)
}
if (m_target == ALL_FRAMES)
frame->setText("All");
window->setText("All");
else
frame->setTextf("%d", sprite_frame);
window->setTextf("%d", sprite_frame);
frlen->setTextf("%d", sprite->getFrameDuration(sprite->getCurrentFrame()));
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == ok) {
int num = strtol(frlen->getText(), NULL, 10);

View File

@ -26,7 +26,7 @@
#include "modules/editors.h"
#include "modules/gui.h"
#include "raster/sprite.h"
#include "ui/frame.h"
#include "ui/window.h"
#include "widgets/editor/editor.h"
#include <allegro/unicode.h>
@ -235,13 +235,13 @@ bool GotoFrameCommand::onEnabled(Context* context)
void GotoFrameCommand::onExecute(Context* context)
{
if (m_frame == 0 && context->isUiAvailable()) {
UniquePtr<Frame> window(app::load_widget<Frame>("goto_frame.xml", "goto_frame"));
UniquePtr<Window> window(app::load_widget<Window>("goto_frame.xml", "goto_frame"));
Widget* frame = app::find_widget<Widget>(window, "frame");
Widget* ok = app::find_widget<Widget>(window, "ok");
frame->setTextf("%d", context->getActiveDocument()->getSprite()->getCurrentFrame()+1);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() != ok)
return;

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <allegro/unicode.h>
#include "app.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
@ -27,10 +25,12 @@
#include "context.h"
#include "modules/editors.h"
#include "settings/settings.h"
#include "ui/frame.h"
#include "ui/window.h"
#include "ui_context.h"
#include "widgets/status_bar.h"
#include <allegro/unicode.h>
using namespace ui;
using namespace gfx;
@ -132,7 +132,7 @@ bool GridSettingsCommand::onEnabled(Context* context)
void GridSettingsCommand::onExecute(Context* context)
{
UniquePtr<Frame> window(app::load_widget<Frame>("grid_settings.xml", "grid_settings"));
UniquePtr<Window> window(app::load_widget<Window>("grid_settings.xml", "grid_settings"));
Widget* button_ok = app::find_widget<Widget>(window, "ok");
Widget* grid_x = app::find_widget<Widget>(window, "grid_x");
Widget* grid_y = app::find_widget<Widget>(window, "grid_y");
@ -146,7 +146,7 @@ void GridSettingsCommand::onExecute(Context* context)
grid_w->setTextf("%d", bounds.w);
grid_h->setTextf("%d", bounds.h);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
bounds.x = grid_x->getTextInt();

View File

@ -46,14 +46,14 @@
using namespace ui;
//////////////////////////////////////////////////////////////////////
// ImportSpriteSheetFrame
// ImportSpriteSheetWindow
class ImportSpriteSheetFrame : public Frame,
public SelectBoxDelegate
class ImportSpriteSheetWindow : public Window,
public SelectBoxDelegate
{
public:
ImportSpriteSheetFrame(Context* context)
: Frame(false, "Import Sprite Sheet")
ImportSpriteSheetWindow(Context* context)
: Window(false, "Import Sprite Sheet")
, m_context(context)
, m_document(NULL)
, m_grid(4, false)
@ -89,18 +89,18 @@ public:
m_grid.addChildInCell(hbox1, 4, 1, 0);
}
m_x.EntryChange.connect(Bind<void>(&ImportSpriteSheetFrame::onEntriesChange, this));
m_y.EntryChange.connect(Bind<void>(&ImportSpriteSheetFrame::onEntriesChange, this));
m_width.EntryChange.connect(Bind<void>(&ImportSpriteSheetFrame::onEntriesChange, this));
m_height.EntryChange.connect(Bind<void>(&ImportSpriteSheetFrame::onEntriesChange, this));
m_x.EntryChange.connect(Bind<void>(&ImportSpriteSheetWindow::onEntriesChange, this));
m_y.EntryChange.connect(Bind<void>(&ImportSpriteSheetWindow::onEntriesChange, this));
m_width.EntryChange.connect(Bind<void>(&ImportSpriteSheetWindow::onEntriesChange, this));
m_height.EntryChange.connect(Bind<void>(&ImportSpriteSheetWindow::onEntriesChange, this));
m_selectFile.Click.connect(&ImportSpriteSheetFrame::onSelectFile, this);
m_selectFile.DropDownClick.connect(&ImportSpriteSheetFrame::onDropDown, this);
m_import.Click.connect(Bind<void>(&ImportSpriteSheetFrame::onImport, this));
m_cancel.Click.connect(Bind<void>(&ImportSpriteSheetFrame::onCancel, this));
m_selectFile.Click.connect(&ImportSpriteSheetWindow::onSelectFile, this);
m_selectFile.DropDownClick.connect(&ImportSpriteSheetWindow::onDropDown, this);
m_import.Click.connect(Bind<void>(&ImportSpriteSheetWindow::onImport, this));
m_cancel.Click.connect(Bind<void>(&ImportSpriteSheetWindow::onCancel, this));
}
~ImportSpriteSheetFrame()
~ImportSpriteSheetWindow()
{
releaseEditor();
}
@ -127,7 +127,7 @@ protected:
{
SharedPtr<Menu> menu(new Menu());
MenuItem* item = new MenuItem("Use Current Sprite");
item->Click.connect(&ImportSpriteSheetFrame::onUseCurrentSprite, this);
item->Click.connect(&ImportSpriteSheetWindow::onUseCurrentSprite, this);
if (m_editor || current_editor->getDocument() == NULL)
item->setEnabled(false);
@ -263,7 +263,7 @@ protected:
virtual void onBroadcastMouseMessage(WidgetsList& targets) OVERRIDE
{
Frame::onBroadcastMouseMessage(targets);
Window::onBroadcastMouseMessage(targets);
// Add the editor as receptor of mouse events too.
if (m_editor)
@ -359,8 +359,8 @@ ImportSpriteSheetCommand::ImportSpriteSheetCommand()
void ImportSpriteSheetCommand::onExecute(Context* context)
{
UniquePtr<Frame> frame(new ImportSpriteSheetFrame(context));
frame->open_window_fg();
UniquePtr<Window> window(new ImportSpriteSheetWindow(context));
window->openWindowInForeground();
}
//////////////////////////////////////////////////////////////////////

View File

@ -64,7 +64,7 @@ void LayerPropertiesCommand::onExecute(Context* context)
const Sprite* sprite(document->getSprite());
const Layer* layer = sprite->getCurrentLayer();
UniquePtr<Frame> window(new Frame(false, "Layer Properties"));
UniquePtr<Window> window(new Window(false, "Layer Properties"));
Box* box1 = new Box(JI_VERTICAL);
Box* box2 = new Box(JI_HORIZONTAL);
Box* box3 = new Box(JI_HORIZONTAL + JI_HOMOGENEOUS);
@ -73,8 +73,8 @@ void LayerPropertiesCommand::onExecute(Context* context)
Button* button_ok = new Button("&OK");
Button* button_cancel = new Button("&Cancel");
button_ok->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
button_ok->Click.connect(Bind<void>(&Window::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Bind<void>(&Window::closeWindow, window.get(), button_cancel));
jwidget_set_min_size(entry_name, 128, 0);
entry_name->setExpansive(true);
@ -90,7 +90,7 @@ void LayerPropertiesCommand::onExecute(Context* context)
entry_name->setFocusMagnet(true);
button_ok->setFocusMagnet(true);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
DocumentWriter documentWriter(document);

View File

@ -83,7 +83,7 @@ void NewFileCommand::onExecute(Context* context)
};
// Load the window widget
UniquePtr<Frame> window(app::load_widget<Frame>("new_sprite.xml", "new_sprite"));
UniquePtr<Window> window(app::load_widget<Window>("new_sprite.xml", "new_sprite"));
Widget* width = app::find_widget<Widget>(window, "width");
Widget* height = app::find_widget<Widget>(window, "height");
Widget* radio1 = app::find_widget<Widget>(window, "radio1");
@ -127,7 +127,7 @@ void NewFileCommand::onExecute(Context* context)
bg_box->selectIndex(bg);
// Open the window
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == ok) {
bool ok = false;

View File

@ -93,12 +93,12 @@ void NewLayerCommand::onExecute(Context* context)
// If params specify to ask the user about the name...
if (m_ask) {
// We open the window to ask the name
UniquePtr<Frame> window(app::load_widget<Frame>("new_layer.xml", "new_layer"));
UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer"));
Widget* name_widget = app::find_widget<Widget>(window, "name");
name_widget->setText(name.c_str());
jwidget_set_min_size(name_widget, 128, 0);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() != window->findChild("ok"))
return;

View File

@ -63,9 +63,9 @@ void NewLayerSetCommand::onExecute(Context* context)
Sprite* sprite(document->getSprite());
// load the window widget
UniquePtr<Frame> window(app::load_widget<Frame>("new_layer.xml", "new_layer_set"));
UniquePtr<Window> window(app::load_widget<Window>("new_layer.xml", "new_layer_set"));
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == window->findChild("ok")) {
const char *name = window->findChild("name")->getText();

View File

@ -67,7 +67,7 @@ OptionsCommand::OptionsCommand()
void OptionsCommand::onExecute(Context* context)
{
/* load the window widget */
UniquePtr<Frame> window(app::load_widget<Frame>("options.xml", "options"));
UniquePtr<Window> window(app::load_widget<Window>("options.xml", "options"));
Widget* check_smooth = app::find_widget<Widget>(window, "smooth");
Widget* move_click2 = app::find_widget<Widget>(window, "move_click2");
Widget* draw_click2 = app::find_widget<Widget>(window, "draw_click2");
@ -132,7 +132,7 @@ void OptionsCommand::onExecute(Context* context)
undo_size_limit->setTextf("%d", get_config_int("Options", "UndoSizeLimit", 8));
// Show the window and wait the user to close it
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
int undo_size_limit_value;

View File

@ -62,7 +62,7 @@
using namespace gfx;
using namespace ui;
class PaletteEntryEditor : public Frame
class PaletteEntryEditor : public Window
{
public:
PaletteEntryEditor();
@ -74,7 +74,7 @@ protected:
bool onProcessMessage(Message* msg) OVERRIDE;
void onExit();
void onCloseFrame();
void onCloseWindow();
void onFgBgColorChange(const Color& color);
void onColorSlidersChange(ColorSlidersChangeEvent& ev);
void onColorHexEntryChange(const Color& color);
@ -141,7 +141,7 @@ private:
//////////////////////////////////////////////////////////////////////
// PaletteEditorCommand
static PaletteEntryEditor* g_frame = NULL;
static PaletteEntryEditor* g_window = NULL;
class PaletteEditorCommand : public Command
{
@ -193,38 +193,38 @@ void PaletteEditorCommand::onLoadParams(Params* params)
void PaletteEditorCommand::onExecute(Context* context)
{
// If this is the first time the command is execute...
if (!g_frame) {
if (!g_window) {
// If the command says "Close the palette editor" and it is not
// created yet, we just do nothing.
if (m_close)
return;
// If this is "open" or "switch", we have to create the frame.
g_frame = new PaletteEntryEditor();
g_window = new PaletteEntryEditor();
}
// If the frame is already created and it's visible, close it (only in "switch" or "close" modes)
else if (g_frame->isVisible() && (m_switch || m_close)) {
else if (g_window->isVisible() && (m_switch || m_close)) {
// Hide the frame
g_frame->closeWindow(NULL);
g_window->closeWindow(NULL);
return;
}
if (m_switch || m_open) {
if (!g_frame->isVisible()) {
if (!g_window->isVisible()) {
// Default bounds
g_frame->remap_window();
g_window->remap_window();
int width = MAX(jrect_w(g_frame->rc), JI_SCREEN_W/2);
g_frame->setBounds(Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc),
JI_SCREEN_H - jrect_h(g_frame->rc) - jrect_h(app_get_statusbar()->rc),
width, jrect_h(g_frame->rc)));
int width = MAX(jrect_w(g_window->rc), JI_SCREEN_W/2);
g_window->setBounds(Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc),
JI_SCREEN_H - jrect_h(g_window->rc) - jrect_h(app_get_statusbar()->rc),
width, jrect_h(g_window->rc)));
// Load window configuration
load_window_pos(g_frame, "PaletteEditor");
load_window_pos(g_window, "PaletteEditor");
}
// Run the frame in background.
g_frame->open_window_bg();
g_window->openWindow();
app_get_colorbar()->setPaletteEditorButtonState(true);
}
@ -234,7 +234,7 @@ void PaletteEditorCommand::onExecute(Context* context)
(m_background ? context->getSettings()->getBgColor():
context->getSettings()->getFgColor());
g_frame->setColor(color);
g_window->setColor(color);
}
}
@ -244,7 +244,7 @@ void PaletteEditorCommand::onExecute(Context* context)
// Based on ColorSelector class.
PaletteEntryEditor::PaletteEntryEditor()
: Frame(false, "Palette Editor (F4)")
: Window(false, "Palette Editor (F4)")
, m_vbox(JI_VERTICAL)
, m_topBox(JI_HORIZONTAL)
, m_bottomBox(JI_HORIZONTAL)
@ -334,10 +334,10 @@ PaletteEntryEditor::PaletteEntryEditor()
app_get_colorbar()->FgColorChange.connect(&PaletteEntryEditor::onFgBgColorChange, this);
app_get_colorbar()->BgColorChange.connect(&PaletteEntryEditor::onFgBgColorChange, this);
// We hook the Frame::Close event to save the frame position before closing it.
this->Close.connect(Bind<void>(&PaletteEntryEditor::onCloseFrame, this));
// We hook the Window::Close event to save the frame position before closing it.
this->Close.connect(Bind<void>(&PaletteEntryEditor::onCloseWindow, this));
// We hook App::Exit signal to destroy the g_frame singleton at exit.
// We hook App::Exit signal to destroy the g_window singleton at exit.
App::instance()->Exit.connect(&PaletteEntryEditor::onExit, this);
// Hook for palette change to redraw the palette editor frame
@ -425,7 +425,7 @@ bool PaletteEntryEditor::onProcessMessage(Message* msg)
current_editor->updateEditor();
}
}
return Frame::onProcessMessage(msg);
return Window::onProcessMessage(msg);
}
void PaletteEntryEditor::onExit()
@ -433,7 +433,7 @@ void PaletteEntryEditor::onExit()
delete this;
}
void PaletteEntryEditor::onCloseFrame()
void PaletteEntryEditor::onCloseWindow()
{
// Save window configuration
save_window_pos(this, "PaletteEditor");

View File

@ -71,7 +71,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
ColorButton* color_button = NULL;
// Load the window widget
UniquePtr<Frame> window(app::load_widget<Frame>("sprite_properties.xml", "sprite_properties"));
UniquePtr<Window> window(app::load_widget<Window>("sprite_properties.xml", "sprite_properties"));
name = app::find_widget<Widget>(window, "name");
type = app::find_widget<Widget>(window, "type");
size = app::find_widget<Widget>(window, "size");
@ -135,7 +135,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
load_window_pos(window, "SpriteProperties");
window->setVisible(true);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == ok) {
if (color_button) {

View File

@ -197,7 +197,7 @@ void SpriteSizeCommand::onExecute(Context* context)
const Sprite* sprite(document ? document->getSprite(): 0);
// load the window widget
UniquePtr<Frame> window(app::load_widget<Frame>("sprite_size.xml", "sprite_size"));
UniquePtr<Window> window(app::load_widget<Window>("sprite_size.xml", "sprite_size"));
m_widthPx = app::find_widget<Entry>(window, "width_px");
m_heightPx = app::find_widget<Entry>(window, "height_px");
m_widthPerc = app::find_widget<Entry>(window, "width_perc");
@ -224,7 +224,7 @@ void SpriteSizeCommand::onExecute(Context* context)
load_window_pos(window, "SpriteSize");
window->setVisible(true);
window->open_window_fg();
window->openWindowInForeground();
save_window_pos(window, "SpriteSize");
if (window->get_killer() == ok) {

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <string.h>
#include "app/color.h"
#include "app/find_widget.h"
#include "app/load_widget.h"
@ -35,13 +33,15 @@
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/button.h"
#include "ui/frame.h"
#include "ui/label.h"
#include "ui/list.h"
#include "ui/listbox.h"
#include "ui/slider.h"
#include "ui/view.h"
#include "ui/widget.h"
#include "ui/window.h"
#include <string.h>
static const char* ConfigSection = "ConvolutionMatrix";

View File

@ -18,8 +18,6 @@
#include "config.h"
#include <stdio.h>
#include "app/find_widget.h"
#include "app/load_widget.h"
#include "base/bind.h"
@ -34,9 +32,11 @@
#include "settings/settings.h"
#include "ui/button.h"
#include "ui/entry.h"
#include "ui/frame.h"
#include "ui/grid.h"
#include "ui/widget.h"
#include "ui/window.h"
#include <stdio.h>
static const char* ConfigSection = "Despeckle";

View File

@ -31,10 +31,10 @@
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/button.h"
#include "ui/frame.h"
#include "ui/label.h"
#include "ui/slider.h"
#include "ui/widget.h"
#include "ui/window.h"
#include "widgets/color_button.h"
static const char* ConfigSection = "InvertColor";

View File

@ -24,13 +24,13 @@
#include "filters/color_curve.h"
#include "ui/alert.h"
#include "ui/entry.h"
#include "ui/frame.h"
#include "ui/manager.h"
#include "ui/message.h"
#include "ui/rect.h"
#include "ui/system.h"
#include "ui/view.h"
#include "ui/widget.h"
#include "ui/window.h"
#include <allegro.h>
#include <cmath>
@ -359,7 +359,7 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point)
gfx::Point point_copy = point;
int res;
UniquePtr<Frame> window(app::load_widget<Frame>("color_curve.xml", "point_properties"));
UniquePtr<Window> window(app::load_widget<Window>("color_curve.xml", "point_properties"));
entry_x = window->findChild("x");
entry_y = window->findChild("y");
@ -368,7 +368,7 @@ int ColorCurveEditor::editNodeManually(gfx::Point& point)
entry_x->setTextf("%d", point.x);
entry_y->setTextf("%d", point.y);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
point.x = entry_x->getTextDouble();

View File

@ -33,7 +33,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
WithChannels withChannels,
WithTiled withTiled,
TiledMode tiledMode)
: Frame(false, title)
: Window(false, title)
, m_cfgSection(cfgSection)
, m_filterMgr(filterMgr)
, m_hbox(JI_HORIZONTAL)
@ -103,7 +103,7 @@ bool FilterWindow::doModal()
restartPreview();
// Open in foreground
open_window_fg();
openWindowInForeground();
// Did the user press OK?
if (get_killer() == &m_okButton) {

View File

@ -24,13 +24,13 @@
#include "filters/tiled_mode.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/frame.h"
#include "ui/window.h"
class FilterManagerImpl;
// A generic window to show parameters for a Filter with integrated
// preview in the current editor.
class FilterWindow : public ui::Frame
class FilterWindow : public ui::Window
{
public:
enum WithChannels { WithChannelsSelector, WithoutChannelsSelector };

View File

@ -106,7 +106,7 @@ void FilterWorker::run()
base::thread thread(&FilterWorker::thread_proxy, this);
// Open the alert window in foreground (this is modal, locks the main thread)
m_alertWindow->open_window_fg();
m_alertWindow->openWindowInForeground();
// Stop the monitoring timer.
m_timer.stop();

View File

@ -33,7 +33,7 @@
using namespace ui;
static Frame* wid_console = NULL;
static Window* wid_console = NULL;
static Widget* wid_view = NULL;
static Widget* wid_textbox = NULL;
static Widget* wid_cancel = NULL;
@ -51,7 +51,7 @@ Console::Console()
console_counter > 1)
return;
else {
Frame* window = new Frame(false, "Errors Console");
Window* window = new Window(false, "Errors Console");
Grid* grid = new Grid(1, false);
View* view = new View();
TextBox* textbox = new TextBox(NULL, JI_WORDWRAP);
@ -61,7 +61,7 @@ Console::Console()
return;
// The "button" closes the console
button->Click.connect(Bind<void>(&Frame::closeWindow, window, button));
button->Click.connect(Bind<void>(&Window::closeWindow, window, button));
view->attachToView(textbox);
@ -96,7 +96,7 @@ Console::~Console()
&& !want_close_flag
&& wid_console->isVisible()) {
/* open in foreground */
wid_console->open_window_fg();
wid_console->openWindowInForeground();
}
delete wid_console; // window
@ -120,7 +120,7 @@ void Console::printf(const char *format, ...)
// Open the window
if (!wid_console->isVisible()) {
wid_console->open_window();
wid_console->openWindow();
ui::Manager::getDefault()->invalidate();
}

View File

@ -179,7 +179,7 @@ void switch_between_animation_and_sprite_editor()
// Create the window & the animation-editor
{
UniquePtr<Frame> window(new Frame(true, NULL));
UniquePtr<Window> window(new Window(true, NULL));
AnimationEditor* anieditor = new AnimationEditor(document, sprite);
current_anieditor = anieditor;
@ -189,7 +189,7 @@ void switch_between_animation_and_sprite_editor()
anieditor->centerCurrentCel();
// Show the window
window->open_window_fg();
window->openWindowInForeground();
// No more animation editor
current_anieditor = NULL;

View File

@ -33,10 +33,10 @@
#include "raster/sprite.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/frame.h"
#include "ui/label.h"
#include "ui/slider.h"
#include "ui/widget.h"
#include "ui/window.h"
#include "undo_transaction.h"
#include "undoers/set_mask.h"
#include "util/misc.h"
@ -75,7 +75,7 @@ void dialogs_mask_color(Document* document)
if (!image)
return;
UniquePtr<Frame> window(new Frame(false, "Mask by Color"));
UniquePtr<Window> window(new Window(false, "Mask by Color"));
box1 = new Box(JI_VERTICAL);
box2 = new Box(JI_HORIZONTAL);
box3 = new Box(JI_HORIZONTAL);
@ -98,8 +98,8 @@ void dialogs_mask_color(Document* document)
button_1->Click.connect(Bind<void>(&button_1_command, button_1, Ref(documentReader)));
button_2->Click.connect(Bind<void>(&button_2_command, button_2, Ref(documentReader)));
button_ok->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
button_ok->Click.connect(Bind<void>(&Window::closeWindow, window.get(), button_ok));
button_cancel->Click.connect(Bind<void>(&Window::closeWindow, window.get(), button_cancel));
button_color->Change.connect(Bind<void>(&mask_preview, Ref(documentReader)));
slider_tolerance->Change.connect(Bind<void>(&mask_preview, Ref(documentReader)));
@ -135,7 +135,7 @@ void dialogs_mask_color(Document* document)
load_window_pos(window, "MaskColor");
// Open the window
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == button_ok) {
DocumentWriter documentWriter(documentReader);

View File

@ -26,8 +26,8 @@
#include "base/scoped_lock.h"
#include "commands/commands.h"
#include "commands/params.h"
#include "ui/frame.h"
#include "ui/manager.h"
#include "ui/window.h"
#include "ui_context.h"
#ifdef ALLEGRO_WINDOWS
@ -75,7 +75,7 @@ void check_for_dropped_files()
// If the main window is not the current foreground one. We discard
// the drop-files event.
if (ui::Manager::getDefault()->getForegroundFrame() != app_get_top_window())
if (ui::Manager::getDefault()->getForegroundWindow() != app_get_top_window())
return;
ScopedLock lock(*dropped_files_mutex);

View File

@ -366,13 +366,13 @@ SharedPtr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
return jpeg_options;
// Load the window to ask to the user the JPEG options he wants.
UniquePtr<ui::Frame> window(app::load_widget<ui::Frame>("jpeg_options.xml", "jpeg_options"));
UniquePtr<ui::Window> window(app::load_widget<ui::Window>("jpeg_options.xml", "jpeg_options"));
ui::Slider* slider_quality = app::find_widget<ui::Slider>(window, "quality");
ui::Widget* ok = app::find_widget<ui::Widget>(window, "ok");
slider_quality->setValue(jpeg_options->quality * 10.0f);
window->open_window_fg();
window->openWindowInForeground();
if (window->get_killer() == ok) {
jpeg_options->quality = slider_quality->getValue() / 10.0f;

View File

@ -20,8 +20,8 @@
#include <allegro.h>
#include "ui/frame.h"
#include "ui/manager.h"
#include "ui/window.h"
#include "app.h"
#include "console.h"

View File

@ -24,8 +24,8 @@
#include "base/thread.h"
#include "job.h"
#include "ui/alert.h"
#include "ui/frame.h"
#include "ui/widget.h"
#include "ui/window.h"
#include "widgets/status_bar.h"
static const int kMonitoringPeriod = 100;
@ -78,7 +78,7 @@ Job::~Job()
void Job::startJob()
{
m_thread = new base::thread(&Job::thread_proc, this);
m_alert_window->open_window_fg();
m_alert_window->openWindowInForeground();
}
void Job::jobProgress(double f)

View File

@ -34,7 +34,7 @@
#include "widgets/editor/editor.h"
#include "widgets/editor/editor_customization_delegate.h"
#include "widgets/editor/editor_view.h"
#include "widgets/popup_frame_pin.h"
#include "widgets/popup_window_pin.h"
#include "widgets/status_bar.h"
#include <algorithm>
@ -78,9 +78,9 @@ static Document* get_more_reliable_document();
static Widget* find_next_editor(Widget* widget);
static int count_parents(Widget* widget);
static void create_mini_editor_frame();
static void hide_mini_editor_frame();
static void update_mini_editor_frame(Editor* editor);
static void create_mini_editor_window();
static void hide_mini_editor_window();
static void update_mini_editor_window(Editor* editor);
class WrappedEditor : public Editor,
public EditorListener,
@ -103,12 +103,12 @@ public:
}
void scrollChanged(Editor* editor) OVERRIDE {
update_mini_editor_frame(editor);
update_mini_editor_window(editor);
}
void documentChanged(Editor* editor) OVERRIDE {
if (editor == current_editor)
update_mini_editor_frame(editor);
update_mini_editor_window(editor);
}
void stateChanged(Editor* editor) OVERRIDE {
@ -173,11 +173,11 @@ public:
}
};
class MiniEditorFrame : public Frame
class MiniEditorWindow : public Window
{
public:
// Create mini-editor
MiniEditorFrame() : Frame(false, "Mini-Editor") {
MiniEditorWindow() : Window(false, "Mini-Editor") {
child_spacing = 0;
set_autoremap(false);
set_wantfocus(false);
@ -190,7 +190,7 @@ protected:
closeButton->getId() == SkinTheme::kThemeCloseButtonId) {
// Here we don't use "enable_mini_editor" to change the state of
// "mini_editor_enabled" because we're coming from a close event
// of the frame.
// of the window.
mini_editor_enabled = false;
// Redraw the tool bar because it shows the mini editor enabled state.
@ -200,7 +200,7 @@ protected:
}
};
static MiniEditorFrame* mini_editor_frame = NULL;
static MiniEditorWindow* mini_editor_window = NULL;
int init_module_editors()
{
@ -212,11 +212,11 @@ void exit_module_editors()
{
set_config_bool("MiniEditor", "Enabled", mini_editor_enabled);
if (mini_editor_frame) {
save_window_pos(mini_editor_frame, "MiniEditor");
if (mini_editor_window) {
save_window_pos(mini_editor_window, "MiniEditor");
delete mini_editor_frame;
mini_editor_frame = NULL;
delete mini_editor_window;
mini_editor_window = NULL;
}
ASSERT(editors.empty());
@ -389,7 +389,7 @@ void set_current_editor(Editor* editor)
app_refresh_screen(document);
app_rebuild_documents_tabs();
update_mini_editor_frame(editor);
update_mini_editor_window(editor);
}
}
@ -582,7 +582,7 @@ void enable_mini_editor(bool state)
{
mini_editor_enabled = state;
update_mini_editor_frame(current_editor);
update_mini_editor_window(current_editor);
}
static int is_document_in_some_editor(Document* document)
@ -637,10 +637,10 @@ static int count_parents(Widget* widget)
return count;
}
static void create_mini_editor_frame()
static void create_mini_editor_window()
{
// Create mini-editor
mini_editor_frame = new MiniEditorFrame();
mini_editor_window = new MiniEditorWindow();
// Create the new for the mini editor
View* newView = new EditorView(EditorView::AlwaysSelected);
@ -652,31 +652,31 @@ static void create_mini_editor_frame()
newView->attachToView(mini_editor);
mini_editor_frame->addChild(newView);
mini_editor_window->addChild(newView);
// Default bounds
int width = JI_SCREEN_W/4;
int height = JI_SCREEN_H/4;
mini_editor_frame->setBounds
mini_editor_window->setBounds
(gfx::Rect(JI_SCREEN_W - width - jrect_w(app_get_toolbar()->rc),
JI_SCREEN_H - height - jrect_h(app_get_statusbar()->rc),
width, height));
load_window_pos(mini_editor_frame, "MiniEditor");
load_window_pos(mini_editor_window, "MiniEditor");
}
static void hide_mini_editor_frame()
static void hide_mini_editor_window()
{
if (mini_editor_frame &&
mini_editor_frame->isVisible()) {
mini_editor_frame->closeWindow(NULL);
if (mini_editor_window &&
mini_editor_window->isVisible()) {
mini_editor_window->closeWindow(NULL);
}
}
static void update_mini_editor_frame(Editor* editor)
static void update_mini_editor_window(Editor* editor)
{
if (!mini_editor_enabled || !editor) {
hide_mini_editor_frame();
hide_mini_editor_window();
return;
}
@ -688,12 +688,12 @@ static void update_mini_editor_frame(Editor* editor)
if (document && document->getSprite() &&
((!mini_editor && editor->getZoom() > 0) ||
(mini_editor && mini_editor->getZoom() != editor->getZoom()))) {
// If the mini frame does not exist, create it
if (!mini_editor_frame)
create_mini_editor_frame();
// If the mini window does not exist, create it
if (!mini_editor_window)
create_mini_editor_window();
if (!mini_editor_frame->isVisible())
mini_editor_frame->open_window_bg();
if (!mini_editor_window->isVisible())
mini_editor_window->openWindow();
gfx::Rect visibleBounds = editor->getVisibleSpriteBounds();
gfx::Point pt = visibleBounds.getCenter();
@ -708,6 +708,6 @@ static void update_mini_editor_frame(Editor* editor)
mini_editor->centerInSpritePoint(pt.x, pt.y);
}
else {
hide_mini_editor_frame();
hide_mini_editor_window();
}
}

View File

@ -952,12 +952,12 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
break;
case JM_KEYPRESSED: {
Frame* toplevel_frame = getTopFrame();
Window* toplevel_window = getTopWindow();
// If there is a foreground window as top level...
if (toplevel_frame &&
toplevel_frame != app_get_top_window() &&
toplevel_frame->is_foreground()) {
if (toplevel_window &&
toplevel_window != app_get_top_window() &&
toplevel_window->is_foreground()) {
// We just do not process keyboard shortcuts for menus and tools
break;
}
@ -1022,7 +1022,7 @@ bool CustomizedGuiManager::onProcessMessage(Message* msg)
// the current window running at foreground.
JLink link;
JI_LIST_FOR_EACH(this->children, link) {
Frame* child = reinterpret_cast<Frame*>(link->data);
Window* child = reinterpret_cast<Window*>(link->data);
// There are a foreground window executing?
if (child->is_foreground()) {

View File

@ -33,9 +33,10 @@ class Params;
namespace ui {
class ButtonBase;
class CheckBox;
class Frame;
class RadioButton;
class Widget;
class Window;
union Message;
}
namespace tools { class Tool; }

View File

@ -82,7 +82,7 @@ protected:
return true;
case JM_DRAW:
static_cast<SkinTheme*>(getTheme())->draw_frame_button(this, &msg->draw.rect);
static_cast<SkinTheme*>(getTheme())->drawWindowButton(this, &msg->draw.rect);
return true;
case JM_KEYPRESSED:
@ -696,8 +696,8 @@ void SkinTheme::init_widget(Widget* widget)
widget->child_spacing = 0;
break;
case JI_FRAME:
if (!static_cast<Frame*>(widget)->is_desktop()) {
case JI_WINDOW:
if (!static_cast<Window*>(widget)->is_desktop()) {
if (widget->hasText()) {
BORDER4(6 * scale, (4+6) * scale, 6 * scale, 6 * scale);
widget->border_width.t += jwidget_get_text_height(widget);
@ -1246,7 +1246,7 @@ void SkinTheme::draw_separator(Widget* widget, JRect clip)
{
int x1, y1, x2, y2;
// frame position
// position
x1 = widget->rc->x1 + widget->border_width.l/2;
y1 = widget->rc->y1 + widget->border_width.t/2;
x2 = widget->rc->x2 - 1 - widget->border_width.r/2;
@ -1578,9 +1578,9 @@ void SkinTheme::draw_view_viewport(Widget* widget, JRect clip)
jdraw_rectfill(widget->rc, BGCOLOR);
}
void SkinTheme::paintFrame(PaintEvent& ev)
void SkinTheme::paintWindow(PaintEvent& ev)
{
Frame* window = static_cast<Frame*>(ev.getSource());
Window* window = static_cast<Window*>(ev.getSource());
JRect pos = jwidget_get_rect(window);
JRect cpos = jwidget_get_child_rect(window);
@ -1621,7 +1621,7 @@ void SkinTheme::paintFrame(PaintEvent& ev)
jrect_free(cpos);
}
void SkinTheme::draw_frame_button(ButtonBase* widget, JRect clip)
void SkinTheme::drawWindowButton(ButtonBase* widget, JRect clip)
{
int part;

View File

@ -90,8 +90,8 @@ public:
void draw_view(ui::Widget* widget, ui::JRect clip);
void draw_view_scrollbar(ui::Widget* widget, ui::JRect clip);
void draw_view_viewport(ui::Widget* widget, ui::JRect clip);
void paintFrame(ui::PaintEvent& ev);
void draw_frame_button(ui::ButtonBase* widget, ui::JRect clip);
void paintWindow(ui::PaintEvent& ev);
void drawWindowButton(ui::ButtonBase* widget, ui::JRect clip);
void paintTooltip(ui::PaintEvent& ev);
int get_button_normal_text_color() const { return makecol(0, 0, 0); }

View File

@ -15,7 +15,6 @@ add_library(ui-lib
event.cpp
font.cpp
fontbmp.cpp
frame.cpp
graphics.cpp
grid.cpp
gui.cpp
@ -29,7 +28,7 @@ add_library(ui-lib
menu.cpp
message.cpp
paint_event.cpp
popup_frame.cpp
popup_window.cpp
preferred_size_event.cpp
property.cpp
rect.cpp
@ -45,4 +44,5 @@ add_library(ui-lib
tooltips.cpp
view.cpp
viewport.cpp
widget.cpp)
widget.cpp
window.cpp)

View File

@ -40,7 +40,7 @@
namespace ui {
Alert::Alert()
: Frame(false, "")
: Window(false, "")
{
// Do nothing
}
@ -84,7 +84,7 @@ int Alert::show(const char* format, ...)
window->processString(buf, labels, buttons);
// Open it
window->open_window_fg();
window->openWindowInForeground();
// Check the killer
int ret = 0;
@ -147,7 +147,7 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
usprintf(buttonId, "button-%d", buttons.size());
button_widget->setId(buttonId);
button_widget->Click.connect(Bind<void>(&Frame::closeWindow, this, button_widget));
button_widget->Click.connect(Bind<void>(&Window::closeWindow, this, button_widget));
}
buf[c] = chr;

View File

@ -8,14 +8,14 @@
#define UI_ALERT_H_INCLUDED
#include "base/shared_ptr.h"
#include "ui/frame.h"
#include "ui/window.h"
namespace ui {
class Alert;
typedef SharedPtr<Alert> AlertPtr;
class Alert : public Frame
class Alert : public Window
{
public:
Alert();

View File

@ -37,11 +37,6 @@ namespace ui {
struct jrect;
struct jregion;
class Frame;
class Theme;
class Widget;
union Message;
// Alignment.
#define JI_HORIZONTAL 0x0001
#define JI_VERTICAL 0x0002
@ -98,7 +93,7 @@ namespace ui {
JI_VIEW,
JI_VIEW_SCROLLBAR,
JI_VIEW_VIEWPORT,
JI_FRAME,
JI_WINDOW,
// User widgets.
JI_USER_WIDGET,

View File

@ -6,14 +6,7 @@
#include "config.h"
#include <allegro/gfx.h>
#include <allegro/keyboard.h>
#include <allegro/timer.h>
#include <queue>
#include <string.h>
#include "ui/button.h"
#include "ui/frame.h"
#include "ui/list.h"
#include "ui/manager.h"
#include "ui/message.h"
@ -21,6 +14,13 @@
#include "ui/rect.h"
#include "ui/theme.h"
#include "ui/widget.h"
#include "ui/window.h"
#include <allegro/gfx.h>
#include <allegro/keyboard.h>
#include <allegro/timer.h>
#include <queue>
#include <string.h>
namespace ui {

View File

@ -439,7 +439,7 @@ void ComboBox::onButtonClick(Event& ev)
void ComboBox::openListBox()
{
if (!m_window) {
m_window = new Frame(false, NULL);
m_window = new Window(false, NULL);
View* view = new View();
m_listbox = new ComboBoxListBox(this);
@ -474,7 +474,7 @@ void ComboBox::openListBox()
getManager()->addMessageFilter(JM_BUTTONPRESSED, this);
m_window->open_window_bg();
m_window->openWindow();
getManager()->setFocus(m_listbox);
}
}

View File

@ -18,8 +18,8 @@ namespace ui {
class Button;
class Entry;
class Frame;
class ListBox;
class Window;
class ComboBox : public Widget
{
@ -74,7 +74,7 @@ namespace ui {
Entry* m_entry;
Button* m_button;
Frame* m_window;
Window* m_window;
ListBox* m_listbox;
std::vector<Item*> m_items;
int m_selected;

View File

@ -20,7 +20,6 @@
#include "ui/entry.h"
#include "ui/event.h"
#include "ui/font.h"
#include "ui/frame.h"
#include "ui/graphics.h"
#include "ui/grid.h"
#include "ui/hit_test_event.h"
@ -34,7 +33,7 @@
#include "ui/menu.h"
#include "ui/message.h"
#include "ui/paint_event.h"
#include "ui/popup_frame.h"
#include "ui/popup_window.h"
#include "ui/preferred_size_event.h"
#include "ui/property.h"
#include "ui/rect.h"
@ -52,5 +51,6 @@
#include "ui/viewport.h"
#include "ui/widget.h"
#include "ui/widgets_list.h"
#include "ui/window.h"
#endif

View File

@ -6,10 +6,10 @@
#include "config.h"
#include "ui/frame.h"
#include "ui/manager.h"
#include "ui/theme.h"
#include "ui/widget.h"
#include "ui/window.h"
#include <list>
@ -62,8 +62,8 @@ void _ji_reinit_theme_in_all_widgets()
// Remap the windows
for (std::list<Widget*>::iterator it=widgets->begin(), end=widgets->end();
it != end; ++it) {
if ((*it)->type == JI_FRAME)
static_cast<Frame*>(*it)->remap_window();
if ((*it)->type == JI_WINDOW)
static_cast<Window*>(*it)->remap_window();
}
// Redraw the whole screen

View File

@ -14,8 +14,8 @@ struct BITMAP;
namespace ui {
class Frame;
class Widget;
class Window;
//////////////////////////////////////////////////////////////////////
// jintern.c

View File

@ -380,7 +380,7 @@ bool Manager::generateMessages()
if (msg->type == JM_BUTTONPRESSED &&
!capture_widget && mouse_widget) {
// The clicked window
Frame* window = mouse_widget->getRoot();
Window* window = mouse_widget->getRoot();
Manager* win_manager = (window ? window->getManager(): NULL);
if ((window) &&
@ -391,7 +391,7 @@ bool Manager::generateMessages()
// which should be kept on top of the foreground one.
(!window->is_foreground()) &&
// If the window is not already the top window of the manager.
(window != win_manager->getTopFrame())) {
(window != win_manager->getTopWindow())) {
// Put it in the top of the list
jlist_remove(win_manager->children, window);
@ -400,7 +400,7 @@ bool Manager::generateMessages()
else {
int pos = jlist_length(win_manager->children);
JI_LIST_FOR_EACH_BACK(win_manager->children, link) {
if (((Frame*)link->data)->is_ontop())
if (((Window*)link->data)->is_ontop())
break;
pos--;
}
@ -531,19 +531,19 @@ void Manager::enqueueMessage(Message* msg)
jmessage_free(msg);
}
Frame* Manager::getTopFrame()
Window* Manager::getTopWindow()
{
return reinterpret_cast<Frame*>(jlist_first_data(this->children));
return reinterpret_cast<Window*>(jlist_first_data(this->children));
}
Frame* Manager::getForegroundFrame()
Window* Manager::getForegroundWindow()
{
JLink link;
JI_LIST_FOR_EACH(this->children, link) {
Frame* frame = (Frame*)link->data;
if (frame->is_foreground() ||
frame->is_desktop())
return frame;
Window* window = (Window*)link->data;
if (window->is_foreground() ||
window->is_desktop())
return window;
}
return NULL;
}
@ -832,7 +832,7 @@ void Manager::removeMessageFilterFor(Widget* widget)
}
/* configures the window for begin the loop */
void Manager::_openWindow(Frame* window)
void Manager::_openWindow(Window* window)
{
// Free all widgets of special states.
if (window->is_wantfocus()) {
@ -854,7 +854,7 @@ void Manager::_openWindow(Frame* window)
jlist_append(new_windows, window);
}
void Manager::_closeWindow(Frame* window, bool redraw_background)
void Manager::_closeWindow(Window* window, bool redraw_background)
{
Message* msg;
JRegion reg1;
@ -879,7 +879,7 @@ void Manager::_closeWindow(Frame* window, bool redraw_background)
jregion_union(reg1, reg1, reg2);
jregion_free(reg2);
_closeWindow(reinterpret_cast<Frame*>(link->data), false);
_closeWindow(reinterpret_cast<Window*>(link->data), false);
}
}
}
@ -938,7 +938,7 @@ bool Manager::onProcessMessage(Message* msg)
// Continue sending the message to the children of all windows
// (until a desktop or foreground window).
JI_LIST_FOR_EACH(this->children, link) {
Frame* w = (Frame*)link->data;
Window* w = (Window*)link->data;
// Send to the window.
JI_LIST_FOR_EACH(w->children, link2)
@ -964,7 +964,7 @@ bool Manager::onProcessMessage(Message* msg)
void Manager::onBroadcastMouseMessage(WidgetsList& targets)
{
// Ask to the first frame in the "children" list to know how to
// Ask to the first window in the "children" list to know how to
// propagate mouse messages.
Widget* widget = reinterpret_cast<Widget*>(jlist_first_data(children));
if (widget)
@ -1169,7 +1169,7 @@ void Manager::invalidateDisplayRegion(const JRegion region)
// Redraw windows from top to background.
JI_LIST_FOR_EACH(this->children, link) {
Frame* window = (Frame*)link->data;
Window* window = (Window*)link->data;
// Invalidate regions of this window
window->invalidateRegion(reg1);
@ -1316,7 +1316,7 @@ static bool move_focus(Manager* manager, Message* msg)
Widget* focus = NULL;
Widget* it;
bool ret = false;
Frame* window = NULL;
Window* window = NULL;
int c, count;
// Who have the focus
@ -1324,7 +1324,7 @@ static bool move_focus(Manager* manager, Message* msg)
window = focus_widget->getRoot();
}
else if (!jlist_empty(manager->children)) {
window = manager->getTopFrame();
window = manager->getTopWindow();
}
if (!window)

View File

@ -12,7 +12,7 @@
namespace ui {
class Frame;
class Window;
class Timer;
class Manager : public Widget
@ -35,8 +35,8 @@ namespace ui {
void enqueueMessage(Message* msg);
Frame* getTopFrame();
Frame* getForegroundFrame();
Window* getTopWindow();
Window* getForegroundWindow();
Widget* getFocus();
Widget* getMouse();
@ -61,8 +61,8 @@ namespace ui {
void invalidateDisplayRegion(const JRegion region);
void _openWindow(Frame* window);
void _closeWindow(Frame* frame, bool redraw_background);
void _openWindow(Window* window);
void _closeWindow(Window* window, bool redraw_background);
protected:
bool onProcessMessage(Message* msg) OVERRIDE;

View File

@ -72,11 +72,11 @@ struct MenuBaseData
};
class CustomizedWindowForMenuBox : public Frame
class CustomizedWindowForMenuBox : public Window
{
public:
CustomizedWindowForMenuBox(MenuBox* menubox)
: Frame(false, NULL)
: Window(false, NULL)
{
set_moveable(false); // Can't move the window
addChild(menubox);
@ -94,7 +94,7 @@ protected:
break;
}
return Frame::onProcessMessage(msg);
return Window::onProcessMessage(msg);
}
};
@ -259,7 +259,7 @@ void Menu::showPopup(int x, int y)
} while (jmouse_b(0));
// New window and new menu-box
Frame* window = new Frame(false, NULL);
Window* window = new Window(false, NULL);
MenuBox* menubox = new MenuBox();
MenuBaseData* base = menubox->createBase();
base->was_clicked = true;
@ -283,7 +283,7 @@ void Menu::showPopup(int x, int y)
menubox->setFocusMagnet(true);
// Open the window
window->open_window_fg();
window->openWindowInForeground();
// Free the keyboard focus
Manager::getDefault()->freeFocus();
@ -748,7 +748,7 @@ bool MenuItem::onProcessMessage(Message* msg)
menubox->setMenu(m_submenu);
// New window and new menu-box
Frame* window = new CustomizedWindowForMenuBox(menubox);
Window* window = new CustomizedWindowForMenuBox(menubox);
// Menubox position
pos = jwidget_get_rect(window);
@ -825,7 +825,7 @@ bool MenuItem::onProcessMessage(Message* msg)
m_submenu->unhighlightItem();
// Run in background
window->open_window_bg();
window->openWindow();
base->is_processing = false;
@ -834,7 +834,7 @@ bool MenuItem::onProcessMessage(Message* msg)
}
else if (msg->type == JM_CLOSE_MENUITEM) {
MenuBaseData* base = get_base(this);
Frame* window;
Window* window;
bool last_of_close_chain = (msg->user.a ? true: false);
ASSERT(base != NULL);
@ -845,8 +845,8 @@ bool MenuItem::onProcessMessage(Message* msg)
ASSERT(menubox != NULL);
window = (Frame*)menubox->parent;
ASSERT(window && window->type == JI_FRAME);
window = (Window*)menubox->parent;
ASSERT(window && window->type == JI_WINDOW);
// Fetch the "menu" to avoid destroy it with 'delete'.
menubox->setMenu(NULL);

View File

@ -13,6 +13,7 @@
namespace ui {
class Timer;
class Widget;
/* TODO add mutexes */
#define JM_MESSAGE(name) \

View File

@ -19,8 +19,8 @@ using namespace gfx;
namespace ui {
PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed)
: Frame(false, text)
PopupWindow::PopupWindow(const char* text, bool close_on_buttonpressed)
: Window(false, text)
{
m_close_on_buttonpressed = close_on_buttonpressed;
m_hot_region = NULL;
@ -40,7 +40,7 @@ PopupFrame::PopupFrame(const char* text, bool close_on_buttonpressed)
jwidget_noborders(this);
}
PopupFrame::~PopupFrame()
PopupWindow::~PopupWindow()
{
stopFilteringMessages();
@ -52,7 +52,7 @@ PopupFrame::~PopupFrame()
* @param region The new hot-region. This pointer is holded by the @a widget.
* So you cannot destroy it after calling this routine.
*/
void PopupFrame::setHotRegion(JRegion region)
void PopupWindow::setHotRegion(JRegion region)
{
ASSERT(region != NULL);
@ -64,19 +64,19 @@ void PopupFrame::setHotRegion(JRegion region)
m_hot_region = region;
}
void PopupFrame::makeFloating()
void PopupWindow::makeFloating()
{
stopFilteringMessages();
set_moveable(true);
}
void PopupFrame::makeFixed()
void PopupWindow::makeFixed()
{
startFilteringMessages();
set_moveable(false);
}
bool PopupFrame::onProcessMessage(Message* msg)
bool PopupWindow::onProcessMessage(Message* msg)
{
switch (msg->type) {
@ -98,7 +98,7 @@ bool PopupFrame::onProcessMessage(Message* msg)
}
// If we are filtering messages we don't propagate key-events
// to other widgets. As we're a popup frame and we're
// to other widgets. As we're a popup window and we're
// filtering messages, the user shouldn't be able to start
// other actions pressing keyboard shortcuts.
return false;
@ -135,10 +135,10 @@ bool PopupFrame::onProcessMessage(Message* msg)
}
return Frame::onProcessMessage(msg);
return Window::onProcessMessage(msg);
}
void PopupFrame::onPreferredSize(PreferredSizeEvent& ev)
void PopupWindow::onPreferredSize(PreferredSizeEvent& ev)
{
ScreenGraphics g;
g.setFont(getFont());
@ -174,7 +174,7 @@ void PopupFrame::onPreferredSize(PreferredSizeEvent& ev)
ev.setPreferredSize(resultSize);
}
void PopupFrame::onPaint(PaintEvent& ev)
void PopupWindow::onPaint(PaintEvent& ev)
{
Graphics* g = ev.getGraphics();
gfx::Rect pos = getClientBounds();
@ -188,7 +188,7 @@ void PopupFrame::onPaint(PaintEvent& ev)
g->drawString(getText(), ji_color_foreground(), this->getBgColor(), pos, getAlign());
}
void PopupFrame::onInitTheme(InitThemeEvent& ev)
void PopupWindow::onInitTheme(InitThemeEvent& ev)
{
Widget::onInitTheme(ev);
@ -198,7 +198,7 @@ void PopupFrame::onInitTheme(InitThemeEvent& ev)
this->border_width.b = 3 * jguiscale();
}
void PopupFrame::startFilteringMessages()
void PopupWindow::startFilteringMessages()
{
if (!m_filtering) {
m_filtering = true;
@ -210,7 +210,7 @@ void PopupFrame::startFilteringMessages()
}
}
void PopupFrame::stopFilteringMessages()
void PopupWindow::stopFilteringMessages()
{
if (m_filtering) {
m_filtering = false;

View File

@ -4,19 +4,19 @@
// This source file is ditributed under a BSD-like license, please
// read LICENSE.txt for more information.
#ifndef UI_POPUP_FRAME_H_INCLUDED
#define UI_POPUP_FRAME_H_INCLUDED
#ifndef UI_POPUP_WINDOW_H_INCLUDED
#define UI_POPUP_WINDOW_H_INCLUDED
#include "base/compiler_specific.h"
#include "ui/frame.h"
#include "ui/window.h"
namespace ui {
class PopupFrame : public Frame
class PopupWindow : public Window
{
public:
PopupFrame(const char* text, bool close_on_buttonpressed);
~PopupFrame();
PopupWindow(const char* text, bool close_on_buttonpressed);
~PopupWindow();
void setHotRegion(JRegion region);

View File

@ -19,6 +19,7 @@ namespace ui {
class Menu;
class MenuItem;
class PaintEvent;
class Widget;
class Theme
{
@ -69,7 +70,7 @@ namespace ui {
virtual void draw_view(Widget* widget, JRect clip) = 0;
virtual void draw_view_scrollbar(Widget* widget, JRect clip) = 0;
virtual void draw_view_viewport(Widget* widget, JRect clip) = 0;
virtual void paintFrame(PaintEvent& ev) = 0;
virtual void paintWindow(PaintEvent& ev) = 0;
virtual void paintTooltip(PaintEvent& ev) = 0;
protected:

View File

@ -143,7 +143,7 @@ void TooltipManager::onTick()
m_tipWindow->position_window(MID(0, x, JI_SCREEN_W-w),
MID(0, y, JI_SCREEN_H-h));
m_tipWindow->open_window();
m_tipWindow->openWindow();
}
m_timer->stop();
}
@ -151,7 +151,7 @@ void TooltipManager::onTick()
// TipWindow
TipWindow::TipWindow(const char *text, bool close_on_buttonpressed)
: Frame(false, text)
: Window(false, text)
{
JLink link, next;
@ -269,7 +269,7 @@ bool TipWindow::onProcessMessage(Message* msg)
}
return Frame::onProcessMessage(msg);
return Window::onProcessMessage(msg);
}
void TipWindow::onPreferredSize(PreferredSizeEvent& ev)
@ -307,7 +307,7 @@ void TipWindow::onPreferredSize(PreferredSizeEvent& ev)
void TipWindow::onInitTheme(InitThemeEvent& ev)
{
Frame::onInitTheme(ev);
Window::onInitTheme(ev);
this->border_width.l = 6 * jguiscale();
this->border_width.t = 6 * jguiscale();

View File

@ -9,7 +9,7 @@
#include "base/compiler_specific.h"
#include "ui/base.h"
#include "ui/frame.h"
#include "ui/window.h"
#include <map>
@ -51,7 +51,7 @@ namespace ui {
} m_target;
};
class TipWindow : public Frame
class TipWindow : public Window
{
public:
TipWindow(const char *text, bool close_on_buttonpressed = false);

View File

@ -346,13 +346,13 @@ bool Widget::isFocusMagnet() const
// PARENTS & CHILDREN
// ===============================================================
Frame* Widget::getRoot()
Window* Widget::getRoot()
{
Widget* widget = this;
while (widget) {
if (widget->type == JI_FRAME)
return dynamic_cast<Frame*>(widget);
if (widget->type == JI_WINDOW)
return dynamic_cast<Window*>(widget);
widget = widget->parent;
}
@ -595,7 +595,7 @@ JRegion jwidget_get_region(Widget* widget)
ASSERT_VALID_WIDGET(widget);
if (widget->type == JI_FRAME)
if (widget->type == JI_WINDOW)
region = widget->getTheme()->get_window_mask(widget);
else
region = jregion_new(widget->rc, 1);
@ -1071,8 +1071,8 @@ bool Widget::sendMessage(Message* msg)
void Widget::closeWindow()
{
if (Frame* frame = getRoot())
frame->closeWindow(this);
if (Window* window = getRoot())
window->closeWindow(this);
}
void Widget::broadcastMouseMessage(WidgetsList& targets)

View File

@ -25,11 +25,14 @@ struct BITMAP;
namespace ui {
class PaintEvent;
class PreferredSizeEvent;
union Message;
class InitThemeEvent;
class Manager;
class Frame;
class PaintEvent;
class PreferredSizeEvent;
class Theme;
class Window;
int ji_register_widget_type();
@ -193,7 +196,7 @@ namespace ui {
// PARENTS & CHILDREN
// ===============================================================
Frame* getRoot();
Window* getRoot();
Widget* getParent();
Manager* getManager();

View File

@ -33,8 +33,8 @@ static int press_x, press_y;
static void displace_widgets(Widget* widget, int x, int y);
Frame::Frame(bool desktop, const char* text)
: Widget(JI_FRAME)
Window::Window(bool desktop, const char* text)
: Widget(JI_WINDOW)
{
m_killer = NULL;
m_is_desktop = desktop;
@ -52,55 +52,55 @@ Frame::Frame(bool desktop, const char* text)
initTheme();
}
Frame::~Frame()
Window::~Window()
{
getManager()->_closeWindow(this, false);
}
Widget* Frame::get_killer()
Widget* Window::get_killer()
{
return m_killer;
}
void Frame::set_autoremap(bool state)
void Window::set_autoremap(bool state)
{
m_is_autoremap = state;
}
void Frame::set_moveable(bool state)
void Window::set_moveable(bool state)
{
m_is_moveable = state;
}
void Frame::set_sizeable(bool state)
void Window::set_sizeable(bool state)
{
m_is_sizeable = state;
}
void Frame::set_ontop(bool state)
void Window::set_ontop(bool state)
{
m_is_ontop = state;
}
void Frame::set_wantfocus(bool state)
void Window::set_wantfocus(bool state)
{
m_is_wantfocus = state;
}
HitTest Frame::hitTest(const gfx::Point& point)
HitTest Window::hitTest(const gfx::Point& point)
{
HitTestEvent ev(this, point, HitTestNowhere);
onHitTest(ev);
return ev.getHit();
}
void Frame::onClose(CloseEvent& ev)
void Window::onClose(CloseEvent& ev)
{
// Fire Close signal
Close(ev);
}
void Frame::onHitTest(HitTestEvent& ev)
void Window::onHitTest(HitTestEvent& ev)
{
HitTest ht = HitTestNowhere;
@ -168,7 +168,7 @@ void Frame::onHitTest(HitTestEvent& ev)
ev.setHit(ht);
}
void Frame::remap_window()
void Window::remap_window()
{
Size reqSize;
JRect rect;
@ -189,7 +189,7 @@ void Frame::remap_window()
invalidate();
}
void Frame::center_window()
void Window::center_window()
{
Widget* manager = getManager();
@ -200,7 +200,7 @@ void Frame::center_window()
jrect_h(manager->rc)/2 - jrect_h(this->rc)/2);
}
void Frame::position_window(int x, int y)
void Window::position_window(int x, int y)
{
JRect rect;
@ -214,12 +214,12 @@ void Frame::position_window(int x, int y)
invalidate();
}
void Frame::move_window(JRect rect)
void Window::move_window(JRect rect)
{
move_window(rect, true);
}
void Frame::open_window()
void Window::openWindow()
{
if (!this->parent) {
if (m_is_autoremap)
@ -229,9 +229,9 @@ void Frame::open_window()
}
}
void Frame::open_window_fg()
void Window::openWindowInForeground()
{
open_window();
openWindow();
Manager* manager = getManager();
@ -245,12 +245,7 @@ void Frame::open_window_fg()
m_is_foreground = false;
}
void Frame::open_window_bg()
{
this->open_window();
}
void Frame::closeWindow(Widget* killer)
void Window::closeWindow(Widget* killer)
{
m_killer = killer;
@ -261,7 +256,7 @@ void Frame::closeWindow(Widget* killer)
onClose(ev);
}
bool Frame::is_toplevel()
bool Window::is_toplevel()
{
Widget* manager = getManager();
@ -271,7 +266,7 @@ bool Frame::is_toplevel()
return false;
}
bool Frame::onProcessMessage(Message* msg)
bool Window::onProcessMessage(Message* msg)
{
switch (msg->type) {
@ -450,7 +445,7 @@ bool Frame::onProcessMessage(Message* msg)
return Widget::onProcessMessage(msg);
}
void Frame::onPreferredSize(PreferredSizeEvent& ev)
void Window::onPreferredSize(PreferredSizeEvent& ev)
{
Widget* manager = getManager();
@ -485,17 +480,17 @@ void Frame::onPreferredSize(PreferredSizeEvent& ev)
}
}
void Frame::onPaint(PaintEvent& ev)
void Window::onPaint(PaintEvent& ev)
{
getTheme()->paintFrame(ev);
getTheme()->paintWindow(ev);
}
void Frame::onBroadcastMouseMessage(WidgetsList& targets)
void Window::onBroadcastMouseMessage(WidgetsList& targets)
{
targets.push_back(this);
// Continue sending the message to siblings frames until a desktop
// or foreground frame.
// Continue sending the message to siblings windows until a desktop
// or foreground window.
if (is_foreground() || is_desktop())
return;
@ -504,13 +499,13 @@ void Frame::onBroadcastMouseMessage(WidgetsList& targets)
sibling->broadcastMouseMessage(targets);
}
void Frame::onSetText()
void Window::onSetText()
{
Widget::onSetText();
initTheme();
}
void Frame::window_set_position(JRect rect)
void Window::window_set_position(JRect rect)
{
Widget* child;
JRect cpos;
@ -533,13 +528,13 @@ void Frame::window_set_position(JRect rect)
jrect_free(cpos);
}
void Frame::limit_size(int *w, int *h)
void Window::limit_size(int *w, int *h)
{
*w = MAX(*w, this->border_width.l+this->border_width.r);
*h = MAX(*h, this->border_width.t+this->border_width.b);
}
void Frame::move_window(JRect rect, bool use_blit)
void Window::move_window(JRect rect, bool use_blit)
{
#define FLAGS JI_GDR_CUTTOPWINDOWS | JI_GDR_USECHILDAREA

View File

@ -4,8 +4,8 @@
// This source file is ditributed under a BSD-like license, please
// read LICENSE.txt for more information.
#ifndef UI_FRAME_H_INCLUDED
#define UI_FRAME_H_INCLUDED
#ifndef UI_WINDOW_H_INCLUDED
#define UI_WINDOW_H_INCLUDED
#include "base/compiler_specific.h"
#include "base/signal.h"
@ -17,11 +17,11 @@
namespace ui {
class Frame : public Widget
class Window : public Widget
{
public:
Frame(bool is_desktop, const char* text);
~Frame();
Window(bool is_desktop, const char* text);
~Window();
Widget* get_killer();
@ -36,9 +36,8 @@ namespace ui {
void position_window(int x, int y);
void move_window(JRect rect);
void open_window();
void open_window_fg();
void open_window_bg();
void openWindow();
void openWindowInForeground();
void closeWindow(Widget* killer);
bool is_toplevel();

View File

@ -49,7 +49,7 @@ ColorButton::ColorButton(const Color& color, PixelFormat pixelFormat)
: ButtonBase("", colorbutton_type(), JI_BUTTON, JI_BUTTON)
, m_color(color)
, m_pixelFormat(pixelFormat)
, m_frame(NULL)
, m_window(NULL)
{
this->setFocusStop(true);
@ -58,7 +58,7 @@ ColorButton::ColorButton(const Color& color, PixelFormat pixelFormat)
ColorButton::~ColorButton()
{
delete m_frame; // widget, frame
delete m_window; // widget, window
}
PixelFormat ColorButton::getPixelFormat() const
@ -81,9 +81,9 @@ void ColorButton::setColor(const Color& color)
{
m_color = color;
// Change the color in its related frame
if (m_frame)
m_frame->setColor(m_color, ColorSelector::DoNotChangeType);
// Change the color in its related window
if (m_window)
m_window->setColor(m_color, ColorSelector::DoNotChangeType);
// Emit signal
Change(color);
@ -96,8 +96,8 @@ bool ColorButton::onProcessMessage(Message* msg)
switch (msg->type) {
case JM_CLOSE:
if (m_frame && m_frame->isVisible())
m_frame->closeWindow(NULL);
if (m_window && m_window->isVisible())
m_window->closeWindow(NULL);
break;
case JM_MOUSEENTER:
@ -219,11 +219,11 @@ void ColorButton::onClick(Event& ev)
ButtonBase::onClick(ev);
// If the popup window was not created or shown yet..
if (m_frame == NULL || !m_frame->isVisible()) {
if (m_window == NULL || !m_window->isVisible()) {
// Open it
openSelectorDialog();
}
else if (!m_frame->is_moveable()) {
else if (!m_window->is_moveable()) {
// If it is visible, close it
closeSelectorDialog();
}
@ -233,46 +233,46 @@ void ColorButton::openSelectorDialog()
{
int x, y;
if (m_frame == NULL) {
m_frame = new ColorSelector();
m_frame->user_data[0] = this;
m_frame->ColorChange.connect(&ColorButton::onFrameColorChange, this);
if (m_window == NULL) {
m_window = new ColorSelector();
m_window->user_data[0] = this;
m_window->ColorChange.connect(&ColorButton::onWindowColorChange, this);
}
m_frame->setColor(m_color, ColorSelector::ChangeType);
m_frame->open_window();
m_window->setColor(m_color, ColorSelector::ChangeType);
m_window->openWindow();
x = MID(0, this->rc->x1, JI_SCREEN_W-jrect_w(m_frame->rc));
if (this->rc->y2 <= JI_SCREEN_H-jrect_h(m_frame->rc))
x = MID(0, this->rc->x1, JI_SCREEN_W-jrect_w(m_window->rc));
if (this->rc->y2 <= JI_SCREEN_H-jrect_h(m_window->rc))
y = MAX(0, this->rc->y2);
else
y = MAX(0, this->rc->y1-jrect_h(m_frame->rc));
y = MAX(0, this->rc->y1-jrect_h(m_window->rc));
m_frame->position_window(x, y);
m_window->position_window(x, y);
m_frame->getManager()->dispatchMessages();
m_frame->layout();
m_window->getManager()->dispatchMessages();
m_window->layout();
/* setup the hot-region */
{
JRect rc = jrect_new(MIN(this->rc->x1, m_frame->rc->x1)-8,
MIN(this->rc->y1, m_frame->rc->y1)-8,
MAX(this->rc->x2, m_frame->rc->x2)+8,
MAX(this->rc->y2, m_frame->rc->y2)+8);
JRect rc = jrect_new(MIN(this->rc->x1, m_window->rc->x1)-8,
MIN(this->rc->y1, m_window->rc->y1)-8,
MAX(this->rc->x2, m_window->rc->x2)+8,
MAX(this->rc->y2, m_window->rc->y2)+8);
JRegion rgn = jregion_new(rc, 1);
jrect_free(rc);
static_cast<PopupFrame*>(m_frame)->setHotRegion(rgn);
static_cast<PopupWindow*>(m_window)->setHotRegion(rgn);
}
}
void ColorButton::closeSelectorDialog()
{
if (m_frame != NULL)
m_frame->closeWindow(NULL);
if (m_window != NULL)
m_window->closeWindow(NULL);
}
void ColorButton::onFrameColorChange(const Color& color)
void ColorButton::onWindowColorChange(const Color& color)
{
setColor(color);
}

View File

@ -52,11 +52,11 @@ protected:
private:
void openSelectorDialog();
void closeSelectorDialog();
void onFrameColorChange(const Color& color);
void onWindowColorChange(const Color& color);
Color m_color;
PixelFormat m_pixelFormat;
ColorSelector* m_frame;
ColorSelector* m_window;
};
#endif

View File

@ -38,7 +38,7 @@
using namespace ui;
ColorSelector::ColorSelector()
: PopupFramePin("Color Selector", false)
: PopupWindowPin("Color Selector", false)
, m_color(Color::fromMask())
, m_vbox(JI_VERTICAL)
, m_topBox(JI_HORIZONTAL)

View File

@ -28,9 +28,9 @@
#include "widgets/color_sliders.h"
#include "widgets/hex_color_entry.h"
#include "widgets/palette_view.h"
#include "widgets/popup_frame_pin.h"
#include "widgets/popup_window_pin.h"
class ColorSelector : public PopupFramePin
class ColorSelector : public PopupWindowPin
{
public:
enum SetColorOptions {

View File

@ -167,7 +167,7 @@ public:
};
FileSelector::FileSelector()
: Frame(false, "")
: Window(false, "")
{
app::WidgetLoader loader;
loader.addWidgetType("filenameentry", new CustomFileNameEntryCreator);
@ -316,7 +316,7 @@ base::string FileSelector::show(const base::string& title,
// open the window and run... the user press ok?
again:
open_window_fg();
openWindowInForeground();
if (get_killer() == ok ||
get_killer() == m_fileList) {
// open the selected file

View File

@ -21,7 +21,7 @@
#include "base/string.h"
#include "base/unique_ptr.h"
#include "ui/frame.h"
#include "ui/window.h"
class IFileItem;
@ -36,7 +36,7 @@ namespace widgets {
class FileList;
class CustomFileNameEntry;
class FileSelector : public ui::Frame
class FileSelector : public ui::Window
{
public:
FileSelector();

View File

@ -18,7 +18,7 @@
#include "config.h"
#include "widgets/popup_frame_pin.h"
#include "widgets/popup_window_pin.h"
#include "base/bind.h"
#include "gfx/border.h"
@ -33,8 +33,8 @@
using namespace ui;
PopupFramePin::PopupFramePin(const char* text, bool close_on_buttonpressed)
: PopupFrame(text, close_on_buttonpressed)
PopupWindowPin::PopupWindowPin(const char* text, bool close_on_buttonpressed)
: PopupWindow(text, close_on_buttonpressed)
, m_pin("")
{
// Configure the micro check-box look without borders, only the "pin" icon is shown.
@ -42,12 +42,12 @@ PopupFramePin::PopupFramePin(const char* text, bool close_on_buttonpressed)
m_pin.child_spacing = 0;
m_pin.setBorder(gfx::Border(0));
m_pin.Click.connect(&PopupFramePin::onPinClick, this);
m_pin.Click.connect(&PopupWindowPin::onPinClick, this);
set_gfxicon_to_button(&m_pin, PART_UNPINNED, PART_PINNED, PART_UNPINNED, JI_CENTER | JI_MIDDLE);
}
void PopupFramePin::onPinClick(Event& ev)
void PopupWindowPin::onPinClick(Event& ev)
{
if (m_pin.isSelected()) {
makeFloating();
@ -62,7 +62,7 @@ void PopupFramePin::onPinClick(Event& ev)
}
}
bool PopupFramePin::onProcessMessage(Message* msg)
bool PopupWindowPin::onProcessMessage(Message* msg)
{
switch (msg->type) {
@ -77,12 +77,12 @@ bool PopupFramePin::onProcessMessage(Message* msg)
}
return PopupFrame::onProcessMessage(msg);
return PopupWindow::onProcessMessage(msg);
}
void PopupFramePin::onHitTest(HitTestEvent& ev)
void PopupWindowPin::onHitTest(HitTestEvent& ev)
{
PopupFrame::onHitTest(ev);
PopupWindow::onHitTest(ev);
if (m_pin.isSelected() &&
ev.getHit() == HitTestClient) {

View File

@ -20,12 +20,12 @@
#define WIDGETS_POPUP_FRAME_PIN_H_INCLUDED
#include "ui/button.h"
#include "ui/popup_frame.h"
#include "ui/popup_window.h"
class PopupFramePin : public ui::PopupFrame
class PopupWindowPin : public ui::PopupWindow
{
public:
PopupFramePin(const char* text, bool close_on_buttonpressed);
PopupWindowPin(const char* text, bool close_on_buttonpressed);
protected:
virtual bool onProcessMessage(ui::Message* msg) OVERRIDE;

View File

@ -337,7 +337,7 @@ void StatusBar::showTip(int msecs, const char *format, ...)
if (m_tipwindow->isVisible())
m_tipwindow->closeWindow(NULL);
m_tipwindow->open_window();
m_tipwindow->openWindow();
m_tipwindow->remap_window();
x = this->rc->x2 - jrect_w(m_tipwindow->rc);

View File

@ -36,8 +36,8 @@ namespace ui {
class Box;
class Button;
class Entry;
class Frame;
class Slider;
class Window;
}
namespace tools {

View File

@ -60,7 +60,7 @@ class ToolBar : public Widget
bool m_open_on_hot;
// Window displayed to show a tool-group
PopupFrame* m_popupFrame;
PopupWindow* m_popupWindow;
// Tool-tip window
TipWindow* m_tipWindow;
@ -87,7 +87,7 @@ protected:
private:
int getToolGroupIndex(ToolGroup* group);
void openPopupFrame(int group_index, ToolGroup* group);
void openPopupWindow(int group_index, ToolGroup* group);
Rect getToolGroupBounds(int group_index);
Point getToolPositionInGroup(int group_index, Tool* tool);
void openTipWindow(int group_index, Tool* tool);
@ -95,7 +95,7 @@ private:
};
// Class to show a group of tools (horizontally)
// This widget is inside the ToolBar::m_popupFrame
// This widget is inside the ToolBar::m_popupWindow
class ToolStrip : public Widget
{
ToolGroup* m_group;
@ -158,7 +158,7 @@ ToolBar::ToolBar()
m_hot_tool = NULL;
m_hot_index = NoneIndex;
m_open_on_hot = false;
m_popupFrame = NULL;
m_popupWindow = NULL;
m_tipWindow = NULL;
m_tipOpened = false;
@ -172,7 +172,7 @@ ToolBar::ToolBar()
ToolBar::~ToolBar()
{
delete m_popupFrame;
delete m_popupWindow;
delete m_tipWindow;
}
@ -300,7 +300,7 @@ bool ToolBar::onProcessMessage(Message* msg)
UIContext::instance()->getSettings()->setCurrentTool(tool);
invalidate();
openPopupFrame(c, tool_group);
openPopupWindow(c, tool_group);
}
}
@ -339,7 +339,7 @@ bool ToolBar::onProcessMessage(Message* msg)
new_hot_index = c;
if ((m_open_on_hot) && (m_hot_tool != new_hot_tool))
openPopupFrame(c, tool_group);
openPopupWindow(c, tool_group);
break;
}
}
@ -375,7 +375,7 @@ bool ToolBar::onProcessMessage(Message* msg)
case JM_MOUSELEAVE:
closeTipWindow();
if (!m_popupFrame)
if (!m_popupWindow)
m_tipOpened = false;
m_hot_tool = NULL;
@ -388,7 +388,7 @@ bool ToolBar::onProcessMessage(Message* msg)
case JM_TIMER:
if (msg->timer.timer == &m_tipTimer) {
if (m_tipWindow)
m_tipWindow->open_window();
m_tipWindow->openWindow();
m_tipTimer.stop();
m_tipOpened = true;
@ -414,13 +414,13 @@ int ToolBar::getToolGroupIndex(ToolGroup* group)
return -1;
}
void ToolBar::openPopupFrame(int group_index, ToolGroup* tool_group)
void ToolBar::openPopupWindow(int group_index, ToolGroup* tool_group)
{
// Close the current popup window
if (m_popupFrame) {
m_popupFrame->closeWindow(NULL);
delete m_popupFrame;
m_popupFrame = NULL;
if (m_popupWindow) {
m_popupWindow->closeWindow(NULL);
delete m_popupWindow;
m_popupWindow = NULL;
}
// Close tip window
@ -439,11 +439,11 @@ void ToolBar::openPopupFrame(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_popupFrame = new PopupFrame(NULL, false);
m_popupFrame->Close.connect(Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this));
m_popupWindow = new PopupWindow(NULL, false);
m_popupWindow->Close.connect(Bind<void, ToolBar, ToolBar>(&ToolBar::onClosePopup, this));
ToolStrip* toolstrip = new ToolStrip(tool_group, this);
m_popupFrame->addChild(toolstrip);
m_popupWindow->addChild(toolstrip);
Rect rc = getToolGroupBounds(group_index);
int w = 0;
@ -475,13 +475,13 @@ void ToolBar::openPopupFrame(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_popupFrame->setHotRegion(hotregion);
m_popupWindow->setHotRegion(hotregion);
}
m_popupFrame->set_autoremap(false);
m_popupFrame->setBounds(rc);
m_popupWindow->set_autoremap(false);
m_popupWindow->setBounds(rc);
toolstrip->setBounds(rc);
m_popupFrame->open_window();
m_popupWindow->openWindow();
toolstrip->setBounds(rc);
}
@ -582,14 +582,14 @@ void ToolBar::openTipWindow(int group_index, Tool* tool)
Point arrow = tool ? getToolPositionInGroup(group_index, tool): Point(0, 0);
int w = jrect_w(m_tipWindow->rc);
int h = jrect_h(m_tipWindow->rc);
int x = toolrc.x - w + (tool && m_popupFrame && m_popupFrame->isVisible() ? arrow.x-m_popupFrame->getBounds().w: 0);
int x = toolrc.x - w + (tool && m_popupWindow && m_popupWindow->isVisible() ? arrow.x-m_popupWindow->getBounds().w: 0);
int y = toolrc.y + toolrc.h;
m_tipWindow->position_window(MID(0, x, JI_SCREEN_W-w),
MID(0, y, JI_SCREEN_H-h));
if (m_tipOpened)
m_tipWindow->open_window();
m_tipWindow->openWindow();
else
m_tipTimer.start();
}