mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Convert jbox widget to Box class.
This commit is contained in:
parent
e32d8dc633
commit
d8a3d27c0f
@ -49,7 +49,7 @@ AboutCommand::AboutCommand()
|
|||||||
void AboutCommand::onExecute(Context* context)
|
void AboutCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
FramePtr frame(new Frame(false, "About " PACKAGE));
|
FramePtr frame(new Frame(false, "About " PACKAGE));
|
||||||
Widget* box1 = jbox_new(JI_VERTICAL);
|
Box* box1 = new Box(JI_VERTICAL);
|
||||||
Widget* grid = jgrid_new(2, false);
|
Widget* grid = jgrid_new(2, false);
|
||||||
Label* title = new Label(PACKAGE " v" VERSION);
|
Label* title = new Label(PACKAGE " v" VERSION);
|
||||||
Label* subtitle = new Label("Animated sprites editor && pixel art tool");
|
Label* subtitle = new Label("Animated sprites editor && pixel art tool");
|
||||||
@ -61,9 +61,9 @@ void AboutCommand::onExecute(Context* context)
|
|||||||
Label* author2_desc = new Label("| Skin and Graphics");
|
Label* author2_desc = new Label("| Skin and Graphics");
|
||||||
Label* author3 = new Label("Trent Gamblin");
|
Label* author3 = new Label("Trent Gamblin");
|
||||||
Label* author3_desc = new Label("| MAC OS X builds");
|
Label* author3_desc = new Label("| MAC OS X builds");
|
||||||
Widget* bottom_box1 = jbox_new(JI_HORIZONTAL);
|
Box* bottom_box1 = new Box(JI_HORIZONTAL);
|
||||||
Widget* bottom_box2 = jbox_new(JI_HORIZONTAL);
|
Box* bottom_box2 = new Box(JI_HORIZONTAL);
|
||||||
Widget* bottom_box3 = jbox_new(JI_HORIZONTAL);
|
Box* bottom_box3 = new Box(JI_HORIZONTAL);
|
||||||
Label* copyright = new Label(COPYRIGHT);
|
Label* copyright = new Label(COPYRIGHT);
|
||||||
Label* website = new LinkLabel(WEBSITE);
|
Label* website = new LinkLabel(WEBSITE);
|
||||||
Button* close_button = new Button("&Close");
|
Button* close_button = new Button("&Close");
|
||||||
|
@ -64,9 +64,9 @@ void LayerPropertiesCommand::onExecute(Context* context)
|
|||||||
Layer* layer = sprite->getCurrentLayer();
|
Layer* layer = sprite->getCurrentLayer();
|
||||||
|
|
||||||
FramePtr window(new Frame(false, "Layer Properties"));
|
FramePtr window(new Frame(false, "Layer Properties"));
|
||||||
Widget* box1 = jbox_new(JI_VERTICAL);
|
Box* box1 = new Box(JI_VERTICAL);
|
||||||
Widget* box2 = jbox_new(JI_HORIZONTAL);
|
Box* box2 = new Box(JI_HORIZONTAL);
|
||||||
Widget* box3 = jbox_new(JI_HORIZONTAL + JI_HOMOGENEOUS);
|
Box* box3 = new Box(JI_HORIZONTAL + JI_HOMOGENEOUS);
|
||||||
Widget* label_name = new Label("Name:");
|
Widget* label_name = new Label("Name:");
|
||||||
Entry* entry_name = new Entry(256, layer->getName().c_str());
|
Entry* entry_name = new Entry(256, layer->getName().c_str());
|
||||||
Button* button_ok = new Button("&OK");
|
Button* button_ok = new Button("&OK");
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/frame.h"
|
#include "gui/frame.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/jlist.h"
|
#include "gui/jlist.h"
|
||||||
#include "gui/jlistbox.h"
|
#include "gui/jlistbox.h"
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/entry.h"
|
#include "gui/entry.h"
|
||||||
#include "gui/frame.h"
|
#include "gui/frame.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/widget.h"
|
#include "gui/widget.h"
|
||||||
|
|
||||||
|
@ -19,13 +19,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
|
#include "gui/frame.h"
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/label.h"
|
#include "gui/label.h"
|
||||||
#include "gui/slider.h"
|
#include "gui/slider.h"
|
||||||
#include "gui/widget.h"
|
#include "gui/widget.h"
|
||||||
#include "gui/frame.h"
|
|
||||||
|
|
||||||
#include "app/color.h"
|
#include "app/color.h"
|
||||||
#include "commands/command.h"
|
#include "commands/command.h"
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
#include "app/color_utils.h"
|
#include "app/color_utils.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "core/cfg.h"
|
#include "core/cfg.h"
|
||||||
|
#include "gui/box.h"
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/frame.h"
|
#include "gui/frame.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/label.h"
|
#include "gui/label.h"
|
||||||
#include "gui/slider.h"
|
#include "gui/slider.h"
|
||||||
@ -53,7 +53,7 @@ static void mask_preview(Sprite* sprite);
|
|||||||
|
|
||||||
void dialogs_mask_color(Sprite* sprite)
|
void dialogs_mask_color(Sprite* sprite)
|
||||||
{
|
{
|
||||||
JWidget box1, box2, box3, box4;
|
Box* box1, *box2, *box3, *box4;
|
||||||
Widget* label_color;
|
Widget* label_color;
|
||||||
Button* button_1;
|
Button* button_1;
|
||||||
Button* button_2;
|
Button* button_2;
|
||||||
@ -70,10 +70,10 @@ void dialogs_mask_color(Sprite* sprite)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
FramePtr window(new Frame(false, "Mask by Color"));
|
FramePtr window(new Frame(false, "Mask by Color"));
|
||||||
box1 = jbox_new(JI_VERTICAL);
|
box1 = new Box(JI_VERTICAL);
|
||||||
box2 = jbox_new(JI_HORIZONTAL);
|
box2 = new Box(JI_HORIZONTAL);
|
||||||
box3 = jbox_new(JI_HORIZONTAL);
|
box3 = new Box(JI_HORIZONTAL);
|
||||||
box4 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
box4 = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
label_color = new Label("Color:");
|
label_color = new Label("Color:");
|
||||||
button_color = new ColorButton
|
button_color = new ColorButton
|
||||||
(get_config_color("MaskColor", "Color",
|
(get_config_color("MaskColor", "Color",
|
||||||
|
@ -41,8 +41,8 @@ static void delete_command(Button* widget, RepoDlg* repo_dlg);
|
|||||||
void ji_show_repo_dlg(RepoDlg *repo_dlg)
|
void ji_show_repo_dlg(RepoDlg *repo_dlg)
|
||||||
{
|
{
|
||||||
Frame* window = new Frame(false, repo_dlg->title);
|
Frame* window = new Frame(false, repo_dlg->title);
|
||||||
Widget* box1 = jbox_new(JI_HORIZONTAL);
|
Box* box1 = new Box(JI_HORIZONTAL);
|
||||||
Widget* box2 = jbox_new(JI_VERTICAL);
|
Box* box2 = new Box(JI_VERTICAL);
|
||||||
Widget* view = jview_new();
|
Widget* view = jview_new();
|
||||||
repo_dlg->listbox = jlistbox_new();
|
repo_dlg->listbox = jlistbox_new();
|
||||||
repo_dlg->button_use = new Button(repo_dlg->use_text);
|
repo_dlg->button_use = new Button(repo_dlg->use_text);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
# Copyright (C) 2001-2011 David Capello
|
# Copyright (C) 2001-2011 David Capello
|
||||||
|
|
||||||
add_library(gui-lib
|
add_library(gui-lib
|
||||||
|
box.cpp
|
||||||
button.cpp
|
button.cpp
|
||||||
component.cpp
|
component.cpp
|
||||||
entry.cpp
|
entry.cpp
|
||||||
@ -9,7 +10,6 @@ add_library(gui-lib
|
|||||||
frame.cpp
|
frame.cpp
|
||||||
jaccel.cpp
|
jaccel.cpp
|
||||||
jalert.cpp
|
jalert.cpp
|
||||||
jbox.cpp
|
|
||||||
jclipboard.cpp
|
jclipboard.cpp
|
||||||
jcombobox.cpp
|
jcombobox.cpp
|
||||||
jcustom_label.cpp
|
jcustom_label.cpp
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "gfx/size.h"
|
#include "gfx/size.h"
|
||||||
|
#include "gui/box.h"
|
||||||
#include "gui/jlist.h"
|
#include "gui/jlist.h"
|
||||||
#include "gui/jmessage.h"
|
#include "gui/jmessage.h"
|
||||||
#include "gui/jrect.h"
|
#include "gui/jrect.h"
|
||||||
|
#include "gui/preferred_size_event.h"
|
||||||
#include "gui/theme.h"
|
#include "gui/theme.h"
|
||||||
#include "gui/widget.h"
|
|
||||||
|
|
||||||
using namespace gfx;
|
using namespace gfx;
|
||||||
|
|
||||||
@ -21,72 +22,64 @@ static bool box_msg_proc(JWidget widget, JMessage msg);
|
|||||||
static void box_request_size(JWidget widget, int *w, int *h);
|
static void box_request_size(JWidget widget, int *w, int *h);
|
||||||
static void box_set_position(JWidget widget, JRect rect);
|
static void box_set_position(JWidget widget, JRect rect);
|
||||||
|
|
||||||
JWidget jbox_new(int align)
|
Box::Box(int align)
|
||||||
|
: Widget(JI_BOX)
|
||||||
{
|
{
|
||||||
Widget* widget = new Widget(JI_BOX);
|
setAlign(align);
|
||||||
|
jwidget_init_theme(this);
|
||||||
jwidget_add_hook(widget, JI_BOX, box_msg_proc, NULL);
|
|
||||||
widget->setAlign(align);
|
|
||||||
jwidget_init_theme(widget);
|
|
||||||
|
|
||||||
return widget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool box_msg_proc(JWidget widget, JMessage msg)
|
bool Box::onProcessMessage(JMessage msg)
|
||||||
{
|
{
|
||||||
switch (msg->type) {
|
switch (msg->type) {
|
||||||
|
|
||||||
case JM_REQSIZE:
|
|
||||||
box_request_size(widget, &msg->reqsize.w, &msg->reqsize.h);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case JM_SETPOS:
|
case JM_SETPOS:
|
||||||
box_set_position(widget, &msg->setpos.rect);
|
box_set_position(&msg->setpos.rect);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case JM_DRAW:
|
case JM_DRAW:
|
||||||
widget->getTheme()->draw_box(widget, &msg->draw.rect);
|
getTheme()->draw_box(this, &msg->draw.rect);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return Widget::onProcessMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void box_request_size(JWidget widget, int *w, int *h)
|
void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||||
{
|
{
|
||||||
#define GET_CHILD_SIZE(w, h) \
|
#define GET_CHILD_SIZE(w, h) \
|
||||||
{ \
|
{ \
|
||||||
if (widget->getAlign() & JI_HOMOGENEOUS) \
|
if (getAlign() & JI_HOMOGENEOUS) \
|
||||||
*w = MAX(*w, reqSize.w); \
|
w = MAX(w, reqSize.w); \
|
||||||
else \
|
else \
|
||||||
*w += reqSize.w; \
|
w += reqSize.w; \
|
||||||
\
|
\
|
||||||
*h = MAX(*h, reqSize.h); \
|
h = MAX(h, reqSize.h); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FINAL_SIZE(w) \
|
#define FINAL_SIZE(w) \
|
||||||
{ \
|
{ \
|
||||||
if (widget->getAlign() & JI_HOMOGENEOUS) \
|
if (getAlign() & JI_HOMOGENEOUS) \
|
||||||
*w *= nvis_children; \
|
w *= nvis_children; \
|
||||||
\
|
\
|
||||||
*w += widget->child_spacing * (nvis_children-1); \
|
w += child_spacing * (nvis_children-1); \
|
||||||
}
|
}
|
||||||
|
|
||||||
int nvis_children;
|
int w, h, nvis_children;
|
||||||
JWidget child;
|
JWidget child;
|
||||||
JLink link;
|
JLink link;
|
||||||
|
|
||||||
nvis_children = 0;
|
nvis_children = 0;
|
||||||
JI_LIST_FOR_EACH(widget->children, link) {
|
JI_LIST_FOR_EACH(this->children, link) {
|
||||||
child = (JWidget)link->data;
|
child = (JWidget)link->data;
|
||||||
if (!(child->flags & JI_HIDDEN))
|
if (!(child->flags & JI_HIDDEN))
|
||||||
nvis_children++;
|
nvis_children++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w = h = 0;
|
||||||
|
|
||||||
*w = *h = 0;
|
JI_LIST_FOR_EACH(this->children, link) {
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(widget->children, link) {
|
|
||||||
child = (JWidget)link->data;
|
child = (JWidget)link->data;
|
||||||
|
|
||||||
if (child->flags & JI_HIDDEN)
|
if (child->flags & JI_HIDDEN)
|
||||||
@ -94,7 +87,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
|||||||
|
|
||||||
Size reqSize = child->getPreferredSize();
|
Size reqSize = child->getPreferredSize();
|
||||||
|
|
||||||
if (widget->getAlign() & JI_HORIZONTAL) {
|
if (this->getAlign() & JI_HORIZONTAL) {
|
||||||
GET_CHILD_SIZE(w, h);
|
GET_CHILD_SIZE(w, h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -103,7 +96,7 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nvis_children > 0) {
|
if (nvis_children > 0) {
|
||||||
if (widget->getAlign() & JI_HORIZONTAL) {
|
if (this->getAlign() & JI_HORIZONTAL) {
|
||||||
FINAL_SIZE(w);
|
FINAL_SIZE(w);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -111,24 +104,26 @@ static void box_request_size(JWidget widget, int *w, int *h)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*w += widget->border_width.l + widget->border_width.r;
|
w += border_width.l + border_width.r;
|
||||||
*h += widget->border_width.t + widget->border_width.b;
|
h += border_width.t + border_width.b;
|
||||||
|
|
||||||
|
ev.setPreferredSize(Size(w, h));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void box_set_position(JWidget widget, JRect rect)
|
void Box::box_set_position(JRect rect)
|
||||||
{
|
{
|
||||||
#define FIXUP(x, y, w, h, l, t, r, b) \
|
#define FIXUP(x, y, w, h, l, t, r, b) \
|
||||||
{ \
|
{ \
|
||||||
if (nvis_children > 0) { \
|
if (nvis_children > 0) { \
|
||||||
if (widget->getAlign() & JI_HOMOGENEOUS) { \
|
if (getAlign() & JI_HOMOGENEOUS) { \
|
||||||
width = (jrect_##w(widget->rc) \
|
width = (jrect_##w(this->rc) \
|
||||||
- widget->border_width.l \
|
- this->border_width.l \
|
||||||
- widget->border_width.r \
|
- this->border_width.r \
|
||||||
- widget->child_spacing * (nvis_children - 1)); \
|
- this->child_spacing * (nvis_children - 1)); \
|
||||||
extra = width / nvis_children; \
|
extra = width / nvis_children; \
|
||||||
} \
|
} \
|
||||||
else if (nexpand_children > 0) { \
|
else if (nexpand_children > 0) { \
|
||||||
width = jrect_##w(widget->rc) - reqSize.w; \
|
width = jrect_##w(this->rc) - reqSize.w; \
|
||||||
extra = width / nexpand_children; \
|
extra = width / nexpand_children; \
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
@ -136,17 +131,17 @@ static void box_set_position(JWidget widget, JRect rect)
|
|||||||
extra = 0; \
|
extra = 0; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
x = widget->rc->x##1 + widget->border_width.l; \
|
x = this->rc->x##1 + this->border_width.l; \
|
||||||
y = widget->rc->y##1 + widget->border_width.t; \
|
y = this->rc->y##1 + this->border_width.t; \
|
||||||
h = MAX(1, jrect_##h(widget->rc) \
|
h = MAX(1, jrect_##h(this->rc) \
|
||||||
- widget->border_width.t \
|
- this->border_width.t \
|
||||||
- widget->border_width.b); \
|
- this->border_width.b); \
|
||||||
\
|
\
|
||||||
JI_LIST_FOR_EACH(widget->children, link) { \
|
JI_LIST_FOR_EACH(this->children, link) { \
|
||||||
child = (JWidget)link->data; \
|
child = (JWidget)link->data; \
|
||||||
\
|
\
|
||||||
if (!(child->flags & JI_HIDDEN)) { \
|
if (!(child->flags & JI_HIDDEN)) { \
|
||||||
if (widget->getAlign() & JI_HOMOGENEOUS) { \
|
if (this->getAlign() & JI_HOMOGENEOUS) { \
|
||||||
if (nvis_children == 1) \
|
if (nvis_children == 1) \
|
||||||
child_width = width; \
|
child_width = width; \
|
||||||
else \
|
else \
|
||||||
@ -173,21 +168,21 @@ static void box_set_position(JWidget widget, JRect rect)
|
|||||||
\
|
\
|
||||||
w = MAX(1, child_width); \
|
w = MAX(1, child_width); \
|
||||||
\
|
\
|
||||||
if (widget->getAlign() & JI_HORIZONTAL) \
|
if (this->getAlign() & JI_HORIZONTAL) \
|
||||||
jrect_replace(&cpos, x, y, x+w, y+h); \
|
jrect_replace(&cpos, x, y, x+w, y+h); \
|
||||||
else \
|
else \
|
||||||
jrect_replace(&cpos, y, x, y+h, x+w); \
|
jrect_replace(&cpos, y, x, y+h, x+w); \
|
||||||
\
|
\
|
||||||
jwidget_set_rect(child, &cpos); \
|
jwidget_set_rect(child, &cpos); \
|
||||||
\
|
\
|
||||||
x += child_width + widget->child_spacing; \
|
x += child_width + this->child_spacing; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct jrect cpos;
|
struct jrect cpos;
|
||||||
JWidget child;
|
Widget* child;
|
||||||
int nvis_children = 0;
|
int nvis_children = 0;
|
||||||
int nexpand_children = 0;
|
int nexpand_children = 0;
|
||||||
int child_width;
|
int child_width;
|
||||||
@ -196,9 +191,9 @@ static void box_set_position(JWidget widget, JRect rect)
|
|||||||
int extra;
|
int extra;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
|
||||||
jrect_copy(widget->rc, rect);
|
jrect_copy(this->rc, rect);
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(widget->children, link) {
|
JI_LIST_FOR_EACH(this->children, link) {
|
||||||
child = (JWidget)link->data;
|
child = (JWidget)link->data;
|
||||||
|
|
||||||
if (!(child->flags & JI_HIDDEN)) {
|
if (!(child->flags & JI_HIDDEN)) {
|
||||||
@ -208,9 +203,9 @@ static void box_set_position(JWidget widget, JRect rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Size reqSize = widget->getPreferredSize();
|
Size reqSize = this->getPreferredSize();
|
||||||
|
|
||||||
if (widget->getAlign() & JI_HORIZONTAL) {
|
if (this->getAlign() & JI_HORIZONTAL) {
|
||||||
FIXUP(x, y, w, h, l, t, r, b);
|
FIXUP(x, y, w, h, l, t, r, b);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
26
src/gui/box.h
Normal file
26
src/gui/box.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// ASE gui library
|
||||||
|
// Copyright (C) 2001-2011 David Capello
|
||||||
|
//
|
||||||
|
// This source file is ditributed under a BSD-like license, please
|
||||||
|
// read LICENSE.txt for more information.
|
||||||
|
|
||||||
|
#ifndef GUI_BOX_H_INCLUDED
|
||||||
|
#define GUI_BOX_H_INCLUDED
|
||||||
|
|
||||||
|
#include "gui/widget.h"
|
||||||
|
|
||||||
|
class Box : public Widget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Box(int align);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Events
|
||||||
|
bool onProcessMessage(JMessage msg);
|
||||||
|
void onPreferredSize(PreferredSizeEvent& ev);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void box_set_position(JRect rect);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -120,7 +120,8 @@ int jalert(const char *format, ...)
|
|||||||
|
|
||||||
static Frame* create_alert(char *buf, JList *labels, JList *buttons)
|
static Frame* create_alert(char *buf, JList *labels, JList *buttons)
|
||||||
{
|
{
|
||||||
JWidget box1, box2, grid, box3, box4, box5;
|
Box* box1, *box2, *box3, *box4, *box5;
|
||||||
|
Widget* grid;
|
||||||
Frame* window = NULL;
|
Frame* window = NULL;
|
||||||
bool title = true;
|
bool title = true;
|
||||||
bool label = false;
|
bool label = false;
|
||||||
@ -193,18 +194,18 @@ static Frame* create_alert(char *buf, JList *labels, JList *buttons)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (window) {
|
if (window) {
|
||||||
box1 = jbox_new(JI_VERTICAL);
|
box1 = new Box(JI_VERTICAL);
|
||||||
box2 = jbox_new(JI_VERTICAL);
|
box2 = new Box(JI_VERTICAL);
|
||||||
grid = jgrid_new(1, false);
|
grid = jgrid_new(1, false);
|
||||||
box3 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
box3 = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
|
|
||||||
/* to identify by the user */
|
/* to identify by the user */
|
||||||
box2->setName("labels");
|
box2->setName("labels");
|
||||||
box3->setName("buttons");
|
box3->setName("buttons");
|
||||||
|
|
||||||
/* pseudo separators (only to fill blank space) */
|
/* pseudo separators (only to fill blank space) */
|
||||||
box4 = jbox_new(0);
|
box4 = new Box(0);
|
||||||
box5 = jbox_new(0);
|
box5 = new Box(0);
|
||||||
|
|
||||||
jwidget_expansive(box4, true);
|
jwidget_expansive(box4, true);
|
||||||
jwidget_expansive(box5, true);
|
jwidget_expansive(box5, true);
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
// ASE gui library
|
|
||||||
// Copyright (C) 2001-2011 David Capello
|
|
||||||
//
|
|
||||||
// This source file is ditributed under a BSD-like license, please
|
|
||||||
// read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
#ifndef GUI_JBOX_H_INCLUDED
|
|
||||||
#define GUI_JBOX_H_INCLUDED
|
|
||||||
|
|
||||||
#include "gui/jbase.h"
|
|
||||||
|
|
||||||
JWidget jbox_new(int align);
|
|
||||||
|
|
||||||
#endif
|
|
@ -7,13 +7,13 @@
|
|||||||
#ifndef GUI_JINETE_H_INCLUDED
|
#ifndef GUI_JINETE_H_INCLUDED
|
||||||
#define GUI_JINETE_H_INCLUDED
|
#define GUI_JINETE_H_INCLUDED
|
||||||
|
|
||||||
|
#include "gui/box.h"
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/entry.h"
|
#include "gui/entry.h"
|
||||||
#include "gui/frame.h"
|
#include "gui/frame.h"
|
||||||
#include "gui/jaccel.h"
|
#include "gui/jaccel.h"
|
||||||
#include "gui/jalert.h"
|
#include "gui/jalert.h"
|
||||||
#include "gui/jbase.h"
|
#include "gui/jbase.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jclipboard.h"
|
#include "gui/jclipboard.h"
|
||||||
#include "gui/jcombobox.h"
|
#include "gui/jcombobox.h"
|
||||||
#include "gui/jcustom_label.h"
|
#include "gui/jcustom_label.h"
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
struct BITMAP;
|
struct BITMAP;
|
||||||
struct FONT;
|
struct FONT;
|
||||||
|
|
||||||
|
class Box;
|
||||||
class ButtonBase;
|
class ButtonBase;
|
||||||
class Entry;
|
class Entry;
|
||||||
class Slider;
|
class Slider;
|
||||||
@ -46,7 +47,7 @@ public:
|
|||||||
virtual int color_selected() = 0;
|
virtual int color_selected() = 0;
|
||||||
virtual int color_background() = 0;
|
virtual int color_background() = 0;
|
||||||
|
|
||||||
virtual void draw_box(JWidget widget, JRect clip) = 0;
|
virtual void draw_box(Box* widget, JRect clip) = 0;
|
||||||
virtual void draw_button(ButtonBase* widget, JRect clip) = 0;
|
virtual void draw_button(ButtonBase* widget, JRect clip) = 0;
|
||||||
virtual void draw_check(ButtonBase* widget, JRect clip) = 0;
|
virtual void draw_check(ButtonBase* widget, JRect clip) = 0;
|
||||||
virtual void draw_entry(Entry* widget, JRect clip) = 0;
|
virtual void draw_entry(Entry* widget, JRect clip) = 0;
|
||||||
|
@ -611,7 +611,7 @@ int SkinTheme::color_background()
|
|||||||
return COLOR_BACKGROUND;
|
return COLOR_BACKGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkinTheme::draw_box(JWidget widget, JRect clip)
|
void SkinTheme::draw_box(Box* widget, JRect clip)
|
||||||
{
|
{
|
||||||
jdraw_rectfill(clip, BGCOLOR);
|
jdraw_rectfill(clip, BGCOLOR);
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ public:
|
|||||||
int color_selected();
|
int color_selected();
|
||||||
int color_background();
|
int color_background();
|
||||||
|
|
||||||
void draw_box(JWidget widget, JRect clip);
|
void draw_box(Box* widget, JRect clip);
|
||||||
void draw_button(ButtonBase* widget, JRect clip);
|
void draw_button(ButtonBase* widget, JRect clip);
|
||||||
void draw_check(ButtonBase* widget, JRect clip);
|
void draw_check(ButtonBase* widget, JRect clip);
|
||||||
void draw_entry(Entry* widget, JRect clip);
|
void draw_entry(Entry* widget, JRect clip);
|
||||||
|
@ -86,7 +86,7 @@ Frame* colorselector_new()
|
|||||||
Frame* window = new PopupFrame(NULL, false);
|
Frame* window = new PopupFrame(NULL, false);
|
||||||
Widget* grid1 = jgrid_new(2, false);
|
Widget* grid1 = jgrid_new(2, false);
|
||||||
Widget* grid2 = jgrid_new(5, false);
|
Widget* grid2 = jgrid_new(5, false);
|
||||||
Widget* models_box = jbox_new(JI_HORIZONTAL);
|
Box* models_box = new Box(JI_HORIZONTAL);
|
||||||
PalEdit* pal = new PalEdit(false);
|
PalEdit* pal = new PalEdit(false);
|
||||||
Label* idx = new Label("None");
|
Label* idx = new Label("None");
|
||||||
Widget* child;
|
Widget* child;
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
|
#include "gui/box.h"
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/jlist.h"
|
#include "gui/jlist.h"
|
||||||
#include "gui/jsystem.h"
|
#include "gui/jsystem.h"
|
||||||
@ -39,8 +39,8 @@ static bool radio_change_hook(JWidget vbox);
|
|||||||
|
|
||||||
JWidget group_button_new(int w, int h, int first_selected, ...)
|
JWidget group_button_new(int w, int h, int first_selected, ...)
|
||||||
{
|
{
|
||||||
JWidget vbox = jbox_new(JI_VERTICAL | JI_HOMOGENEOUS);
|
Box* vbox = new Box(JI_VERTICAL | JI_HOMOGENEOUS);
|
||||||
JWidget hbox = NULL;
|
Box* hbox = NULL;
|
||||||
RadioButton* radio;
|
RadioButton* radio;
|
||||||
int x, y, icon;
|
int x, y, icon;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -53,7 +53,7 @@ JWidget group_button_new(int w, int h, int first_selected, ...)
|
|||||||
|
|
||||||
for (y=0; y<h; y++) {
|
for (y=0; y<h; y++) {
|
||||||
if (w > 1) {
|
if (w > 1) {
|
||||||
hbox = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
hbox = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
jwidget_noborders(hbox);
|
jwidget_noborders(hbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ StatusBar::StatusBar()
|
|||||||
|
|
||||||
// Construct the commands box
|
// Construct the commands box
|
||||||
{
|
{
|
||||||
Widget* box1 = jbox_new(JI_HORIZONTAL);
|
Box* box1 = new Box(JI_HORIZONTAL);
|
||||||
Widget* box2 = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
Box* box2 = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
Widget* box3 = jbox_new(JI_HORIZONTAL);
|
Box* box3 = new Box(JI_HORIZONTAL);
|
||||||
m_slider = new Slider(0, 255, 255);
|
m_slider = new Slider(0, 255, 255);
|
||||||
|
|
||||||
setup_mini_look(m_slider);
|
setup_mini_look(m_slider);
|
||||||
@ -140,10 +140,10 @@ StatusBar::StatusBar()
|
|||||||
|
|
||||||
// Construct move-pixels box
|
// Construct move-pixels box
|
||||||
{
|
{
|
||||||
Widget* filler = jbox_new(JI_HORIZONTAL);
|
Box* filler = new Box(JI_HORIZONTAL);
|
||||||
jwidget_expansive(filler, true);
|
jwidget_expansive(filler, true);
|
||||||
|
|
||||||
m_movePixelsBox = jbox_new(JI_HORIZONTAL);
|
m_movePixelsBox = new Box(JI_HORIZONTAL);
|
||||||
m_transparentLabel = new Label("Transparent Color:");
|
m_transparentLabel = new Label("Transparent Color:");
|
||||||
m_transparentColor = new ColorButton(Color::fromMask(), IMAGE_RGB);
|
m_transparentColor = new ColorButton(Color::fromMask(), IMAGE_RGB);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "gui/jbase.h"
|
#include "gui/jbase.h"
|
||||||
#include "gui/widget.h"
|
#include "gui/widget.h"
|
||||||
|
|
||||||
|
class Box;
|
||||||
class Button;
|
class Button;
|
||||||
class ColorButton;
|
class ColorButton;
|
||||||
class Frame;
|
class Frame;
|
||||||
@ -100,7 +101,7 @@ private:
|
|||||||
Button* m_b_last; // Go to last frame
|
Button* m_b_last; // Go to last frame
|
||||||
|
|
||||||
// Box with move-pixels commands (when the user drag-and-drop selected pixels using the editor)
|
// Box with move-pixels commands (when the user drag-and-drop selected pixels using the editor)
|
||||||
Widget* m_movePixelsBox;
|
Box* m_movePixelsBox;
|
||||||
Widget* m_transparentLabel;
|
Widget* m_transparentLabel;
|
||||||
ColorButton* m_transparentColor;
|
ColorButton* m_transparentColor;
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
#include "core/cfg.h"
|
#include "core/cfg.h"
|
||||||
#include "effect/effect.h"
|
#include "effect/effect.h"
|
||||||
|
#include "gui/box.h"
|
||||||
#include "gui/button.h"
|
#include "gui/button.h"
|
||||||
#include "gui/jbox.h"
|
|
||||||
#include "gui/jhook.h"
|
#include "gui/jhook.h"
|
||||||
#include "gui/theme.h"
|
#include "gui/theme.h"
|
||||||
#include "gui/widget.h"
|
#include "gui/widget.h"
|
||||||
@ -54,7 +54,7 @@ JWidget target_button_new(int imgtype, bool with_channels)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int default_targets = 0;
|
int default_targets = 0;
|
||||||
JWidget vbox, hbox;
|
Box* vbox, *hbox;
|
||||||
CheckBox* r = NULL;
|
CheckBox* r = NULL;
|
||||||
CheckBox* g = NULL;
|
CheckBox* g = NULL;
|
||||||
CheckBox* b = NULL;
|
CheckBox* b = NULL;
|
||||||
@ -63,8 +63,8 @@ JWidget target_button_new(int imgtype, bool with_channels)
|
|||||||
CheckBox* index = NULL;
|
CheckBox* index = NULL;
|
||||||
Button* images = NULL;
|
Button* images = NULL;
|
||||||
|
|
||||||
vbox = jbox_new(JI_VERTICAL);
|
vbox = new Box(JI_VERTICAL);
|
||||||
hbox = jbox_new(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
hbox = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||||
|
|
||||||
jwidget_noborders(vbox);
|
jwidget_noborders(vbox);
|
||||||
jwidget_noborders(hbox);
|
jwidget_noborders(hbox);
|
||||||
|
@ -93,9 +93,9 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
|
|||||||
bool vertical = bool_attr_is_true(elem, "vertical");
|
bool vertical = bool_attr_is_true(elem, "vertical");
|
||||||
bool homogeneous = bool_attr_is_true(elem, "homogeneous");
|
bool homogeneous = bool_attr_is_true(elem, "homogeneous");
|
||||||
|
|
||||||
widget = jbox_new((horizontal ? JI_HORIZONTAL:
|
widget = new Box((horizontal ? JI_HORIZONTAL:
|
||||||
vertical ? JI_VERTICAL: 0) |
|
vertical ? JI_VERTICAL: 0) |
|
||||||
(homogeneous ? JI_HOMOGENEOUS: 0));
|
(homogeneous ? JI_HOMOGENEOUS: 0));
|
||||||
}
|
}
|
||||||
/* button */
|
/* button */
|
||||||
else if (ustrcmp(elem_name, "button") == 0) {
|
else if (ustrcmp(elem_name, "button") == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user