mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Refactor: replace jwidget_magnetic/expansive/decorative/focusrest with member functions of Widget class.
This commit is contained in:
parent
37d9a3d636
commit
f8f52f75fa
12
src/app.cpp
12
src/app.cpp
@ -199,12 +199,12 @@ int App::run()
|
||||
editor = create_new_editor();
|
||||
|
||||
// configure all widgets to expansives
|
||||
jwidget_expansive(menubar, true);
|
||||
jwidget_expansive(statusbar, true);
|
||||
jwidget_expansive(colorbar, true);
|
||||
jwidget_expansive(toolbar, true);
|
||||
jwidget_expansive(tabsbar, true);
|
||||
jwidget_expansive(view, true);
|
||||
menubar->setExpansive(true);
|
||||
statusbar->setExpansive(true);
|
||||
colorbar->setExpansive(true);
|
||||
toolbar->setExpansive(true);
|
||||
tabsbar->setExpansive(true);
|
||||
view->setExpansive(true);
|
||||
|
||||
/* prepare the first editor */
|
||||
view->attachToView(editor);
|
||||
|
@ -80,10 +80,10 @@ void AboutCommand::onExecute(Context* context)
|
||||
grid->addChildInCell(website, 2, 1, 0);
|
||||
grid->addChildInCell(bottom_box1, 2, 1, 0);
|
||||
|
||||
jwidget_magnetic(close_button, true);
|
||||
close_button->setFocusMagnet(true);
|
||||
|
||||
jwidget_expansive(bottom_box2, true);
|
||||
jwidget_expansive(bottom_box3, true);
|
||||
bottom_box2->setExpansive(true);
|
||||
bottom_box3->setExpansive(true);
|
||||
|
||||
bottom_box1->addChild(bottom_box2);
|
||||
bottom_box1->addChild(close_button);
|
||||
|
@ -75,7 +75,7 @@ void LayerPropertiesCommand::onExecute(Context* context)
|
||||
button_cancel->Click.connect(Bind<void>(&Frame::closeWindow, window.get(), button_cancel));
|
||||
|
||||
jwidget_set_min_size(entry_name, 128, 0);
|
||||
jwidget_expansive(entry_name, true);
|
||||
entry_name->setExpansive(true);
|
||||
|
||||
box2->addChild(label_name);
|
||||
box2->addChild(entry_name);
|
||||
@ -85,8 +85,8 @@ void LayerPropertiesCommand::onExecute(Context* context)
|
||||
box1->addChild(box3);
|
||||
window->addChild(box1);
|
||||
|
||||
jwidget_magnetic(entry_name, true);
|
||||
jwidget_magnetic(button_ok, true);
|
||||
entry_name->setFocusMagnet(true);
|
||||
button_ok->setFocusMagnet(true);
|
||||
|
||||
window->open_window_fg();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
, m_editor(filter.getCurve(), 0, 0, 255, 255)
|
||||
{
|
||||
m_view.attachToView(&m_editor);
|
||||
jwidget_expansive(&m_view, true);
|
||||
m_view.setExpansive(true);
|
||||
jwidget_set_min_size(&m_view, 128, 64);
|
||||
|
||||
getContainer()->addChild(&m_view);
|
||||
|
@ -74,7 +74,7 @@ ColorCurveEditor::ColorCurveEditor(ColorCurve* curve, int x1, int y1, int x2, in
|
||||
: Widget(JI_WIDGET)
|
||||
, m_curve(curve)
|
||||
{
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
border_width.l = border_width.r = 1;
|
||||
border_width.t = border_width.b = 1;
|
||||
|
@ -50,7 +50,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
m_cancelButton.Click.connect(&FilterWindow::onCancel, this);
|
||||
m_showPreview.Click.connect(&FilterWindow::onShowPreview, this);
|
||||
|
||||
jwidget_expansive(&m_container, true);
|
||||
m_container.setExpansive(true);
|
||||
|
||||
m_hbox.addChild(&m_container);
|
||||
m_hbox.addChild(&m_vbox);
|
||||
@ -74,7 +74,7 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
m_showPreview.setSelected(get_config_bool(m_cfgSection, "Preview", true));
|
||||
|
||||
// OK is magnetic (the default button)
|
||||
jwidget_magnetic(&m_okButton, true);
|
||||
m_okButton.setFocusMagnet(true);
|
||||
}
|
||||
|
||||
FilterWindow::~FilterWindow()
|
||||
|
@ -70,8 +70,8 @@ Console::Console()
|
||||
window->addChild(grid);
|
||||
|
||||
view->setVisible(false);
|
||||
jwidget_magnetic(button, true);
|
||||
jwidget_expansive(view, true);
|
||||
button->setFocusMagnet(true);
|
||||
view->setExpansive(true);
|
||||
|
||||
/* force foreground mode */
|
||||
/* ji_find_widget(window)->in_foreground = true; */
|
||||
|
@ -219,7 +219,7 @@ AnimationEditor::AnimationEditor(const Document* document, const Sprite* sprite)
|
||||
m_clk_part = A_PART_NOTHING;
|
||||
m_space_pressed = false;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
regenerateLayers();
|
||||
}
|
||||
|
@ -182,9 +182,9 @@ base::string ase_file_selector(const base::string& message,
|
||||
ASSERT(filetype != NULL);
|
||||
filename_entry = window->findChildT<Entry>("filename");
|
||||
|
||||
jwidget_focusrest(goback, false);
|
||||
jwidget_focusrest(goforward, false);
|
||||
jwidget_focusrest(goup, false);
|
||||
goback->setFocusStop(false);
|
||||
goforward->setFocusStop(false);
|
||||
goup->setFocusStop(false);
|
||||
|
||||
set_gfxicon_to_button(goback,
|
||||
PART_COMBOBOX_ARROW_LEFT,
|
||||
@ -221,7 +221,7 @@ base::string ase_file_selector(const base::string& message,
|
||||
fileview->setName("fileview");
|
||||
|
||||
view->attachToView(fileview);
|
||||
jwidget_expansive(view, true);
|
||||
view->setExpansive(true);
|
||||
|
||||
box->addChild(view);
|
||||
|
||||
|
@ -104,10 +104,10 @@ void dialogs_mask_color(Document* document)
|
||||
slider_tolerance->Change.connect(Bind<void>(&mask_preview, Ref(documentReader)));
|
||||
check_preview->Click.connect(Bind<void>(&mask_preview, Ref(documentReader)));
|
||||
|
||||
jwidget_magnetic(button_ok, true);
|
||||
jwidget_expansive(button_color, true);
|
||||
jwidget_expansive(slider_tolerance, true);
|
||||
jwidget_expansive(box2, true);
|
||||
button_ok->setFocusMagnet(true);
|
||||
button_color->setExpansive(true);
|
||||
slider_tolerance->setExpansive(true);
|
||||
box2->setExpansive(true);
|
||||
|
||||
window->addChild(box1);
|
||||
box1->addChild(box2);
|
||||
|
@ -185,8 +185,8 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
box4 = new Box(0);
|
||||
box5 = new Box(0);
|
||||
|
||||
jwidget_expansive(box4, true);
|
||||
jwidget_expansive(box5, true);
|
||||
box4->setExpansive(true);
|
||||
box5->setExpansive(true);
|
||||
jwidget_noborders(box4);
|
||||
jwidget_noborders(box5);
|
||||
|
||||
@ -209,5 +209,5 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
|
||||
// Default button is the last one
|
||||
if (!buttons.empty())
|
||||
jwidget_magnetic(buttons[buttons.size()-1], true);
|
||||
buttons[buttons.size()-1]->setFocusMagnet(true);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ union Message;
|
||||
#define JI_HASFOCUS 0x0008 // Has the input focus.
|
||||
#define JI_HASMOUSE 0x0010 // Has the mouse.
|
||||
#define JI_HASCAPTURE 0x0020 // Captured the mouse .
|
||||
#define JI_FOCUSREST 0x0040 // Want the focus (is a rest for focus).
|
||||
#define JI_MAGNETIC 0x0080 // Attract the focus.
|
||||
#define JI_FOCUSSTOP 0x0040 // The widget support the focus on it.
|
||||
#define JI_FOCUSMAGNET 0x0080 // The widget wants the focus by default (e.g. when the dialog is shown by first time).
|
||||
#define JI_EXPANSIVE 0x0100 // Is expansive (want more space).
|
||||
#define JI_DECORATIVE 0x0200 // To decorate windows.
|
||||
#define JI_INITIALIZED 0x0400 // The widget was already initialized by a theme.
|
||||
|
@ -156,7 +156,7 @@ void Box::box_set_position(JRect rect)
|
||||
\
|
||||
child_width = reqSize.w; \
|
||||
\
|
||||
if (jwidget_is_expansive(child)) { \
|
||||
if (child->isExpansive()) { \
|
||||
if (nexpand_children == 1) \
|
||||
child_width += width; \
|
||||
else \
|
||||
@ -199,7 +199,7 @@ void Box::box_set_position(JRect rect)
|
||||
|
||||
if (!(child->flags & JI_HIDDEN)) {
|
||||
nvis_children++;
|
||||
if (jwidget_is_expansive(child))
|
||||
if (child->isExpansive())
|
||||
nexpand_children++;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class BoxFiller : public Box
|
||||
{
|
||||
public:
|
||||
BoxFiller() : Box(JI_HORIZONTAL) {
|
||||
jwidget_expansive(this, true);
|
||||
this->setExpansive(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ ButtonBase::ButtonBase(const char* text, int type, int behaviorType, int drawTyp
|
||||
{
|
||||
this->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
this->setText(text);
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
// Initialize theme
|
||||
this->type = m_drawType; // TODO Fix this nasty trick
|
||||
@ -110,7 +110,7 @@ bool ButtonBase::onProcessMessage(Message* msg)
|
||||
return true;
|
||||
}
|
||||
/* magnetic */
|
||||
else if (jwidget_is_magnetic(this) &&
|
||||
else if (this->isFocusMagnet() &&
|
||||
((msg->key.scancode == KEY_ENTER) ||
|
||||
(msg->key.scancode == KEY_ENTER_PAD))) {
|
||||
jmanager_set_focus(this);
|
||||
|
@ -57,10 +57,10 @@ ComboBox::ComboBox()
|
||||
// TODO this separation should be from the Theme*
|
||||
this->child_spacing = 0;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
jwidget_add_hook(m_entry, JI_WIDGET, combobox_entry_msg_proc, NULL);
|
||||
|
||||
jwidget_expansive(m_entry, true);
|
||||
m_entry->setExpansive(true);
|
||||
|
||||
// When the "m_button" is clicked ("Click" signal) call onButtonClick() method
|
||||
m_button->Click.connect(&ComboBox::onButtonClick, this);
|
||||
|
@ -56,7 +56,7 @@ Entry::Entry(size_t maxsize, const char *format, ...)
|
||||
/* widget->align = JI_LEFT | JI_MIDDLE; */
|
||||
setText(buf);
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ void Frame::onPreferredSize(PreferredSizeEvent& ev)
|
||||
JI_LIST_FOR_EACH(this->children, link) {
|
||||
child = (JWidget)link->data;
|
||||
|
||||
if (!jwidget_is_decorative(child)) {
|
||||
if (!child->isDecorative()) {
|
||||
reqSize = child->getPreferredSize();
|
||||
|
||||
maxSize.w = MAX(maxSize.w, reqSize.w);
|
||||
@ -531,7 +531,7 @@ void Frame::window_set_position(JRect rect)
|
||||
JI_LIST_FOR_EACH(this->children, link) {
|
||||
child = (JWidget)link->data;
|
||||
|
||||
if (jwidget_is_decorative(child))
|
||||
if (child->isDecorative())
|
||||
child->getTheme()->map_decorative_widget(child);
|
||||
else
|
||||
jwidget_set_rect(child, cpos);
|
||||
|
@ -34,7 +34,7 @@ JWidget jlistbox_new()
|
||||
JWidget widget = new Widget(JI_LISTBOX);
|
||||
|
||||
jwidget_add_hook(widget, JI_LISTBOX, listbox_msg_proc, NULL);
|
||||
jwidget_focusrest(widget, true);
|
||||
widget->setFocusStop(true);
|
||||
widget->initTheme();
|
||||
|
||||
return widget;
|
||||
|
@ -23,10 +23,10 @@
|
||||
#define TOPWND(manager) reinterpret_cast<Frame*>(jlist_first_data((manager)->children))
|
||||
|
||||
#define ACCEPT_FOCUS(widget) \
|
||||
(((widget)->flags & (JI_FOCUSREST | \
|
||||
(((widget)->flags & (JI_FOCUSSTOP | \
|
||||
JI_DISABLED | \
|
||||
JI_HIDDEN | \
|
||||
JI_DECORATIVE)) == JI_FOCUSREST)
|
||||
JI_DECORATIVE)) == JI_FOCUSSTOP)
|
||||
|
||||
#define DOUBLE_CLICK_TIMEOUT_MSECS 400
|
||||
|
||||
@ -119,7 +119,7 @@ static void manager_pump_queue(JWidget widget);
|
||||
/* auxiliary */
|
||||
static void generate_setcursor_message();
|
||||
static void remove_msgs_for(JWidget widget, Message* msg);
|
||||
static int some_parent_is_focusrest(JWidget widget);
|
||||
static bool some_parent_is_focusstop(JWidget widget);
|
||||
static JWidget find_magnetic_widget(JWidget widget);
|
||||
static Message* new_mouse_msg(int type, JWidget destination);
|
||||
static void broadcast_key_msg(JWidget manager, Message* msg);
|
||||
@ -772,7 +772,7 @@ void jmanager_set_focus(JWidget widget)
|
||||
|| (!(widget->flags & JI_DISABLED)
|
||||
&& !(widget->flags & JI_HIDDEN)
|
||||
&& !(widget->flags & JI_DECORATIVE)
|
||||
&& some_parent_is_focusrest(widget)))) {
|
||||
&& some_parent_is_focusstop(widget)))) {
|
||||
JList widget_parents = NULL;
|
||||
JWidget common_parent = NULL;
|
||||
JLink link, link2;
|
||||
@ -826,7 +826,7 @@ void jmanager_set_focus(JWidget widget)
|
||||
for (; link != widget_parents->end; link=link->next) {
|
||||
JWidget w = (JWidget)link->data;
|
||||
|
||||
if (w->flags & JI_FOCUSREST) {
|
||||
if (w->flags & JI_FOCUSSTOP) {
|
||||
w->flags |= JI_HASFOCUS;
|
||||
|
||||
jmessage_add_dest(msg, w);
|
||||
@ -1417,13 +1417,13 @@ static void remove_msgs_for(JWidget widget, Message* msg)
|
||||
}
|
||||
}
|
||||
|
||||
static int some_parent_is_focusrest(JWidget widget)
|
||||
static bool some_parent_is_focusstop(JWidget widget)
|
||||
{
|
||||
if (jwidget_is_focusrest(widget))
|
||||
if (widget->isFocusStop())
|
||||
return true;
|
||||
|
||||
if (widget->parent)
|
||||
return some_parent_is_focusrest(widget->parent);
|
||||
return some_parent_is_focusstop(widget->parent);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@ -1439,7 +1439,7 @@ static JWidget find_magnetic_widget(JWidget widget)
|
||||
return found;
|
||||
}
|
||||
|
||||
if (jwidget_is_magnetic(widget))
|
||||
if (widget->isFocusMagnet())
|
||||
return widget;
|
||||
else
|
||||
return NULL;
|
||||
|
@ -104,7 +104,7 @@ MenuBox::MenuBox(int type)
|
||||
: Widget(type)
|
||||
, m_base(NULL)
|
||||
{
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
@ -259,7 +259,7 @@ void Menu::showPopup(int x, int y)
|
||||
|
||||
// Set the focus to the new menubox
|
||||
jmanager_set_focus(menubox);
|
||||
jwidget_magnetic(menubox, true);
|
||||
menubox->setFocusMagnet(true);
|
||||
|
||||
// Open the window
|
||||
window->open_window_fg();
|
||||
@ -785,7 +785,7 @@ bool MenuItem::onProcessMessage(Message* msg)
|
||||
jrect_free(pos);
|
||||
|
||||
// Set the focus to the new menubox
|
||||
jwidget_magnetic(menubox, true);
|
||||
menubox->setFocusMagnet(true);
|
||||
|
||||
// Setup the highlight of the new menubox
|
||||
if (select_first) {
|
||||
|
@ -29,7 +29,7 @@ Slider::Slider(int min, int max, int value)
|
||||
m_max = max;
|
||||
m_value = MID(min, value, max);
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
initTheme();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ JWidget jtextbox_new(const char *text, int align)
|
||||
Widget* widget = new Widget(JI_TEXTBOX);
|
||||
|
||||
jwidget_add_hook(widget, JI_TEXTBOX, textbox_msg_proc, NULL);
|
||||
jwidget_focusrest(widget, true);
|
||||
widget->setFocusStop(true);
|
||||
widget->setAlign(align);
|
||||
widget->setText(text);
|
||||
widget->initTheme();
|
||||
|
@ -28,7 +28,7 @@ View::View()
|
||||
{
|
||||
m_hasBars = true;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
addChild(&m_viewport);
|
||||
setScrollableSize(Size(0, 0));
|
||||
|
||||
|
@ -311,79 +311,9 @@ void Widget::setTheme(Theme* theme)
|
||||
setFont(m_theme ? m_theme->default_font: NULL);
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* behavior properties */
|
||||
|
||||
void jwidget_magnetic(JWidget widget, bool state)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
if (state)
|
||||
widget->flags |= JI_MAGNETIC;
|
||||
else
|
||||
widget->flags &= ~JI_MAGNETIC;
|
||||
}
|
||||
|
||||
void jwidget_expansive(JWidget widget, bool state)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
if (state)
|
||||
widget->flags |= JI_EXPANSIVE;
|
||||
else
|
||||
widget->flags &= ~JI_EXPANSIVE;
|
||||
}
|
||||
|
||||
void jwidget_decorative(JWidget widget, bool state)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
if (state)
|
||||
widget->flags |= JI_DECORATIVE;
|
||||
else
|
||||
widget->flags &= ~JI_DECORATIVE;
|
||||
}
|
||||
|
||||
void jwidget_focusrest(JWidget widget, bool state)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
if (state)
|
||||
widget->flags |= JI_FOCUSREST;
|
||||
else
|
||||
widget->flags &= ~JI_FOCUSREST;
|
||||
}
|
||||
|
||||
bool jwidget_is_magnetic(JWidget widget)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
return (widget->flags & JI_MAGNETIC) ? true: false;
|
||||
}
|
||||
|
||||
bool jwidget_is_expansive(JWidget widget)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
return (widget->flags & JI_EXPANSIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool jwidget_is_decorative(JWidget widget)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
return (widget->flags & JI_DECORATIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool jwidget_is_focusrest(JWidget widget)
|
||||
{
|
||||
ASSERT_VALID_WIDGET(widget);
|
||||
|
||||
return (widget->flags & JI_FOCUSREST) ? true: false;
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* status properties */
|
||||
// ===============================================================
|
||||
// COMMON PROPERTIES
|
||||
// ===============================================================
|
||||
|
||||
void Widget::setVisible(bool state)
|
||||
{
|
||||
@ -447,6 +377,38 @@ void Widget::setSelected(bool state)
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setExpansive(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_EXPANSIVE;
|
||||
else
|
||||
this->flags &= ~JI_EXPANSIVE;
|
||||
}
|
||||
|
||||
void Widget::setDecorative(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_DECORATIVE;
|
||||
else
|
||||
this->flags &= ~JI_DECORATIVE;
|
||||
}
|
||||
|
||||
void Widget::setFocusStop(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_FOCUSSTOP;
|
||||
else
|
||||
this->flags &= ~JI_FOCUSSTOP;
|
||||
}
|
||||
|
||||
void Widget::setFocusMagnet(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_FOCUSMAGNET;
|
||||
else
|
||||
this->flags &= ~JI_FOCUSMAGNET;
|
||||
}
|
||||
|
||||
bool Widget::isVisible() const
|
||||
{
|
||||
const Widget* widget = this;
|
||||
@ -480,6 +442,26 @@ bool Widget::isSelected() const
|
||||
return (this->flags & JI_SELECTED) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isExpansive() const
|
||||
{
|
||||
return (this->flags & JI_EXPANSIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isDecorative() const
|
||||
{
|
||||
return (this->flags & JI_DECORATIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isFocusStop() const
|
||||
{
|
||||
return (this->flags & JI_FOCUSSTOP) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isFocusMagnet() const
|
||||
{
|
||||
return (this->flags & JI_FOCUSMAGNET) ? true: false;
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
// PARENTS & CHILDREN
|
||||
// ===============================================================
|
||||
|
@ -44,18 +44,6 @@ void jwidget_add_hook(JWidget widget, int type,
|
||||
JHook jwidget_get_hook(JWidget widget, int type);
|
||||
void *jwidget_get_data(JWidget widget, int type);
|
||||
|
||||
/* behavior properties */
|
||||
|
||||
void jwidget_magnetic(JWidget widget, bool state);
|
||||
void jwidget_expansive(JWidget widget, bool state);
|
||||
void jwidget_decorative(JWidget widget, bool state);
|
||||
void jwidget_focusrest(JWidget widget, bool state);
|
||||
|
||||
bool jwidget_is_magnetic(JWidget widget);
|
||||
bool jwidget_is_expansive(JWidget widget);
|
||||
bool jwidget_is_decorative(JWidget widget);
|
||||
bool jwidget_is_focusrest(JWidget widget);
|
||||
|
||||
/* position and geometry */
|
||||
|
||||
JRect jwidget_get_rect(JWidget widget);
|
||||
@ -169,15 +157,39 @@ public:
|
||||
// COMMON PROPERTIES
|
||||
// ===============================================================
|
||||
|
||||
// True if this widget and all its ancestors are visible.
|
||||
bool isVisible() const;
|
||||
void setVisible(bool state);
|
||||
|
||||
// True if this widget can receive user input (is not disabled).
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool state);
|
||||
|
||||
// True if this widget is selected (pushed in case of a button, or
|
||||
// checked in the case of a check-box).
|
||||
bool isSelected() const;
|
||||
void setSelected(bool state);
|
||||
|
||||
// True if this widget wants more space when it's inside a Box
|
||||
// parent.
|
||||
bool isExpansive() const;
|
||||
void setExpansive(bool state);
|
||||
|
||||
// True if this is a decorative widget created by the current
|
||||
// theme. Decorative widgets are arranged by the theme instead that
|
||||
// the parent's widget.
|
||||
bool isDecorative() const;
|
||||
void setDecorative(bool state);
|
||||
|
||||
// True if this widget can receive the keyboard focus.
|
||||
bool isFocusStop() const;
|
||||
void setFocusStop(bool state);
|
||||
|
||||
// True if this widget wants the focus by default when it's shown by
|
||||
// first time (e.g. when its parent window is opened).
|
||||
void setFocusMagnet(bool state);
|
||||
bool isFocusMagnet() const;
|
||||
|
||||
// ===============================================================
|
||||
// LOOK & FEEL
|
||||
// ===============================================================
|
||||
|
@ -425,8 +425,8 @@ void split_editor(Editor* editor, int align)
|
||||
new_editor->setZoom(editor->getZoom());
|
||||
|
||||
// Expansive widgets.
|
||||
jwidget_expansive(new_panel, true);
|
||||
jwidget_expansive(new_view, true);
|
||||
new_panel->setExpansive(true);
|
||||
new_view->setExpansive(true);
|
||||
|
||||
// Append both views to the "new_panel".
|
||||
new_panel->addChild(view);
|
||||
@ -613,7 +613,7 @@ static void create_mini_editor_frame()
|
||||
|
||||
// Create the new for the mini editor
|
||||
View* newView = new EditorView(EditorView::AlwaysSelected);
|
||||
jwidget_expansive(newView, true);
|
||||
newView->setExpansive(true);
|
||||
|
||||
// Create mini editor
|
||||
mini_editor = new MiniEditor();
|
||||
|
@ -654,7 +654,7 @@ void SkinTheme::init_widget(JWidget widget)
|
||||
setup_bevels(button, 0, 0, 0, 0);
|
||||
jwidget_add_hook(button, JI_WIDGET,
|
||||
&SkinTheme::theme_frame_button_msg_proc, NULL);
|
||||
jwidget_decorative(button, true);
|
||||
button->setDecorative(true);
|
||||
widget->addChild(button);
|
||||
button->setName("theme_close_button");
|
||||
button->Click.connect(Bind<void>(&Frame::closeWindow, (Frame*)widget, button));
|
||||
@ -1652,7 +1652,7 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
int SkinTheme::get_bg_color(JWidget widget)
|
||||
{
|
||||
int c = jwidget_get_bg_color(widget);
|
||||
int decorative = jwidget_is_decorative(widget);
|
||||
bool decorative = widget->isDecorative();
|
||||
|
||||
return c >= 0 ? c: (decorative ? COLOR_SELECTED:
|
||||
COLOR_FACE);
|
||||
|
@ -98,7 +98,7 @@ ColorBar::ColorBar(int align)
|
||||
|
||||
jwidget_set_min_size(&m_scrollableView, w, 0);
|
||||
|
||||
jwidget_expansive(&m_scrollableView, true);
|
||||
m_scrollableView.setExpansive(true);
|
||||
|
||||
addChild(&m_paletteButton);
|
||||
addChild(&m_scrollableView);
|
||||
|
@ -49,7 +49,7 @@ ColorButton::ColorButton(const Color& color, PixelFormat pixelFormat)
|
||||
, m_pixelFormat(pixelFormat)
|
||||
, m_frame(NULL)
|
||||
{
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
setFont(static_cast<SkinTheme*>(getTheme())->getMiniFont());
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ ColorSelector::ColorSelector()
|
||||
m_colorPalette.setBoxSize(6*jguiscale());
|
||||
m_colorPaletteContainer.attachToView(&m_colorPalette);
|
||||
|
||||
jwidget_expansive(&m_colorPaletteContainer, true);
|
||||
m_colorPaletteContainer.setExpansive(true);
|
||||
|
||||
setup_mini_look(&m_indexButton);
|
||||
setup_mini_look(&m_rgbButton);
|
||||
|
@ -147,7 +147,7 @@ Editor::Editor()
|
||||
m_mask_timer_id = jmanager_add_timer(this, 100);
|
||||
m_offset_count = 0;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
m_currentToolChangeSlot =
|
||||
App::instance()->CurrentToolChange.connect(&Editor::onCurrentToolChange, this);
|
||||
|
@ -107,7 +107,7 @@ JWidget fileview_new(IFileItem* start_folder, const base::string& exts)
|
||||
|
||||
jwidget_add_hook(widget, fileview_type(),
|
||||
fileview_msg_proc, fileview);
|
||||
jwidget_focusrest(widget, true);
|
||||
widget->setFocusStop(true);
|
||||
|
||||
fileview->current_folder = start_folder;
|
||||
fileview->req_valid = false;
|
||||
|
@ -58,7 +58,7 @@ PaletteView::PaletteView(bool editable)
|
||||
m_columns = 16;
|
||||
m_boxsize = 6;
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
this->border_width.l = this->border_width.r = 1 * jguiscale();
|
||||
this->border_width.t = this->border_width.b = 1 * jguiscale();
|
||||
|
@ -125,7 +125,7 @@ StatusBar::StatusBar()
|
||||
set_gfxicon_to_button((name), icon, icon##_SELECTED, icon##_DISABLED, JI_CENTER | JI_MIDDLE); \
|
||||
}
|
||||
|
||||
jwidget_focusrest(this, true);
|
||||
this->setFocusStop(true);
|
||||
|
||||
m_timeout = 0;
|
||||
m_state = SHOW_TEXT;
|
||||
@ -164,7 +164,7 @@ StatusBar::StatusBar()
|
||||
jwidget_set_border(box1, 2*jguiscale(), 1*jguiscale(), 2*jguiscale(), 2*jguiscale());
|
||||
jwidget_noborders(box2);
|
||||
jwidget_noborders(box3);
|
||||
jwidget_expansive(box3, true);
|
||||
box3->setExpansive(true);
|
||||
|
||||
box4->addChild(m_currentFrame);
|
||||
box4->addChild(m_newFrame);
|
||||
@ -190,7 +190,7 @@ StatusBar::StatusBar()
|
||||
|
||||
jwidget_set_border(box1, 2*jguiscale(), 1*jguiscale(), 2*jguiscale(), 2*jguiscale());
|
||||
jwidget_noborders(box2);
|
||||
jwidget_expansive(box2, true);
|
||||
box2->setExpansive(true);
|
||||
|
||||
m_linkLabel = new LinkLabel((std::string(WEBSITE) + "donate/").c_str(), "Support This Project");
|
||||
|
||||
@ -202,7 +202,7 @@ StatusBar::StatusBar()
|
||||
// Construct move-pixels box
|
||||
{
|
||||
Box* filler = new Box(JI_HORIZONTAL);
|
||||
jwidget_expansive(filler, true);
|
||||
filler->setExpansive(true);
|
||||
|
||||
m_movePixelsBox = new Box(JI_HORIZONTAL);
|
||||
m_transparentLabel = new Label("Transparent Color:");
|
||||
|
@ -66,8 +66,8 @@ Tabs::Tabs(TabsDelegate* delegate)
|
||||
setup_bevels(m_button_left, 2, 0, 2, 0);
|
||||
setup_bevels(m_button_right, 0, 2, 0, 2);
|
||||
|
||||
jwidget_focusrest(m_button_left, false);
|
||||
jwidget_focusrest(m_button_right, false);
|
||||
m_button_left->setFocusStop(false);
|
||||
m_button_right->setFocusStop(false);
|
||||
|
||||
set_gfxicon_to_button(m_button_left,
|
||||
PART_COMBOBOX_ARROW_LEFT,
|
||||
|
@ -363,10 +363,10 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
|
||||
widget->setEnabled(false);
|
||||
|
||||
if (expansive)
|
||||
jwidget_expansive(widget, true);
|
||||
widget->setExpansive(true);
|
||||
|
||||
if (magnetic)
|
||||
jwidget_magnetic(widget, true);
|
||||
widget->setFocusMagnet(true);
|
||||
|
||||
if (noborders)
|
||||
jwidget_noborders(widget);
|
||||
|
Loading…
x
Reference in New Issue
Block a user