mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
Remove JI_ prefix from ui/base.h constants
This commit is contained in:
parent
66330dc39a
commit
f01b816fb5
@ -209,7 +209,7 @@ Widget* AppMenus::convertXmlelemToMenuitem(TiXmlElement* elem)
|
||||
{
|
||||
// is it a <separator>?
|
||||
if (strcmp(elem->Value(), "separator") == 0)
|
||||
return new Separator("", JI_HORIZONTAL);
|
||||
return new Separator("", HORIZONTAL);
|
||||
|
||||
const char* command_name = elem->Attribute("command");
|
||||
Command* command =
|
||||
@ -265,7 +265,7 @@ Widget* AppMenus::createInvalidVersionMenuitem()
|
||||
subMenu->addChild(new AppMenuItem(PACKAGE " is using a customized gui.xml (maybe from your HOME directory)."));
|
||||
subMenu->addChild(new AppMenuItem("You should update your customized gui.xml file to the new version to get"));
|
||||
subMenu->addChild(new AppMenuItem("the latest commands available."));
|
||||
subMenu->addChild(new Separator("", JI_HORIZONTAL));
|
||||
subMenu->addChild(new Separator("", HORIZONTAL));
|
||||
subMenu->addChild(new AppMenuItem("You can bypass this validation adding the correct version"));
|
||||
subMenu->addChild(new AppMenuItem("number in <gui version=\"" VERSION "\"> element."));
|
||||
menuitem->setSubmenu(subMenu);
|
||||
|
@ -37,20 +37,20 @@ AboutCommand::AboutCommand()
|
||||
void AboutCommand::onExecute(Context* context)
|
||||
{
|
||||
base::UniquePtr<Window> window(new Window(Window::WithTitleBar, "About " PACKAGE));
|
||||
Box* box1 = new Box(JI_VERTICAL);
|
||||
Box* box1 = new Box(VERTICAL);
|
||||
Grid* grid = new Grid(2, false);
|
||||
Label* title = new Label(PACKAGE " v" VERSION);
|
||||
Label* subtitle = new Label("Animated sprite editor & pixel art tool");
|
||||
Separator* authors_separator1 = new Separator("Authors:", JI_HORIZONTAL | JI_TOP);
|
||||
Separator* authors_separator2 = new Separator("", JI_HORIZONTAL);
|
||||
Separator* authors_separator1 = new Separator("Authors:", HORIZONTAL | TOP);
|
||||
Separator* authors_separator2 = new Separator("", HORIZONTAL);
|
||||
Label* author1 = new LinkLabel("http://davidcapello.com/", "David Capello");
|
||||
Label* author1_desc = new Label("- Lead developer, graphics & maintainer");
|
||||
Label* author2 = new LinkLabel("http://ilkke.blogspot.com/", "Ilija Melentijevic");
|
||||
Label* author2_desc = new Label("- Default skin & graphics introduced in v0.8");
|
||||
Label* author3 = new LinkLabel(WEBSITE_CONTRIBUTORS, "Contributors");
|
||||
Box* bottom_box1 = new Box(JI_HORIZONTAL);
|
||||
Box* bottom_box2 = new Box(JI_HORIZONTAL);
|
||||
Box* bottom_box3 = new Box(JI_HORIZONTAL);
|
||||
Box* bottom_box1 = new Box(HORIZONTAL);
|
||||
Box* bottom_box2 = new Box(HORIZONTAL);
|
||||
Box* bottom_box3 = new Box(HORIZONTAL);
|
||||
Label* copyright = new Label(COPYRIGHT);
|
||||
Label* website = new LinkLabel(WEBSITE);
|
||||
Button* close_button = new Button("&Close");
|
||||
|
@ -99,14 +99,14 @@ void CelPropertiesCommand::onExecute(Context* context)
|
||||
tooltipManager->addTooltipFor(slider_opacity,
|
||||
"The `Background' layer is opaque,\n"
|
||||
"its opacity can't be changed.",
|
||||
JI_LEFT);
|
||||
LEFT);
|
||||
}
|
||||
else if (sprite->pixelFormat() == IMAGE_INDEXED) {
|
||||
slider_opacity->setEnabled(false);
|
||||
tooltipManager->addTooltipFor(slider_opacity,
|
||||
"Cel opacity of Indexed images\n"
|
||||
"cannot be changed.",
|
||||
JI_LEFT);
|
||||
LEFT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -96,10 +96,10 @@ void MaskByColorCommand::onExecute(Context* context)
|
||||
return;
|
||||
|
||||
m_window = new Window(Window::WithTitleBar, "Mask by Color");
|
||||
box1 = new Box(JI_VERTICAL);
|
||||
box2 = new Box(JI_HORIZONTAL);
|
||||
box3 = new Box(JI_HORIZONTAL);
|
||||
box4 = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||
box1 = new Box(VERTICAL);
|
||||
box2 = new Box(HORIZONTAL);
|
||||
box3 = new Box(HORIZONTAL);
|
||||
box4 = new Box(HORIZONTAL | HOMOGENEOUS);
|
||||
label_color = new Label("Color:");
|
||||
m_buttonColor = new ColorButton
|
||||
(get_config_color("MaskColor", "Color",
|
||||
|
@ -239,9 +239,9 @@ bool PaletteEditorCommand::onChecked(Context* context)
|
||||
PaletteEntryEditor::PaletteEntryEditor()
|
||||
: Window(WithTitleBar, "Palette Editor (F4)")
|
||||
, m_type(app::Color::MaskType)
|
||||
, m_vbox(JI_VERTICAL)
|
||||
, m_topBox(JI_HORIZONTAL)
|
||||
, m_bottomBox(JI_HORIZONTAL)
|
||||
, m_vbox(VERTICAL)
|
||||
, m_topBox(HORIZONTAL)
|
||||
, m_bottomBox(HORIZONTAL)
|
||||
, m_colorType(2)
|
||||
, m_changeMode(2)
|
||||
, m_entryLabel("")
|
||||
@ -263,9 +263,9 @@ PaletteEntryEditor::PaletteEntryEditor()
|
||||
|
||||
// Top box
|
||||
m_topBox.addChild(&m_colorType);
|
||||
m_topBox.addChild(new Separator("", JI_VERTICAL));
|
||||
m_topBox.addChild(new Separator("", VERTICAL));
|
||||
m_topBox.addChild(&m_changeMode);
|
||||
m_topBox.addChild(new Separator("", JI_VERTICAL));
|
||||
m_topBox.addChild(new Separator("", VERTICAL));
|
||||
m_topBox.addChild(&m_hexColorEntry);
|
||||
m_topBox.addChild(&m_entryLabel);
|
||||
m_topBox.addChild(new BoxFiller);
|
||||
|
@ -30,7 +30,7 @@ using namespace ui;
|
||||
using namespace app::skin;
|
||||
|
||||
FilterTargetButtons::FilterTargetButtons(int imgtype, bool withChannels)
|
||||
: Box(JI_VERTICAL)
|
||||
: Box(VERTICAL)
|
||||
, m_target(0)
|
||||
{
|
||||
#define ADD(box, widget, hook) \
|
||||
@ -49,7 +49,7 @@ FilterTargetButtons::FilterTargetButtons(int imgtype, bool withChannels)
|
||||
CheckBox* index = NULL;
|
||||
Button* images = NULL;
|
||||
|
||||
hbox = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||
hbox = new Box(HORIZONTAL | HOMOGENEOUS);
|
||||
|
||||
this->noBorderNoChildSpacing();
|
||||
hbox->noBorderNoChildSpacing();
|
||||
@ -96,7 +96,7 @@ FilterTargetButtons::FilterTargetButtons(int imgtype, bool withChannels)
|
||||
set_gfxicon_to_button(images,
|
||||
getTargetNormalIcon(),
|
||||
getTargetSelectedIcon(), -1,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
|
||||
// Make hierarchy
|
||||
ADD(hbox, r, onChannelChange);
|
||||
@ -175,7 +175,7 @@ void FilterTargetButtons::onImagesChange(ButtonBase* button)
|
||||
set_gfxicon_to_button(button,
|
||||
getTargetNormalIcon(),
|
||||
getTargetSelectedIcon(), -1,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
|
||||
TargetChange();
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ FilterWindow::FilterWindow(const char* title, const char* cfgSection,
|
||||
: Window(WithTitleBar, title)
|
||||
, m_cfgSection(cfgSection)
|
||||
, m_filterMgr(filterMgr)
|
||||
, m_hbox(JI_HORIZONTAL)
|
||||
, m_vbox(JI_VERTICAL)
|
||||
, m_container(JI_VERTICAL)
|
||||
, m_hbox(HORIZONTAL)
|
||||
, m_vbox(VERTICAL)
|
||||
, m_container(VERTICAL)
|
||||
, m_okButton("&OK")
|
||||
, m_cancelButton("&Cancel")
|
||||
, m_preview(filterMgr)
|
||||
|
@ -55,7 +55,7 @@ Console::Console(Context* ctx)
|
||||
Window* window = new Window(Window::WithTitleBar, "Errors Console");
|
||||
Grid* grid = new Grid(1, false);
|
||||
View* view = new View();
|
||||
TextBox* textbox = new TextBox("", JI_WORDWRAP);
|
||||
TextBox* textbox = new TextBox("", WORDWRAP);
|
||||
Button* button = new Button("&Cancel");
|
||||
|
||||
if (!grid || !textbox || !button)
|
||||
@ -68,8 +68,8 @@ Console::Console(Context* ctx)
|
||||
|
||||
button->setMinSize(gfx::Size(60, 0));
|
||||
|
||||
grid->addChildInCell(view, 1, 1, JI_HORIZONTAL | JI_VERTICAL);
|
||||
grid->addChildInCell(button, 1, 1, JI_CENTER);
|
||||
grid->addChildInCell(view, 1, 1, HORIZONTAL | VERTICAL);
|
||||
grid->addChildInCell(button, 1, 1, CENTER);
|
||||
window->addChild(grid);
|
||||
|
||||
view->setVisible(false);
|
||||
|
@ -331,7 +331,7 @@ CheckBox* check_button_new(const char *text, int b1, int b2, int b3, int b4)
|
||||
{
|
||||
CheckBox* widget = new CheckBox(text, kButtonWidget);
|
||||
|
||||
widget->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
widget->setAlign(CENTER | MIDDLE);
|
||||
|
||||
setup_mini_look(widget);
|
||||
setup_bevels(widget, b1, b2, b3, b4);
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
deleteAllItem.Click.connect(&Item::onDeleteAllBrushes, this);
|
||||
menu.addChild(&lockItem);
|
||||
menu.addChild(&deleteItem);
|
||||
menu.addChild(new Separator("", JI_HORIZONTAL));
|
||||
menu.addChild(new Separator("", HORIZONTAL));
|
||||
menu.addChild(&deleteAllItem);
|
||||
|
||||
// Here we make the popup window temporaly floating, so it's
|
||||
@ -173,7 +173,7 @@ void BrushPopup::regenerate(const gfx::Rect& box, const Brushes& brushes)
|
||||
std::string tooltip;
|
||||
tooltip += "Shortcut: ";
|
||||
tooltip += key->accels().front().toString();
|
||||
m_tooltipManager->addTooltipFor(item, tooltip, JI_TOP);
|
||||
m_tooltipManager->addTooltipFor(item, tooltip, TOP);
|
||||
}
|
||||
slot++;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ void ButtonSet::addItem(she::Surface* icon, int hspan, int vspan)
|
||||
|
||||
void ButtonSet::addItem(Item* item, int hspan, int vspan)
|
||||
{
|
||||
addChildInCell(item, hspan, vspan, JI_CENTER | JI_MIDDLE);
|
||||
addChildInCell(item, hspan, vspan, CENTER | MIDDLE);
|
||||
}
|
||||
|
||||
ButtonSet::Item* ButtonSet::getItem(int index)
|
||||
|
@ -140,7 +140,7 @@ ColorBar::ColorBar(int align)
|
||||
palViewBox->addChild(&m_remapButton);
|
||||
|
||||
ColorSpectrum* spectrum = new ColorSpectrum;
|
||||
Splitter* splitter = new Splitter(Splitter::ByPercentage, JI_VERTICAL);
|
||||
Splitter* splitter = new Splitter(Splitter::ByPercentage, VERTICAL);
|
||||
splitter->setPosition(80);
|
||||
splitter->setExpansive(true);
|
||||
splitter->addChild(palViewBox);
|
||||
@ -184,11 +184,11 @@ ColorBar::ColorBar(int align)
|
||||
// Tooltips
|
||||
TooltipManager* tooltipManager = new TooltipManager();
|
||||
addChild(tooltipManager);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::EDIT), "Edit Color", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::SORT), "Sort & Gradients", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::PRESETS), "Presets", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::OPTIONS), "Options", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(&m_remapButton, "Matches old indexes with new indexes", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::EDIT), "Edit Color", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::SORT), "Sort & Gradients", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::PRESETS), "Presets", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_buttons.getItem((int)PalButton::OPTIONS), "Options", BOTTOM);
|
||||
tooltipManager->addTooltipFor(&m_remapButton, "Matches old indexes with new indexes", BOTTOM);
|
||||
|
||||
onColorButtonChange(getFgColor());
|
||||
|
||||
@ -298,12 +298,12 @@ void ColorBar::onPaletteButtonClick()
|
||||
des("Descending");
|
||||
menu.addChild(&rev);
|
||||
menu.addChild(&grd);
|
||||
menu.addChild(new ui::Separator("", JI_HORIZONTAL));
|
||||
menu.addChild(new ui::Separator("", HORIZONTAL));
|
||||
menu.addChild(&hue);
|
||||
menu.addChild(&sat);
|
||||
menu.addChild(&bri);
|
||||
menu.addChild(&lum);
|
||||
menu.addChild(new ui::Separator("", JI_HORIZONTAL));
|
||||
menu.addChild(new ui::Separator("", HORIZONTAL));
|
||||
menu.addChild(&asc);
|
||||
menu.addChild(&des);
|
||||
|
||||
|
@ -59,8 +59,8 @@ public:
|
||||
|
||||
ColorSelector::ColorSelector()
|
||||
: PopupWindowPin("Color Selector", PopupWindow::kCloseOnClickInOtherWindow)
|
||||
, m_vbox(JI_VERTICAL)
|
||||
, m_topBox(JI_HORIZONTAL)
|
||||
, m_vbox(VERTICAL)
|
||||
, m_topBox(HORIZONTAL)
|
||||
, m_color(app::Color::fromMask())
|
||||
, m_colorPalette(false, PaletteView::SelectOneColor, this, 7*guiscale())
|
||||
, m_colorType(5)
|
||||
@ -82,11 +82,11 @@ ColorSelector::ColorSelector()
|
||||
m_colorPaletteContainer.setExpansive(true);
|
||||
|
||||
m_topBox.addChild(&m_colorType);
|
||||
m_topBox.addChild(new Separator("", JI_VERTICAL));
|
||||
m_topBox.addChild(new Separator("", VERTICAL));
|
||||
m_topBox.addChild(&m_hexColorEntry);
|
||||
m_topBox.addChild(m_warningIcon);
|
||||
{
|
||||
Box* miniVbox = new Box(JI_VERTICAL);
|
||||
Box* miniVbox = new Box(VERTICAL);
|
||||
miniVbox->addChild(getPin());
|
||||
m_topBox.addChild(new BoxFiller);
|
||||
m_topBox.addChild(miniVbox);
|
||||
@ -113,7 +113,7 @@ ColorSelector::ColorSelector()
|
||||
m_onPaletteChangeConn =
|
||||
App::instance()->PaletteChange.connect(&ColorSelector::onPaletteChange, this);
|
||||
|
||||
m_tooltips.addTooltipFor(m_warningIcon, "This color isn't in the palette\nPress here to add it.", JI_BOTTOM);
|
||||
m_tooltips.addTooltipFor(m_warningIcon, "This color isn't in the palette\nPress here to add it.", BOTTOM);
|
||||
|
||||
initTheme();
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ void ColorSliders::addSlider(Channel channel, const char* labelText, int min, in
|
||||
relSlider->setExpansive(true);
|
||||
relSlider->setVisible(false);
|
||||
|
||||
m_grid.addChildInCell(label, 1, 1, JI_LEFT | JI_MIDDLE);
|
||||
m_grid.addChildInCell(box, 1, 1, JI_HORIZONTAL | JI_VERTICAL | JI_EXPANSIVE);
|
||||
m_grid.addChildInCell(entry, 1, 1, JI_LEFT | JI_MIDDLE);
|
||||
m_grid.addChildInCell(label, 1, 1, LEFT | MIDDLE);
|
||||
m_grid.addChildInCell(box, 1, 1, HORIZONTAL | VERTICAL | EXPANSIVE);
|
||||
m_grid.addChildInCell(entry, 1, 1, LEFT | MIDDLE);
|
||||
}
|
||||
|
||||
void ColorSliders::setAbsSliderValue(int sliderIndex, int value)
|
||||
|
@ -30,7 +30,7 @@ using namespace ui;
|
||||
ColorSpectrum::ColorSpectrum()
|
||||
: Widget(kGenericWidget)
|
||||
{
|
||||
setAlign(JI_HORIZONTAL);
|
||||
setAlign(HORIZONTAL);
|
||||
}
|
||||
|
||||
ColorSpectrum::~ColorSpectrum()
|
||||
@ -43,11 +43,11 @@ app::Color ColorSpectrum::pickColor(const gfx::Point& pos) const
|
||||
if (rc.isEmpty() || !rc.contains(pos))
|
||||
return app::Color::fromMask();
|
||||
|
||||
int vmid = (getAlign() & JI_HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
int vmid = (getAlign() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
vmid = MAX(1, vmid);
|
||||
|
||||
int u, v, umax;
|
||||
if (getAlign() & JI_HORIZONTAL) {
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
u = pos.x - rc.x;
|
||||
v = pos.y - rc.y;
|
||||
umax = MAX(1, rc.w-1);
|
||||
@ -90,13 +90,13 @@ void ColorSpectrum::onPaint(ui::PaintEvent& ev)
|
||||
if (rc.isEmpty())
|
||||
return;
|
||||
|
||||
int vmid = (getAlign() & JI_HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
int vmid = (getAlign() & HORIZONTAL ? rc.h/2 : rc.w/2);
|
||||
vmid = MAX(1, vmid);
|
||||
|
||||
for (int y=0; y<rc.h; ++y) {
|
||||
for (int x=0; x<rc.w; ++x) {
|
||||
int u, v, umax;
|
||||
if (getAlign() & JI_HORIZONTAL) {
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
u = x;
|
||||
v = y;
|
||||
umax = MAX(1, rc.w-1);
|
||||
|
@ -564,7 +564,7 @@ public:
|
||||
}
|
||||
|
||||
int getIconAlign() override {
|
||||
return JI_CENTER | JI_MIDDLE;
|
||||
return CENTER | MIDDLE;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -605,9 +605,9 @@ private:
|
||||
m_freehandAlgoButton->setTransparent(true);
|
||||
m_freehandAlgoButton->setBgColor(gfx::ColorNone);
|
||||
|
||||
m_tooltipManager->addTooltipFor(at(0), "Normal trace", JI_TOP);
|
||||
m_tooltipManager->addTooltipFor(at(1), "Pixel-perfect trace", JI_TOP);
|
||||
m_tooltipManager->addTooltipFor(at(2), "Dots", JI_TOP);
|
||||
m_tooltipManager->addTooltipFor(at(0), "Normal trace", TOP);
|
||||
m_tooltipManager->addTooltipFor(at(1), "Pixel-perfect trace", TOP);
|
||||
m_tooltipManager->addTooltipFor(at(2), "Dots", TOP);
|
||||
|
||||
m_popupWindow->addChild(m_freehandAlgoButton);
|
||||
m_popupWindow->openWindow();
|
||||
@ -694,9 +694,9 @@ public:
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager) {
|
||||
tooltipManager->addTooltipFor(at(0), "Replace selection", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Add to selection\n(Shift)", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(2), "Subtract from selection\n(Shift+Alt)", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(0), "Replace selection", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Add to selection\n(Shift)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(2), "Subtract from selection\n(Shift+Alt)", BOTTOM);
|
||||
}
|
||||
|
||||
void setSelectionMode(SelectionMode mode) {
|
||||
@ -725,8 +725,8 @@ public:
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager) {
|
||||
tooltipManager->addTooltipFor(at(0), "Drop pixels here", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Cancel drag and drop", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(0), "Drop pixels here", BOTTOM);
|
||||
tooltipManager->addTooltipFor(at(1), "Cancel drag and drop", BOTTOM);
|
||||
}
|
||||
|
||||
Signal1<void, ContextBarObserver::DropAction> DropPixels;
|
||||
@ -777,7 +777,7 @@ protected:
|
||||
};
|
||||
|
||||
ContextBar::ContextBar()
|
||||
: Box(JI_HORIZONTAL)
|
||||
: Box(HORIZONTAL)
|
||||
{
|
||||
border_width.b = 2*guiscale();
|
||||
|
||||
@ -835,20 +835,20 @@ ContextBar::ContextBar()
|
||||
TooltipManager* tooltipManager = new TooltipManager();
|
||||
addChild(tooltipManager);
|
||||
|
||||
tooltipManager->addTooltipFor(m_brushType, "Brush Type", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_brushSize, "Brush Size (in pixels)", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_brushAngle, "Brush Angle (in degrees)", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_inkOpacity, "Opacity (Alpha value in RGBA)", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_sprayWidth, "Spray Width", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_spraySpeed, "Spray Speed", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_transparentColor, "Transparent Color", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_rotAlgo, "Rotation Algorithm", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_freehandAlgo, "Freehand trace algorithm", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_brushType, "Brush Type", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_brushSize, "Brush Size (in pixels)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_brushAngle, "Brush Angle (in degrees)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_inkOpacity, "Opacity (Alpha value in RGBA)", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_sprayWidth, "Spray Width", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_spraySpeed, "Spray Speed", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_transparentColor, "Transparent Color", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_rotAlgo, "Rotation Algorithm", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_freehandAlgo, "Freehand trace algorithm", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_grabAlpha,
|
||||
"When checked the tool picks the color from the active layer, and its alpha\n"
|
||||
"component is used to setup the opacity level of all drawing tools.\n\n"
|
||||
"When unchecked -the default behavior- the color is picked\n"
|
||||
"from the composition of all sprite layers.", JI_LEFT | JI_TOP);
|
||||
"from the composition of all sprite layers.", LEFT | TOP);
|
||||
|
||||
m_brushType->setupTooltips(tooltipManager);
|
||||
m_selectionMode->setupTooltips(tooltipManager);
|
||||
|
@ -133,7 +133,7 @@ private:
|
||||
} // anonymous namespace
|
||||
|
||||
DataRecoveryView::DataRecoveryView(crash::DataRecovery* dataRecovery)
|
||||
: Box(JI_VERTICAL)
|
||||
: Box(VERTICAL)
|
||||
, m_dataRecovery(dataRecovery)
|
||||
{
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||
|
@ -60,8 +60,8 @@ protected:
|
||||
};
|
||||
|
||||
DevConsoleView::DevConsoleView()
|
||||
: Box(JI_VERTICAL)
|
||||
, m_textBox("Welcome to Aseprite JavaScript Console\n(Experimental)", JI_LEFT)
|
||||
: Box(VERTICAL)
|
||||
, m_textBox("Welcome to Aseprite JavaScript Console\n(Experimental)", LEFT)
|
||||
, m_label(">")
|
||||
, m_entry(new CommmandEntry)
|
||||
, m_engine(this)
|
||||
|
@ -202,7 +202,7 @@ private:
|
||||
};
|
||||
|
||||
DocumentView::DocumentView(Document* document, Type type)
|
||||
: Box(JI_VERTICAL)
|
||||
: Box(VERTICAL)
|
||||
, m_type(type)
|
||||
, m_document(document)
|
||||
, m_view(new EditorView(type == Normal ? EditorView::CurrentEditorMode:
|
||||
|
@ -31,7 +31,7 @@ DropDownButton::DropDownButton(const char* text)
|
||||
setup_look(m_dropDown, RightButtonLook);
|
||||
|
||||
m_button->setExpansive(true);
|
||||
m_button->setAlign(JI_LEFT | JI_MIDDLE);
|
||||
m_button->setAlign(LEFT | MIDDLE);
|
||||
m_button->Click.connect(&DropDownButton::onButtonClick, this);
|
||||
m_dropDown->Click.connect(&DropDownButton::onDropDownButtonClick, this);
|
||||
|
||||
@ -45,7 +45,7 @@ DropDownButton::DropDownButton(const char* text)
|
||||
PART_COMBOBOX_ARROW_DOWN,
|
||||
PART_COMBOBOX_ARROW_DOWN_SELECTED,
|
||||
PART_COMBOBOX_ARROW_DOWN_DISABLED,
|
||||
JI_CENTER | JI_MIDDLE));
|
||||
CENTER | MIDDLE));
|
||||
}
|
||||
|
||||
void DropDownButton::onButtonClick(Event& ev)
|
||||
|
@ -1612,7 +1612,7 @@ void Editor::showAnimationSpeedMultiplierPopup(bool withStopBehaviorOptions)
|
||||
}
|
||||
|
||||
if (withStopBehaviorOptions) {
|
||||
menu.addChild(new Separator("", JI_HORIZONTAL));
|
||||
menu.addChild(new Separator("", HORIZONTAL));
|
||||
MenuItem* item = new MenuItem("Rewind on Stop");
|
||||
item->Click.connect(
|
||||
[]() {
|
||||
|
@ -256,22 +256,22 @@ FileSelector::FileSelector(FileSelectorType type, FileSelectorDelegate* delegate
|
||||
PART_COMBOBOX_ARROW_LEFT,
|
||||
PART_COMBOBOX_ARROW_LEFT_SELECTED,
|
||||
PART_COMBOBOX_ARROW_LEFT_DISABLED,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
set_gfxicon_to_button(goForwardButton(),
|
||||
PART_COMBOBOX_ARROW_RIGHT,
|
||||
PART_COMBOBOX_ARROW_RIGHT_SELECTED,
|
||||
PART_COMBOBOX_ARROW_RIGHT_DISABLED,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
set_gfxicon_to_button(goUpButton(),
|
||||
PART_COMBOBOX_ARROW_UP,
|
||||
PART_COMBOBOX_ARROW_UP_SELECTED,
|
||||
PART_COMBOBOX_ARROW_UP_DISABLED,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
set_gfxicon_to_button(newFolderButton(),
|
||||
PART_NEWFOLDER,
|
||||
PART_NEWFOLDER_SELECTED,
|
||||
PART_NEWFOLDER,
|
||||
JI_CENTER | JI_MIDDLE);
|
||||
CENTER | MIDDLE);
|
||||
|
||||
setup_mini_look(goBackButton());
|
||||
setup_mini_look(goForwardButton());
|
||||
|
@ -28,7 +28,7 @@ static inline bool is_hex_digit(char digit)
|
||||
}
|
||||
|
||||
HexColorEntry::HexColorEntry()
|
||||
: Box(JI_HORIZONTAL)
|
||||
: Box(HORIZONTAL)
|
||||
, m_label("#")
|
||||
, m_entry(16, "")
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ PopupWindowPin::PopupWindowPin(const std::string& text, ClickBehavior clickBehav
|
||||
|
||||
m_pin.Click.connect(&PopupWindowPin::onPinClick, this);
|
||||
|
||||
set_gfxicon_to_button(&m_pin, PART_UNPINNED, PART_PINNED, PART_UNPINNED, JI_CENTER | JI_MIDDLE);
|
||||
set_gfxicon_to_button(&m_pin, PART_UNPINNED, PART_PINNED, PART_UNPINNED, CENTER | MIDDLE);
|
||||
}
|
||||
|
||||
void PopupWindowPin::onPinClick(Event& ev)
|
||||
|
@ -561,17 +561,17 @@ void SkinTheme::onRegenerate()
|
||||
const char* valign = xmlRule->Attribute("valign");
|
||||
const char* wordwrap = xmlRule->Attribute("wordwrap");
|
||||
if (halign) {
|
||||
if (strcmp(halign, "left") == 0) align |= JI_LEFT;
|
||||
else if (strcmp(halign, "right") == 0) align |= JI_RIGHT;
|
||||
else if (strcmp(halign, "center") == 0) align |= JI_CENTER;
|
||||
if (strcmp(halign, "left") == 0) align |= LEFT;
|
||||
else if (strcmp(halign, "right") == 0) align |= RIGHT;
|
||||
else if (strcmp(halign, "center") == 0) align |= CENTER;
|
||||
}
|
||||
if (valign) {
|
||||
if (strcmp(valign, "top") == 0) align |= JI_TOP;
|
||||
else if (strcmp(valign, "bottom") == 0) align |= JI_BOTTOM;
|
||||
else if (strcmp(valign, "middle") == 0) align |= JI_MIDDLE;
|
||||
if (strcmp(valign, "top") == 0) align |= TOP;
|
||||
else if (strcmp(valign, "bottom") == 0) align |= BOTTOM;
|
||||
else if (strcmp(valign, "middle") == 0) align |= MIDDLE;
|
||||
}
|
||||
if (wordwrap && strcmp(wordwrap, "true") == 0)
|
||||
align |= JI_WORDWRAP;
|
||||
align |= WORDWRAP;
|
||||
|
||||
if (ruleName == "background") {
|
||||
const char* repeat_id = xmlRule->Attribute("repeat");
|
||||
@ -697,7 +697,7 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
PART_CHECK_NORMAL,
|
||||
PART_CHECK_SELECTED,
|
||||
PART_CHECK_DISABLED,
|
||||
JI_LEFT | JI_MIDDLE));
|
||||
LEFT | MIDDLE));
|
||||
break;
|
||||
|
||||
case kEntryWidget:
|
||||
@ -746,7 +746,7 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
PART_COMBOBOX_ARROW_DOWN,
|
||||
PART_COMBOBOX_ARROW_DOWN_SELECTED,
|
||||
PART_COMBOBOX_ARROW_DOWN_DISABLED,
|
||||
JI_CENTER | JI_MIDDLE));
|
||||
CENTER | MIDDLE));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -776,17 +776,17 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
PART_RADIO_NORMAL,
|
||||
PART_RADIO_SELECTED,
|
||||
PART_RADIO_DISABLED,
|
||||
JI_LEFT | JI_MIDDLE));
|
||||
LEFT | MIDDLE));
|
||||
break;
|
||||
|
||||
case kSeparatorWidget:
|
||||
// Frame
|
||||
if ((widget->getAlign() & JI_HORIZONTAL) &&
|
||||
(widget->getAlign() & JI_VERTICAL)) {
|
||||
if ((widget->getAlign() & HORIZONTAL) &&
|
||||
(widget->getAlign() & VERTICAL)) {
|
||||
BORDER(4 * scale);
|
||||
}
|
||||
// Horizontal bar
|
||||
else if (widget->getAlign() & JI_HORIZONTAL) {
|
||||
else if (widget->getAlign() & HORIZONTAL) {
|
||||
BORDER4(2 * scale, 4 * scale, 2 * scale, 0);
|
||||
}
|
||||
// Vertical bar
|
||||
@ -795,9 +795,9 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
}
|
||||
|
||||
if (widget->hasText()) {
|
||||
if (widget->getAlign() & JI_TOP)
|
||||
if (widget->getAlign() & TOP)
|
||||
widget->border_width.t = widget->getTextHeight();
|
||||
else if (widget->getAlign() & JI_BOTTOM)
|
||||
else if (widget->getAlign() & BOTTOM)
|
||||
widget->border_width.b = widget->getTextHeight();
|
||||
}
|
||||
break;
|
||||
@ -809,7 +809,7 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
m_part[PART_SLIDER_EMPTY_E]->width()-1*scale,
|
||||
m_part[PART_SLIDER_EMPTY_S]->height()-1*scale);
|
||||
widget->child_spacing = widget->getTextHeight();
|
||||
widget->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
widget->setAlign(CENTER | MIDDLE);
|
||||
break;
|
||||
|
||||
case kTextBoxWidget:
|
||||
@ -843,7 +843,7 @@ void SkinTheme::initWidget(Widget* widget)
|
||||
BORDER4(6 * scale, (4+6) * scale, 6 * scale, 6 * scale);
|
||||
widget->border_width.t += widget->getTextHeight();
|
||||
|
||||
if (!(widget->flags & JI_INITIALIZED)) {
|
||||
if (!(widget->flags & INITIALIZED)) {
|
||||
Button* button = new WindowCloseButton();
|
||||
widget->addChild(button);
|
||||
}
|
||||
@ -1255,9 +1255,9 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
|
||||
// Text
|
||||
if (bar)
|
||||
widget->setAlign(JI_CENTER | JI_MIDDLE);
|
||||
widget->setAlign(CENTER | MIDDLE);
|
||||
else
|
||||
widget->setAlign(JI_LEFT | JI_MIDDLE);
|
||||
widget->setAlign(LEFT | MIDDLE);
|
||||
|
||||
Rect pos = bounds;
|
||||
if (!bar)
|
||||
@ -1298,7 +1298,7 @@ void SkinTheme::paintMenuItem(ui::PaintEvent& ev)
|
||||
|
||||
std::string buf = appMenuItem->getKey()->accels().front().toString();
|
||||
|
||||
widget->setAlign(JI_RIGHT | JI_MIDDLE);
|
||||
widget->setAlign(RIGHT | MIDDLE);
|
||||
drawTextString(g, buf.c_str(), fg, ColorNone, widget, pos, 0);
|
||||
widget->setAlign(old_align);
|
||||
}
|
||||
@ -1359,10 +1359,10 @@ void SkinTheme::paintSeparator(ui::PaintEvent& ev)
|
||||
// background
|
||||
g->fillRect(BGCOLOR, bounds);
|
||||
|
||||
if (widget->getAlign() & JI_HORIZONTAL)
|
||||
if (widget->getAlign() & HORIZONTAL)
|
||||
draw_part_as_hline(g, bounds, PART_SEPARATOR_HORZ);
|
||||
|
||||
if (widget->getAlign() & JI_VERTICAL)
|
||||
if (widget->getAlign() & VERTICAL)
|
||||
draw_part_as_vline(g, bounds, PART_SEPARATOR_VERT);
|
||||
|
||||
// text
|
||||
@ -1680,7 +1680,7 @@ void SkinTheme::paintViewScrollbar(PaintEvent& ev)
|
||||
bgStyle->paint(g, rc, NULL, Style::State());
|
||||
|
||||
// Horizontal bar
|
||||
if (widget->getAlign() & JI_HORIZONTAL) {
|
||||
if (widget->getAlign() & HORIZONTAL) {
|
||||
rc.x += pos;
|
||||
rc.w = len;
|
||||
}
|
||||
@ -1784,10 +1784,10 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
int w = PART_TOOLTIP_W;
|
||||
|
||||
switch (widget->getArrowAlign()) {
|
||||
case JI_TOP | JI_LEFT: nw = PART_TOOLTIP_ARROW_NW; break;
|
||||
case JI_TOP | JI_RIGHT: ne = PART_TOOLTIP_ARROW_NE; break;
|
||||
case JI_BOTTOM | JI_LEFT: sw = PART_TOOLTIP_ARROW_SW; break;
|
||||
case JI_BOTTOM | JI_RIGHT: se = PART_TOOLTIP_ARROW_SE; break;
|
||||
case TOP | LEFT: nw = PART_TOOLTIP_ARROW_NW; break;
|
||||
case TOP | RIGHT: ne = PART_TOOLTIP_ARROW_NE; break;
|
||||
case BOTTOM | LEFT: sw = PART_TOOLTIP_ARROW_SW; break;
|
||||
case BOTTOM | RIGHT: se = PART_TOOLTIP_ARROW_SE; break;
|
||||
}
|
||||
|
||||
draw_bounds_template(g, rc, nw, n, ne, e, se, s, sw, w);
|
||||
@ -1799,25 +1799,25 @@ void SkinTheme::paintTooltip(PaintEvent& ev)
|
||||
target.offset(-absRc.getOrigin());
|
||||
|
||||
switch (widget->getArrowAlign()) {
|
||||
case JI_TOP:
|
||||
case TOP:
|
||||
arrow = m_part[PART_TOOLTIP_ARROW_N];
|
||||
g->drawRgbaSurface(arrow,
|
||||
target.x+target.w/2-arrow->width()/2,
|
||||
rc.y);
|
||||
break;
|
||||
case JI_BOTTOM:
|
||||
case BOTTOM:
|
||||
arrow = m_part[PART_TOOLTIP_ARROW_S];
|
||||
g->drawRgbaSurface(arrow,
|
||||
target.x+target.w/2-arrow->width()/2,
|
||||
rc.y+rc.h-arrow->height());
|
||||
break;
|
||||
case JI_LEFT:
|
||||
case LEFT:
|
||||
arrow = m_part[PART_TOOLTIP_ARROW_W];
|
||||
g->drawRgbaSurface(arrow,
|
||||
rc.x,
|
||||
target.y+target.h/2-arrow->height()/2);
|
||||
break;
|
||||
case JI_RIGHT:
|
||||
case RIGHT:
|
||||
arrow = m_part[PART_TOOLTIP_ARROW_E];
|
||||
g->drawRgbaSurface(arrow,
|
||||
rc.x+rc.w-arrow->width(),
|
||||
@ -1872,18 +1872,18 @@ void SkinTheme::drawTextString(Graphics* g, const char *t, gfx::Color fg_color,
|
||||
|
||||
// Horizontally text alignment
|
||||
|
||||
if (widget->getAlign() & JI_RIGHT)
|
||||
if (widget->getAlign() & RIGHT)
|
||||
textrc.x = rc.x + rc.w - textrc.w - 1;
|
||||
else if (widget->getAlign() & JI_CENTER)
|
||||
else if (widget->getAlign() & CENTER)
|
||||
textrc.x = rc.getCenter().x - textrc.w/2;
|
||||
else
|
||||
textrc.x = rc.x;
|
||||
|
||||
// Vertically text alignment
|
||||
|
||||
if (widget->getAlign() & JI_BOTTOM)
|
||||
if (widget->getAlign() & BOTTOM)
|
||||
textrc.y = rc.y + rc.h - textrc.h - 1;
|
||||
else if (widget->getAlign() & JI_MIDDLE)
|
||||
else if (widget->getAlign() & MIDDLE)
|
||||
textrc.y = rc.getCenter().y - textrc.h/2;
|
||||
else
|
||||
textrc.y = rc.y;
|
||||
|
@ -93,16 +93,16 @@ void IconRule::onPaint(ui::Graphics* g, const gfx::Rect& bounds, const char* tex
|
||||
she::Surface* bmp = m_part->getBitmap(0);
|
||||
int x, y;
|
||||
|
||||
if (m_align & JI_RIGHT)
|
||||
if (m_align & ui::RIGHT)
|
||||
x = bounds.x2() - bmp->width();
|
||||
else if (m_align & JI_CENTER)
|
||||
else if (m_align & ui::CENTER)
|
||||
x = bounds.x + bounds.w/2 - bmp->width()/2;
|
||||
else
|
||||
x = bounds.x;
|
||||
|
||||
if (m_align & JI_BOTTOM)
|
||||
if (m_align & ui::BOTTOM)
|
||||
y = bounds.y2() - bmp->height();
|
||||
else if (m_align & JI_MIDDLE)
|
||||
else if (m_align & ui::MIDDLE)
|
||||
y = bounds.y + bounds.h/2 - bmp->height()/2;
|
||||
else
|
||||
y = bounds.y;
|
||||
|
@ -160,8 +160,8 @@ StatusBar::StatusBar()
|
||||
|
||||
// Construct the commands box
|
||||
{
|
||||
Box* box1 = new Box(JI_HORIZONTAL);
|
||||
Box* box4 = new Box(JI_HORIZONTAL);
|
||||
Box* box1 = new Box(HORIZONTAL);
|
||||
Box* box4 = new Box(HORIZONTAL);
|
||||
|
||||
m_frameLabel = new Label("Frame:");
|
||||
m_currentFrame = new GotoFrameEntry();
|
||||
@ -192,8 +192,8 @@ StatusBar::StatusBar()
|
||||
// Tooltips manager
|
||||
TooltipManager* tooltipManager = new TooltipManager();
|
||||
addChild(tooltipManager);
|
||||
tooltipManager->addTooltipFor(m_currentFrame, "Current Frame", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_slider, "Cel Opacity", JI_BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_currentFrame, "Current Frame", BOTTOM);
|
||||
tooltipManager->addTooltipFor(m_slider, "Cel Opacity", BOTTOM);
|
||||
|
||||
Preferences::instance().toolBox.activeTool.AfterChange.connect(
|
||||
Bind<void>(&StatusBar::onCurrentToolChange, this));
|
||||
|
@ -552,7 +552,7 @@ void ToolBar::openTipWindow(int group_index, Tool* tool)
|
||||
Point arrow = tool ? getToolPositionInGroup(group_index, tool): Point(0, 0);
|
||||
|
||||
m_tipWindow = new TipWindow(tooltip.c_str(), gfx::Rect(arrow, toolrc.getSize()));
|
||||
m_tipWindow->setArrowAlign(JI_TOP | JI_RIGHT);
|
||||
m_tipWindow->setArrowAlign(TOP | RIGHT);
|
||||
m_tipWindow->remapWindow();
|
||||
|
||||
int w = m_tipWindow->getBounds().w;
|
||||
|
@ -207,10 +207,10 @@ void WorkspacePanel::onAnimationStop(int animation)
|
||||
void WorkspacePanel::onAnimationFrame()
|
||||
{
|
||||
if (animation() == ANI_DROPAREA) {
|
||||
adjustTime(m_leftTime, JI_LEFT);
|
||||
adjustTime(m_topTime, JI_TOP);
|
||||
adjustTime(m_rightTime, JI_RIGHT);
|
||||
adjustTime(m_bottomTime, JI_BOTTOM);
|
||||
adjustTime(m_leftTime, LEFT);
|
||||
adjustTime(m_topTime, TOP);
|
||||
adjustTime(m_rightTime, RIGHT);
|
||||
adjustTime(m_bottomTime, BOTTOM);
|
||||
layout();
|
||||
}
|
||||
}
|
||||
@ -238,8 +238,8 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
|
||||
return DropViewAtResult::NOTHING;
|
||||
|
||||
int splitterAlign = 0;
|
||||
if (dropArea & (JI_LEFT | JI_RIGHT)) splitterAlign = JI_HORIZONTAL;
|
||||
else if (dropArea & (JI_TOP | JI_BOTTOM)) splitterAlign = JI_VERTICAL;
|
||||
if (dropArea & (LEFT | RIGHT)) splitterAlign = HORIZONTAL;
|
||||
else if (dropArea & (TOP | BOTTOM)) splitterAlign = VERTICAL;
|
||||
|
||||
ASSERT(from);
|
||||
DropViewAtResult result;
|
||||
@ -290,14 +290,14 @@ DropViewAtResult WorkspacePanel::dropViewAt(const gfx::Point& pos, WorkspacePane
|
||||
sideSpace = 50;
|
||||
|
||||
switch (dropArea) {
|
||||
case JI_LEFT:
|
||||
case JI_TOP:
|
||||
case LEFT:
|
||||
case TOP:
|
||||
splitter->setPosition(sideSpace);
|
||||
splitter->addChild(side);
|
||||
splitter->addChild(self);
|
||||
break;
|
||||
case JI_RIGHT:
|
||||
case JI_BOTTOM:
|
||||
case RIGHT:
|
||||
case BOTTOM:
|
||||
splitter->setPosition(100-sideSpace);
|
||||
splitter->addChild(self);
|
||||
splitter->addChild(side);
|
||||
@ -324,16 +324,16 @@ int WorkspacePanel::calculateDropArea(const gfx::Point& pos) const
|
||||
int threshold = getDropThreshold();
|
||||
|
||||
if (left < threshold && left < right && left < top && left < bottom) {
|
||||
return JI_LEFT;
|
||||
return LEFT;
|
||||
}
|
||||
else if (top < threshold && top < left && top < right && top < bottom) {
|
||||
return JI_TOP;
|
||||
return TOP;
|
||||
}
|
||||
else if (right < threshold && right < left && right < top && right < bottom) {
|
||||
return JI_RIGHT;
|
||||
return RIGHT;
|
||||
}
|
||||
else if (bottom < threshold && bottom < left && bottom < top && bottom < right) {
|
||||
return JI_BOTTOM;
|
||||
return BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
else if (elem_name == "box") {
|
||||
bool horizontal = bool_attr_is_true(elem, "horizontal");
|
||||
bool vertical = bool_attr_is_true(elem, "vertical");
|
||||
int align = (horizontal ? JI_HORIZONTAL: vertical ? JI_VERTICAL: 0);
|
||||
int align = (horizontal ? HORIZONTAL: vertical ? VERTICAL: 0);
|
||||
|
||||
if (!widget)
|
||||
widget = new Box(align);
|
||||
@ -160,8 +160,8 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool closewindow = bool_attr_is_true(elem, "closewindow");
|
||||
const char *_bevel = elem->Attribute("bevel");
|
||||
|
||||
widget->setAlign((left ? JI_LEFT: (right ? JI_RIGHT: JI_CENTER)) |
|
||||
(top ? JI_TOP: (bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
widget->setAlign((left ? LEFT: (right ? RIGHT: CENTER)) |
|
||||
(top ? TOP: (bottom ? BOTTOM: MIDDLE)));
|
||||
|
||||
if (_bevel != NULL) {
|
||||
char* bevel = base_strdup(_bevel);
|
||||
@ -204,10 +204,10 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool top = bool_attr_is_true(elem, "top");
|
||||
bool bottom = bool_attr_is_true(elem, "bottom");
|
||||
|
||||
widget->setAlign((center ? JI_CENTER:
|
||||
(right ? JI_RIGHT: JI_LEFT)) |
|
||||
(top ? JI_TOP:
|
||||
(bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
widget->setAlign((center ? CENTER:
|
||||
(right ? RIGHT: LEFT)) |
|
||||
(top ? TOP:
|
||||
(bottom ? BOTTOM: MIDDLE)));
|
||||
}
|
||||
else if (elem_name == "combobox") {
|
||||
if (!widget)
|
||||
@ -253,10 +253,10 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool top = bool_attr_is_true(elem, "top");
|
||||
bool bottom = bool_attr_is_true(elem, "bottom");
|
||||
|
||||
widget->setAlign((center ? JI_CENTER:
|
||||
(right ? JI_RIGHT: JI_LEFT)) |
|
||||
(top ? JI_TOP:
|
||||
(bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
widget->setAlign((center ? CENTER:
|
||||
(right ? RIGHT: LEFT)) |
|
||||
(top ? TOP:
|
||||
(bottom ? BOTTOM: MIDDLE)));
|
||||
}
|
||||
else if (elem_name == "link") {
|
||||
const char* url = elem->Attribute("url");
|
||||
@ -276,8 +276,8 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool bottom = bool_attr_is_true(elem, "bottom");
|
||||
|
||||
widget->setAlign(
|
||||
(center ? JI_CENTER: (right ? JI_RIGHT: JI_LEFT)) |
|
||||
(top ? JI_TOP: (bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
(center ? CENTER: (right ? RIGHT: LEFT)) |
|
||||
(top ? TOP: (bottom ? BOTTOM: MIDDLE)));
|
||||
}
|
||||
else if (elem_name == "listbox") {
|
||||
if (!widget)
|
||||
@ -308,8 +308,8 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
Splitter::ByPercentage);
|
||||
|
||||
Splitter* splitter = new Splitter(type,
|
||||
horizontal ? JI_HORIZONTAL:
|
||||
vertical ? JI_VERTICAL: 0);
|
||||
horizontal ? HORIZONTAL:
|
||||
vertical ? VERTICAL: 0);
|
||||
if (position) {
|
||||
splitter->setPosition(strtod(position, NULL)
|
||||
* (type == Splitter::ByPixel ? guiscale(): 1));
|
||||
@ -343,10 +343,10 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool bottom = bool_attr_is_true(elem, "bottom");
|
||||
|
||||
widget->setAlign(
|
||||
(center ? JI_CENTER:
|
||||
(right ? JI_RIGHT: JI_LEFT)) |
|
||||
(top ? JI_TOP:
|
||||
(bottom ? JI_BOTTOM: JI_MIDDLE)));
|
||||
(center ? CENTER:
|
||||
(right ? RIGHT: LEFT)) |
|
||||
(top ? TOP:
|
||||
(bottom ? BOTTOM: MIDDLE)));
|
||||
}
|
||||
else if (elem_name == "separator") {
|
||||
bool center = bool_attr_is_true(elem, "center");
|
||||
@ -356,10 +356,10 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
bool horizontal = bool_attr_is_true(elem, "horizontal");
|
||||
bool vertical = bool_attr_is_true(elem, "vertical");
|
||||
int align =
|
||||
(horizontal ? JI_HORIZONTAL: 0) |
|
||||
(vertical ? JI_VERTICAL: 0) |
|
||||
(center ? JI_CENTER: (right ? JI_RIGHT: JI_LEFT)) |
|
||||
(middle ? JI_MIDDLE: (bottom ? JI_BOTTOM: JI_TOP));
|
||||
(horizontal ? HORIZONTAL: 0) |
|
||||
(vertical ? VERTICAL: 0) |
|
||||
(center ? CENTER: (right ? RIGHT: LEFT)) |
|
||||
(middle ? MIDDLE: (bottom ? BOTTOM: TOP));
|
||||
|
||||
if (!widget) {
|
||||
const char* text = elem->Attribute("text");
|
||||
@ -385,7 +385,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
widget->setText(elem->GetText());
|
||||
|
||||
if (wordwrap)
|
||||
widget->setAlign(widget->getAlign() | JI_WORDWRAP);
|
||||
widget->setAlign(widget->getAlign() | WORDWRAP);
|
||||
}
|
||||
else if (elem_name == "view") {
|
||||
if (!widget)
|
||||
@ -508,7 +508,7 @@ void WidgetLoader::fillWidgetWithXmlElementAttributes(const TiXmlElement* elem,
|
||||
m_tooltipManager = new ui::TooltipManager();
|
||||
root->addChild(m_tooltipManager);
|
||||
}
|
||||
m_tooltipManager->addTooltipFor(widget, tooltip, JI_LEFT);
|
||||
m_tooltipManager->addTooltipFor(widget, tooltip, LEFT);
|
||||
}
|
||||
|
||||
if (selected)
|
||||
@ -521,7 +521,7 @@ void WidgetLoader::fillWidgetWithXmlElementAttributes(const TiXmlElement* elem,
|
||||
widget->setExpansive(true);
|
||||
|
||||
if (homogeneous)
|
||||
widget->setAlign(widget->getAlign() | JI_HOMOGENEOUS);
|
||||
widget->setAlign(widget->getAlign() | HOMOGENEOUS);
|
||||
|
||||
if (magnet)
|
||||
widget->setFocusMagnet(true);
|
||||
@ -614,31 +614,31 @@ static int convert_align_value_to_flags(const char *value)
|
||||
tok != NULL;
|
||||
tok=strtok(NULL, " ")) {
|
||||
if (strcmp(tok, "horizontal") == 0) {
|
||||
flags |= JI_HORIZONTAL;
|
||||
flags |= HORIZONTAL;
|
||||
}
|
||||
else if (strcmp(tok, "vertical") == 0) {
|
||||
flags |= JI_VERTICAL;
|
||||
flags |= VERTICAL;
|
||||
}
|
||||
else if (strcmp(tok, "left") == 0) {
|
||||
flags |= JI_LEFT;
|
||||
flags |= LEFT;
|
||||
}
|
||||
else if (strcmp(tok, "center") == 0) {
|
||||
flags |= JI_CENTER;
|
||||
flags |= CENTER;
|
||||
}
|
||||
else if (strcmp(tok, "right") == 0) {
|
||||
flags |= JI_RIGHT;
|
||||
flags |= RIGHT;
|
||||
}
|
||||
else if (strcmp(tok, "top") == 0) {
|
||||
flags |= JI_TOP;
|
||||
flags |= TOP;
|
||||
}
|
||||
else if (strcmp(tok, "middle") == 0) {
|
||||
flags |= JI_MIDDLE;
|
||||
flags |= MIDDLE;
|
||||
}
|
||||
else if (strcmp(tok, "bottom") == 0) {
|
||||
flags |= JI_BOTTOM;
|
||||
flags |= BOTTOM;
|
||||
}
|
||||
else if (strcmp(tok, "homogeneous") == 0) {
|
||||
flags |= JI_HOMOGENEOUS;
|
||||
flags |= HOMOGENEOUS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
labels.push_back(label);
|
||||
}
|
||||
else if (separator) {
|
||||
labels.push_back(new Separator("", JI_HORIZONTAL));
|
||||
labels.push_back(new Separator("", HORIZONTAL));
|
||||
}
|
||||
else if (button) {
|
||||
char buttonId[256];
|
||||
@ -188,9 +188,9 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
align = 0;
|
||||
|
||||
switch (buf[c]) {
|
||||
case '<': label=true; align=JI_LEFT; break;
|
||||
case '=': label=true; align=JI_CENTER; break;
|
||||
case '>': label=true; align=JI_RIGHT; break;
|
||||
case '<': label=true; align=LEFT; break;
|
||||
case '=': label=true; align=CENTER; break;
|
||||
case '>': label=true; align=RIGHT; break;
|
||||
case '-': separator=true; break;
|
||||
case '|': button=true; break;
|
||||
}
|
||||
@ -199,10 +199,10 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
}
|
||||
}
|
||||
|
||||
box1 = new Box(JI_VERTICAL);
|
||||
box2 = new Box(JI_VERTICAL);
|
||||
box1 = new Box(VERTICAL);
|
||||
box2 = new Box(VERTICAL);
|
||||
grid = new Grid(1, false);
|
||||
box3 = new Box(JI_HORIZONTAL | JI_HOMOGENEOUS);
|
||||
box3 = new Box(HORIZONTAL | HOMOGENEOUS);
|
||||
|
||||
// To identify by the user
|
||||
box2->setId("labels");
|
||||
@ -229,7 +229,7 @@ void Alert::processString(char* buf, std::vector<Widget*>& labels, std::vector<W
|
||||
box1->addChild(box5); // Filler
|
||||
box1->addChild(grid); // Buttons
|
||||
|
||||
grid->addChildInCell(box3, 1, 1, JI_CENTER | JI_BOTTOM);
|
||||
grid->addChildInCell(box3, 1, 1, CENTER | BOTTOM);
|
||||
|
||||
for (std::vector<Widget*>::iterator it = labels.begin(); it != labels.end(); ++it)
|
||||
box2->addChild(*it);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -32,32 +32,36 @@
|
||||
|
||||
namespace ui {
|
||||
|
||||
// Alignment.
|
||||
#define JI_HORIZONTAL 0x0001
|
||||
#define JI_VERTICAL 0x0002
|
||||
#define JI_LEFT 0x0004
|
||||
#define JI_CENTER 0x0008
|
||||
#define JI_RIGHT 0x0010
|
||||
#define JI_TOP 0x0020
|
||||
#define JI_MIDDLE 0x0040
|
||||
#define JI_BOTTOM 0x0080
|
||||
#define JI_HOMOGENEOUS 0x0100
|
||||
#define JI_WORDWRAP 0x0200
|
||||
// Alignment flags
|
||||
enum {
|
||||
HORIZONTAL = 0x0001,
|
||||
VERTICAL = 0x0002,
|
||||
LEFT = 0x0004,
|
||||
CENTER = 0x0008,
|
||||
RIGHT = 0x0010,
|
||||
TOP = 0x0020,
|
||||
MIDDLE = 0x0040,
|
||||
BOTTOM = 0x0080,
|
||||
HOMOGENEOUS = 0x0100,
|
||||
WORDWRAP = 0x0200,
|
||||
};
|
||||
|
||||
// Widget flags.
|
||||
#define JI_HIDDEN 0x0001 // Is hidden (not visible, not clickeable).
|
||||
#define JI_SELECTED 0x0002 // Is selected.
|
||||
#define JI_DISABLED 0x0004 // Is disabled (not usable).
|
||||
#define JI_HASFOCUS 0x0008 // Has the input focus.
|
||||
#define JI_HASMOUSE 0x0010 // Has the mouse.
|
||||
#define JI_HASCAPTURE 0x0020 // Captured the mouse .
|
||||
#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.
|
||||
#define JI_DIRTY 0x0800 // The widget (or one child) is dirty (update_region != empty).
|
||||
#define JI_HASTEXT 0x1000 // The widget has text (at least setText() was called one time).
|
||||
// Widget flags
|
||||
enum {
|
||||
HIDDEN = 0x0001, // Is hidden (not visible, not clickeable).
|
||||
SELECTED = 0x0002, // Is selected.
|
||||
DISABLED = 0x0004, // Is disabled (not usable).
|
||||
HAS_FOCUS = 0x0008, // Has the input focus.
|
||||
HAS_MOUSE = 0x0010, // Has the mouse.
|
||||
HAS_CAPTURE = 0x0020, // Captured the mouse .
|
||||
FOCUS_STOP = 0x0040, // The widget support the focus on it.
|
||||
FOCUS_MAGNET = 0x0080, // The widget wants the focus by default (e.g. when the dialog is shown by first time).
|
||||
EXPANSIVE = 0x0100, // Is expansive (want more space).
|
||||
DECORATIVE = 0x0200, // To decorate windows.
|
||||
INITIALIZED = 0x0400, // The widget was already initialized by a theme.
|
||||
DIRTY = 0x0800, // The widget (or one child) is dirty (update_region != empty).
|
||||
HAS_TEXT = 0x1000, // The widget has text (at least setText() was called one time).
|
||||
};
|
||||
|
||||
class GuiSystem {
|
||||
public:
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -32,7 +32,7 @@ void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||
{
|
||||
#define GET_CHILD_SIZE(w, h) \
|
||||
{ \
|
||||
if (getAlign() & JI_HOMOGENEOUS) \
|
||||
if (getAlign() & HOMOGENEOUS) \
|
||||
w = MAX(w, reqSize.w); \
|
||||
else \
|
||||
w += reqSize.w; \
|
||||
@ -42,7 +42,7 @@ void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||
|
||||
#define FINAL_SIZE(w) \
|
||||
{ \
|
||||
if (getAlign() & JI_HOMOGENEOUS) \
|
||||
if (getAlign() & HOMOGENEOUS) \
|
||||
w *= nvis_children; \
|
||||
\
|
||||
w += child_spacing * (nvis_children-1); \
|
||||
@ -53,7 +53,7 @@ void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||
nvis_children = 0;
|
||||
UI_FOREACH_WIDGET(getChildren(), it) {
|
||||
Widget* child = *it;
|
||||
if (!(child->flags & JI_HIDDEN))
|
||||
if (!(child->flags & HIDDEN))
|
||||
nvis_children++;
|
||||
}
|
||||
|
||||
@ -62,12 +62,12 @@ void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||
UI_FOREACH_WIDGET(getChildren(), it) {
|
||||
Widget* child = *it;
|
||||
|
||||
if (child->flags & JI_HIDDEN)
|
||||
if (child->flags & HIDDEN)
|
||||
continue;
|
||||
|
||||
Size reqSize = child->getPreferredSize();
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
GET_CHILD_SIZE(w, h);
|
||||
}
|
||||
else {
|
||||
@ -76,7 +76,7 @@ void Box::onPreferredSize(PreferredSizeEvent& ev)
|
||||
}
|
||||
|
||||
if (nvis_children > 0) {
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
FINAL_SIZE(w);
|
||||
}
|
||||
else {
|
||||
@ -95,7 +95,7 @@ void Box::onResize(ResizeEvent& ev)
|
||||
#define FIXUP(x, y, w, h, l, t, r, b) \
|
||||
{ \
|
||||
if (nvis_children > 0) { \
|
||||
if (getAlign() & JI_HOMOGENEOUS) { \
|
||||
if (getAlign() & HOMOGENEOUS) { \
|
||||
width = (getBounds().w \
|
||||
- this->border_width.l \
|
||||
- this->border_width.r \
|
||||
@ -120,8 +120,8 @@ void Box::onResize(ResizeEvent& ev)
|
||||
UI_FOREACH_WIDGET(getChildren(), it) { \
|
||||
child = *it; \
|
||||
\
|
||||
if (!(child->flags & JI_HIDDEN)) { \
|
||||
if (this->getAlign() & JI_HOMOGENEOUS) { \
|
||||
if (!(child->flags & HIDDEN)) { \
|
||||
if (this->getAlign() & HOMOGENEOUS) { \
|
||||
if (nvis_children == 1) \
|
||||
child_width = width; \
|
||||
else \
|
||||
@ -149,7 +149,7 @@ void Box::onResize(ResizeEvent& ev)
|
||||
w = MAX(1, child_width); \
|
||||
\
|
||||
gfx::Rect cpos; \
|
||||
if (getAlign() & JI_HORIZONTAL) \
|
||||
if (getAlign() & HORIZONTAL) \
|
||||
cpos = gfx::Rect(x, y, w, h); \
|
||||
else \
|
||||
cpos = gfx::Rect(y, x, h, w); \
|
||||
@ -169,13 +169,13 @@ void Box::onResize(ResizeEvent& ev)
|
||||
int width;
|
||||
int extra;
|
||||
int x, y, w, h;
|
||||
|
||||
|
||||
setBoundsQuietly(ev.getBounds());
|
||||
|
||||
UI_FOREACH_WIDGET(getChildren(), it) {
|
||||
child = *it;
|
||||
|
||||
if (!(child->flags & JI_HIDDEN)) {
|
||||
if (!(child->flags & HIDDEN)) {
|
||||
nvis_children++;
|
||||
if (child->isExpansive())
|
||||
nexpand_children++;
|
||||
@ -184,7 +184,7 @@ void Box::onResize(ResizeEvent& ev)
|
||||
|
||||
Size reqSize = getPreferredSize();
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
FIXUP(x, y, w, h, l, t, r, b);
|
||||
}
|
||||
else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -27,19 +27,19 @@ namespace ui {
|
||||
class VBox : public Box
|
||||
{
|
||||
public:
|
||||
VBox() : Box(JI_VERTICAL) { }
|
||||
VBox() : Box(VERTICAL) { }
|
||||
};
|
||||
|
||||
class HBox : public Box
|
||||
{
|
||||
public:
|
||||
HBox() : Box(JI_HORIZONTAL) { }
|
||||
HBox() : Box(HORIZONTAL) { }
|
||||
};
|
||||
|
||||
class BoxFiller : public Box
|
||||
{
|
||||
public:
|
||||
BoxFiller() : Box(JI_HORIZONTAL) {
|
||||
BoxFiller() : Box(HORIZONTAL) {
|
||||
this->setExpansive(true);
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -32,7 +32,7 @@ ButtonBase::ButtonBase(const std::string& text,
|
||||
, m_iconInterface(NULL)
|
||||
, m_handleSelect(true)
|
||||
{
|
||||
setAlign(JI_CENTER | JI_MIDDLE);
|
||||
setAlign(CENTER | MIDDLE);
|
||||
setText(text);
|
||||
setFocusStop(true);
|
||||
|
||||
@ -309,7 +309,7 @@ void ButtonBase::generateButtonSelectSignal()
|
||||
Button::Button(const std::string& text)
|
||||
: ButtonBase(text, kButtonWidget, kButtonWidget, kButtonWidget)
|
||||
{
|
||||
setAlign(JI_CENTER | JI_MIDDLE);
|
||||
setAlign(CENTER | MIDDLE);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
@ -319,7 +319,7 @@ Button::Button(const std::string& text)
|
||||
CheckBox::CheckBox(const std::string& text, WidgetType drawType)
|
||||
: ButtonBase(text, kCheckWidget, kCheckWidget, drawType)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
setAlign(LEFT | MIDDLE);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
@ -329,7 +329,7 @@ CheckBox::CheckBox(const std::string& text, WidgetType drawType)
|
||||
RadioButton::RadioButton(const std::string& text, int radioGroup, WidgetType drawType)
|
||||
: ButtonBase(text, kRadioWidget, kRadioWidget, drawType)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
setAlign(LEFT | MIDDLE);
|
||||
setRadioGroup(radioGroup);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ Entry::Entry(std::size_t maxsize, const char *format, ...)
|
||||
}
|
||||
|
||||
// TODO support for text alignment and multi-line
|
||||
// widget->align = JI_LEFT | JI_MIDDLE;
|
||||
// widget->align = LEFT | MIDDLE;
|
||||
setText(buf);
|
||||
|
||||
setFocusStop(true);
|
||||
|
@ -258,11 +258,11 @@ gfx::Size Graphics::doUIStringAlgorithm(const std::string& str, gfx::Color fg, g
|
||||
{
|
||||
gfx::Point pt(0, rc.y);
|
||||
|
||||
if ((align & (JI_MIDDLE | JI_BOTTOM)) != 0) {
|
||||
if ((align & (MIDDLE | BOTTOM)) != 0) {
|
||||
gfx::Size preSize = doUIStringAlgorithm(str, gfx::ColorNone, gfx::ColorNone, rc, 0, false);
|
||||
if (align & JI_MIDDLE)
|
||||
if (align & MIDDLE)
|
||||
pt.y = rc.y + rc.h/2 - preSize.h/2;
|
||||
else if (align & JI_BOTTOM)
|
||||
else if (align & BOTTOM)
|
||||
pt.y = rc.y + rc.h - preSize.h;
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ gfx::Size Graphics::doUIStringAlgorithm(const std::string& str, gfx::Color fg, g
|
||||
pt.x = rc.x;
|
||||
|
||||
// Without word-wrap
|
||||
if ((align & JI_WORDWRAP) == 0) {
|
||||
if ((align & WORDWRAP) == 0) {
|
||||
end = str.find('\n', beg);
|
||||
}
|
||||
// With word-wrap
|
||||
@ -322,9 +322,9 @@ gfx::Size Graphics::doUIStringAlgorithm(const std::string& str, gfx::Color fg, g
|
||||
// Render the text
|
||||
if (draw) {
|
||||
int xout;
|
||||
if ((align & JI_CENTER) == JI_CENTER)
|
||||
if ((align & CENTER) == CENTER)
|
||||
xout = pt.x + rc.w/2 - lineSize.w/2;
|
||||
else if ((align & JI_RIGHT) == JI_RIGHT)
|
||||
else if ((align & RIGHT) == RIGHT)
|
||||
xout = pt.x + rc.w - lineSize.w;
|
||||
else
|
||||
xout = pt.x;
|
||||
|
@ -70,17 +70,17 @@ Grid::~Grid()
|
||||
* @param align
|
||||
* It's a combination of the following values:
|
||||
*
|
||||
* - JI_HORIZONTAL: The widget'll get excess horizontal space.
|
||||
* - JI_VERTICAL: The widget'll get excess vertical space.
|
||||
* - HORIZONTAL: The widget'll get excess horizontal space.
|
||||
* - VERTICAL: The widget'll get excess vertical space.
|
||||
*
|
||||
* - JI_LEFT: Sets horizontal alignment to the beginning of cell.
|
||||
* - JI_CENTER: Sets horizontal alignment to the center of cell.
|
||||
* - JI_RIGHT: Sets horizontal alignment to the end of cell.
|
||||
* - LEFT: Sets horizontal alignment to the beginning of cell.
|
||||
* - CENTER: Sets horizontal alignment to the center of cell.
|
||||
* - RIGHT: Sets horizontal alignment to the end of cell.
|
||||
* - None: Uses the whole horizontal space of the cell.
|
||||
*
|
||||
* - JI_TOP: Sets vertical alignment to the beginning of the cell.
|
||||
* - JI_MIDDLE: Sets vertical alignment to the center of the cell.
|
||||
* - JI_BOTTOM: Sets vertical alignment to the end of the cell.
|
||||
* - TOP: Sets vertical alignment to the beginning of the cell.
|
||||
* - MIDDLE: Sets vertical alignment to the center of the cell.
|
||||
* - BOTTOM: Sets vertical alignment to the end of the cell.
|
||||
* - None: Uses the whole vertical space of the cell.
|
||||
*/
|
||||
void Grid::addChildInCell(Widget* child, int hspan, int vspan, int align)
|
||||
@ -139,7 +139,7 @@ void Grid::onResize(ResizeEvent& ev)
|
||||
|
||||
if (cell->child != NULL &&
|
||||
cell->parent == NULL &&
|
||||
!(cell->child->flags & JI_HIDDEN)) {
|
||||
!(cell->child->flags & HIDDEN)) {
|
||||
x = pos_x;
|
||||
y = pos_y;
|
||||
|
||||
@ -148,26 +148,26 @@ void Grid::onResize(ResizeEvent& ev)
|
||||
|
||||
reqSize = cell->child->getPreferredSize();
|
||||
|
||||
if (cell->align & JI_LEFT) {
|
||||
if (cell->align & LEFT) {
|
||||
w = reqSize.w;
|
||||
}
|
||||
else if (cell->align & JI_CENTER) {
|
||||
else if (cell->align & CENTER) {
|
||||
x += w/2 - reqSize.w/2;
|
||||
w = reqSize.w;
|
||||
}
|
||||
else if (cell->align & JI_RIGHT) {
|
||||
else if (cell->align & RIGHT) {
|
||||
x += w - reqSize.w;
|
||||
w = reqSize.w;
|
||||
}
|
||||
|
||||
if (cell->align & JI_TOP) {
|
||||
if (cell->align & TOP) {
|
||||
h = reqSize.h;
|
||||
}
|
||||
else if (cell->align & JI_MIDDLE) {
|
||||
else if (cell->align & MIDDLE) {
|
||||
y += h/2 - reqSize.h/2;
|
||||
h = reqSize.h;
|
||||
}
|
||||
else if (cell->align & JI_BOTTOM) {
|
||||
else if (cell->align & BOTTOM) {
|
||||
y += h - reqSize.h;
|
||||
h = reqSize.h;
|
||||
}
|
||||
@ -247,8 +247,8 @@ void Grid::calculateSize()
|
||||
if (m_rowstrip.size() == 0)
|
||||
return;
|
||||
|
||||
calculateStripSize(m_colstrip, m_rowstrip, JI_HORIZONTAL);
|
||||
calculateStripSize(m_rowstrip, m_colstrip, JI_VERTICAL);
|
||||
calculateStripSize(m_colstrip, m_rowstrip, HORIZONTAL);
|
||||
calculateStripSize(m_rowstrip, m_colstrip, VERTICAL);
|
||||
|
||||
expandStrip(m_colstrip, m_rowstrip, &Grid::incColSize);
|
||||
expandStrip(m_rowstrip, m_colstrip, &Grid::incRowSize);
|
||||
@ -285,7 +285,7 @@ void Grid::calculateStripSize(std::vector<Strip>& colstrip,
|
||||
if (cell->child != NULL) {
|
||||
if (cell->parent == NULL) {
|
||||
// If the widget isn't hidden then we can request its size
|
||||
if (!(cell->child->flags & JI_HIDDEN)) {
|
||||
if (!(cell->child->flags & HIDDEN)) {
|
||||
Size reqSize = cell->child->getPreferredSize();
|
||||
cell->w = reqSize.w - (cell->hspan-1) * this->child_spacing;
|
||||
cell->h = reqSize.h - (cell->vspan-1) * this->child_spacing;
|
||||
@ -297,7 +297,7 @@ void Grid::calculateStripSize(std::vector<Strip>& colstrip,
|
||||
cell->w = cell->h = 0;
|
||||
}
|
||||
else {
|
||||
if (!(cell->child->flags & JI_HIDDEN)) {
|
||||
if (!(cell->child->flags & HIDDEN)) {
|
||||
if ((cell->parent->align & align) == align)
|
||||
++expand_count;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ TEST(Grid, Expand2ndWidget)
|
||||
w2->setMinSize(gfx::Size(10, 10));
|
||||
|
||||
grid->addChildInCell(w1, 1, 1, 0);
|
||||
grid->addChildInCell(w2, 1, 1, JI_HORIZONTAL | JI_TOP);
|
||||
grid->addChildInCell(w2, 1, 1, HORIZONTAL | TOP);
|
||||
|
||||
// Test request size
|
||||
Size reqSize = grid->getPreferredSize();
|
||||
@ -128,9 +128,9 @@ TEST(Grid, SameWidth2x1Grid)
|
||||
// +-------+---+
|
||||
//
|
||||
// 1.align = 0
|
||||
// 2.align = JI_HORIZONTAL
|
||||
// 3.align = JI_HORIZONTAL | JI_VERTICAL
|
||||
// 4.align = JI_VERTICAL
|
||||
// 2.align = HORIZONTAL
|
||||
// 3.align = HORIZONTAL | VERTICAL
|
||||
// 4.align = VERTICAL
|
||||
//
|
||||
//
|
||||
// When we expand the grid we get the following layout:
|
||||
@ -161,9 +161,9 @@ TEST(Grid, Intrincate3x3Grid)
|
||||
w4->setMinSize(gfx::Size(10, 10));
|
||||
|
||||
grid->addChildInCell(w1, 1, 1, 0);
|
||||
grid->addChildInCell(w2, 2, 1, JI_HORIZONTAL);
|
||||
grid->addChildInCell(w3, 2, 2, JI_HORIZONTAL | JI_VERTICAL);
|
||||
grid->addChildInCell(w4, 1, 2, JI_VERTICAL);
|
||||
grid->addChildInCell(w2, 2, 1, HORIZONTAL);
|
||||
grid->addChildInCell(w3, 2, 2, HORIZONTAL | VERTICAL);
|
||||
grid->addChildInCell(w4, 1, 2, VERTICAL);
|
||||
|
||||
// Test request size
|
||||
grid->child_spacing = 2;
|
||||
|
@ -19,7 +19,7 @@ namespace ui {
|
||||
Label::Label(const std::string& text)
|
||||
: Widget(kLabelWidget)
|
||||
{
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
setAlign(LEFT | MIDDLE);
|
||||
setText(text);
|
||||
initTheme();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -24,7 +24,7 @@ ListItem::ListItem(const std::string& text)
|
||||
: Widget(kListItemWidget)
|
||||
{
|
||||
setDoubleBuffered(true);
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
setAlign(LEFT | MIDDLE);
|
||||
setText(text);
|
||||
initTheme();
|
||||
}
|
||||
|
@ -39,11 +39,11 @@
|
||||
namespace ui {
|
||||
|
||||
#define ACCEPT_FOCUS(widget) \
|
||||
((((widget)->flags & (JI_FOCUSSTOP | \
|
||||
JI_DISABLED | \
|
||||
JI_HIDDEN | \
|
||||
JI_DECORATIVE)) == JI_FOCUSSTOP) && \
|
||||
((widget)->isVisible()))
|
||||
((((widget)->flags & (FOCUS_STOP | \
|
||||
DISABLED | \
|
||||
HIDDEN | \
|
||||
DECORATIVE)) == FOCUS_STOP) && \
|
||||
((widget)->isVisible()))
|
||||
|
||||
static const int NFILTERS = (int)(kFirstRegisteredMessage+1);
|
||||
|
||||
@ -540,9 +540,9 @@ void Manager::setFocus(Widget* widget)
|
||||
{
|
||||
if ((focus_widget != widget)
|
||||
&& (!(widget)
|
||||
|| (!(widget->flags & JI_DISABLED)
|
||||
&& !(widget->flags & JI_HIDDEN)
|
||||
&& !(widget->flags & JI_DECORATIVE)
|
||||
|| (!(widget->flags & DISABLED)
|
||||
&& !(widget->flags & HIDDEN)
|
||||
&& !(widget->flags & DECORATIVE)
|
||||
&& someParentIsFocusStop(widget)))) {
|
||||
WidgetsList widget_parents;
|
||||
Widget* common_parent = NULL;
|
||||
@ -570,7 +570,7 @@ void Manager::setFocus(Widget* widget)
|
||||
}
|
||||
|
||||
if ((*it)->hasFocus()) {
|
||||
(*it)->flags &= ~JI_HASFOCUS;
|
||||
(*it)->flags &= ~HAS_FOCUS;
|
||||
msg->addRecipient(*it);
|
||||
}
|
||||
}
|
||||
@ -598,8 +598,8 @@ void Manager::setFocus(Widget* widget)
|
||||
for (; it != widget_parents.end(); ++it) {
|
||||
Widget* w = *it;
|
||||
|
||||
if (w->flags & JI_FOCUSSTOP) {
|
||||
w->flags |= JI_HASFOCUS;
|
||||
if (w->flags & FOCUS_STOP) {
|
||||
w->flags |= HAS_FOCUS;
|
||||
|
||||
msg->addRecipient(w);
|
||||
}
|
||||
@ -652,7 +652,7 @@ void Manager::setMouse(Widget* widget)
|
||||
}
|
||||
|
||||
if ((*it)->hasMouse()) {
|
||||
(*it)->flags &= ~JI_HASMOUSE;
|
||||
(*it)->flags &= ~HAS_MOUSE;
|
||||
msg->addRecipient(*it);
|
||||
}
|
||||
}
|
||||
@ -679,7 +679,7 @@ void Manager::setMouse(Widget* widget)
|
||||
get_mouse_position(), _internal_get_mouse_buttons());
|
||||
|
||||
for (; it != widget_parents.end(); ++it) {
|
||||
(*it)->flags |= JI_HASMOUSE;
|
||||
(*it)->flags |= HAS_MOUSE;
|
||||
msg->addRecipient(*it);
|
||||
}
|
||||
|
||||
@ -691,7 +691,7 @@ void Manager::setMouse(Widget* widget)
|
||||
|
||||
void Manager::setCapture(Widget* widget)
|
||||
{
|
||||
widget->flags |= JI_HASCAPTURE;
|
||||
widget->flags |= HAS_CAPTURE;
|
||||
capture_widget = widget;
|
||||
|
||||
m_display->captureMouse();
|
||||
@ -731,7 +731,7 @@ void Manager::freeMouse()
|
||||
void Manager::freeCapture()
|
||||
{
|
||||
if (capture_widget) {
|
||||
capture_widget->flags &= ~JI_HASCAPTURE;
|
||||
capture_widget->flags &= ~HAS_CAPTURE;
|
||||
capture_widget = NULL;
|
||||
|
||||
m_display->releaseMouse();
|
||||
@ -1124,7 +1124,7 @@ void Manager::pumpQueue()
|
||||
// We need to configure the clip region for paint messages
|
||||
// before we call Widget::sendMessage().
|
||||
if (msg->type() == kPaintMessage) {
|
||||
if (widget->flags & JI_HIDDEN)
|
||||
if (widget->flags & HIDDEN)
|
||||
continue;
|
||||
|
||||
PaintMessage* paintMsg = static_cast<PaintMessage*>(msg);
|
||||
|
@ -409,7 +409,7 @@ bool MenuBox::onProcessMessage(Message* msg)
|
||||
Widget* picked = menu->pick(mousePos);
|
||||
if (picked) {
|
||||
if ((picked->type == kMenuItemWidget) &&
|
||||
!(picked->flags & JI_DISABLED)) {
|
||||
!(picked->flags & DISABLED)) {
|
||||
MenuItem* pickedItem = static_cast<MenuItem*>(picked);
|
||||
|
||||
// If the picked menu-item is not highlighted...
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -27,7 +27,7 @@ PopupWindow::PopupWindow(const std::string& text, ClickBehavior clickBehavior)
|
||||
setSizeable(false);
|
||||
setMoveable(false);
|
||||
setWantFocus(false);
|
||||
setAlign(JI_LEFT | JI_TOP);
|
||||
setAlign(LEFT | TOP);
|
||||
|
||||
removeDecorativeWidgets();
|
||||
|
||||
|
@ -73,7 +73,7 @@ bool ScrollBar::onProcessMessage(Message* msg)
|
||||
getScrollBarThemeInfo(&pos, &len);
|
||||
|
||||
m_wherepos = pos;
|
||||
m_whereclick = getAlign() & JI_HORIZONTAL ?
|
||||
m_whereclick = getAlign() & HORIZONTAL ?
|
||||
mousePos.x:
|
||||
mousePos.y;
|
||||
|
||||
@ -89,7 +89,7 @@ bool ScrollBar::onProcessMessage(Message* msg)
|
||||
|
||||
Point scroll = view->getViewScroll();
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
// in the bar
|
||||
if (MOUSE_IN(u1+pos, v1, u1+pos+len-1, v2)) {
|
||||
// capture mouse
|
||||
@ -144,7 +144,7 @@ bool ScrollBar::onProcessMessage(Message* msg)
|
||||
if (bar_size > len) {
|
||||
Point scroll = view->getViewScroll();
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
pos = (m_wherepos + mousePos.x - m_whereclick);
|
||||
pos = MID(0, pos, bar_size - len);
|
||||
|
||||
@ -189,7 +189,7 @@ void ScrollBar::getScrollBarInfo(int *_pos, int *_len, int *_bar_size, int *_vie
|
||||
int pos, len;
|
||||
int border_width;
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
bar_size = getBounds().w;
|
||||
viewport_size = view->getVisibleSize().w;
|
||||
border_width = this->border_width.t + this->border_width.b;
|
||||
|
@ -62,7 +62,7 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
|
||||
++bar;
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
x1 = c1->getBounds().x2();
|
||||
y1 = getBounds().y;
|
||||
x2 = c2->getBounds().x;
|
||||
@ -95,7 +95,7 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
if (hasCapture()) {
|
||||
gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
|
||||
|
||||
if (getAlign() & JI_HORIZONTAL) {
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
switch (m_type) {
|
||||
case ByPercentage:
|
||||
m_pos = 100.0 * (mousePos.x - getBounds().x) / getBounds().w;
|
||||
@ -141,7 +141,7 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
c1 = *it;
|
||||
c2 = *(it+1);
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL) {
|
||||
if (this->getAlign() & HORIZONTAL) {
|
||||
x1 = c1->getBounds().x2();
|
||||
y1 = getBounds().y;
|
||||
x2 = c2->getBounds().x;
|
||||
@ -163,7 +163,7 @@ bool Splitter::onProcessMessage(Message* msg)
|
||||
}
|
||||
|
||||
if (change_cursor) {
|
||||
if (getAlign() & JI_HORIZONTAL)
|
||||
if (getAlign() & HORIZONTAL)
|
||||
set_mouse_cursor(kSizeWECursor);
|
||||
else
|
||||
set_mouse_cursor(kSizeNSCursor);
|
||||
@ -220,7 +220,7 @@ void Splitter::onResize(ResizeEvent& ev)
|
||||
Widget* child2 = panel2();
|
||||
|
||||
if (child1 && child2) {
|
||||
if (getAlign() & JI_HORIZONTAL) {
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
LAYOUT_TWO_CHILDREN(x, y, w, h, l, t, r, b);
|
||||
}
|
||||
else {
|
||||
@ -270,14 +270,14 @@ void Splitter::onPreferredSize(PreferredSizeEvent& ev)
|
||||
|
||||
reqSize = child->getPreferredSize();
|
||||
|
||||
if (this->getAlign() & JI_HORIZONTAL)
|
||||
if (this->getAlign() & HORIZONTAL)
|
||||
GET_CHILD_SIZE(w, h);
|
||||
else
|
||||
GET_CHILD_SIZE(h, w);
|
||||
}
|
||||
|
||||
if (visibleChildren > 0) {
|
||||
if (this->getAlign() & JI_HORIZONTAL)
|
||||
if (this->getAlign() & HORIZONTAL)
|
||||
FINAL_SIZE(w);
|
||||
else
|
||||
FINAL_SIZE(h);
|
||||
@ -331,7 +331,7 @@ Widget* Splitter::panel2() const
|
||||
|
||||
void Splitter::limitPos()
|
||||
{
|
||||
if (getAlign() & JI_HORIZONTAL) {
|
||||
if (getAlign() & HORIZONTAL) {
|
||||
switch (m_type) {
|
||||
case ByPercentage:
|
||||
m_pos = MID(0, m_pos, 100);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2013 David Capello
|
||||
// Copyright (C) 2001-2013, 2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -158,7 +158,7 @@ void TextBox::onPreferredSize(PreferredSizeEvent& ev)
|
||||
|
||||
drawTextBox(NULL, this, &w, &h, gfx::ColorNone, gfx::ColorNone);
|
||||
|
||||
if (this->getAlign() & JI_WORDWRAP) {
|
||||
if (this->getAlign() & WORDWRAP) {
|
||||
View* view = View::getView(this);
|
||||
int width, min = w;
|
||||
|
||||
|
@ -114,7 +114,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
||||
chr = 0;
|
||||
|
||||
// Without word-wrap
|
||||
if (!(widget->getAlign() & JI_WORDWRAP)) {
|
||||
if (!(widget->getAlign() & WORDWRAP)) {
|
||||
width = widget->getClientBounds().w;
|
||||
}
|
||||
// With word-wrap
|
||||
@ -147,7 +147,7 @@ void drawTextBox(Graphics* g, Widget* widget,
|
||||
x = x1 - scroll.x;
|
||||
|
||||
// Without word-wrap
|
||||
if (!(widget->getAlign() & JI_WORDWRAP)) {
|
||||
if (!(widget->getAlign() & WORDWRAP)) {
|
||||
end = std::strchr(beg, '\n');
|
||||
if (end) {
|
||||
chr = *end;
|
||||
@ -197,9 +197,9 @@ void drawTextBox(Graphics* g, Widget* widget,
|
||||
if (g) {
|
||||
int xout;
|
||||
|
||||
if (widget->getAlign() & JI_CENTER)
|
||||
if (widget->getAlign() & CENTER)
|
||||
xout = x + width/2 - len/2;
|
||||
else if (widget->getAlign() & JI_RIGHT)
|
||||
else if (widget->getAlign() & RIGHT)
|
||||
xout = x + width - len;
|
||||
else // Left align
|
||||
xout = x;
|
||||
|
@ -110,35 +110,35 @@ void TooltipManager::onTick()
|
||||
int trycount = 0;
|
||||
for (; trycount < 4; ++trycount) {
|
||||
switch (arrowAlign) {
|
||||
case JI_TOP | JI_LEFT:
|
||||
case TOP | LEFT:
|
||||
x = bounds.x + bounds.w;
|
||||
y = bounds.y + bounds.h;
|
||||
break;
|
||||
case JI_TOP | JI_RIGHT:
|
||||
case TOP | RIGHT:
|
||||
x = bounds.x - w;
|
||||
y = bounds.y + bounds.h;
|
||||
break;
|
||||
case JI_BOTTOM | JI_LEFT:
|
||||
case BOTTOM | LEFT:
|
||||
x = bounds.x + bounds.w;
|
||||
y = bounds.y - h;
|
||||
break;
|
||||
case JI_BOTTOM | JI_RIGHT:
|
||||
case BOTTOM | RIGHT:
|
||||
x = bounds.x - w;
|
||||
y = bounds.y - h;
|
||||
break;
|
||||
case JI_TOP:
|
||||
case TOP:
|
||||
x = bounds.x + bounds.w/2 - w/2;
|
||||
y = bounds.y + bounds.h;
|
||||
break;
|
||||
case JI_BOTTOM:
|
||||
case BOTTOM:
|
||||
x = bounds.x + bounds.w/2 - w/2;
|
||||
y = bounds.y - h;
|
||||
break;
|
||||
case JI_LEFT:
|
||||
case LEFT:
|
||||
x = bounds.x + bounds.w;
|
||||
y = bounds.y + bounds.h/2 - h/2;
|
||||
break;
|
||||
case JI_RIGHT:
|
||||
case RIGHT:
|
||||
x = bounds.x - w;
|
||||
y = bounds.y + bounds.h/2 - h/2;
|
||||
break;
|
||||
@ -152,13 +152,13 @@ void TooltipManager::onTick()
|
||||
case 0:
|
||||
case 2:
|
||||
// Switch position
|
||||
if (arrowAlign & (JI_TOP | JI_BOTTOM)) arrowAlign ^= JI_TOP | JI_BOTTOM;
|
||||
if (arrowAlign & (JI_LEFT | JI_RIGHT)) arrowAlign ^= JI_LEFT | JI_RIGHT;
|
||||
if (arrowAlign & (TOP | BOTTOM)) arrowAlign ^= TOP | BOTTOM;
|
||||
if (arrowAlign & (LEFT | RIGHT)) arrowAlign ^= LEFT | RIGHT;
|
||||
break;
|
||||
case 1:
|
||||
// Rotate positions
|
||||
if (arrowAlign & (JI_TOP | JI_LEFT)) arrowAlign ^= JI_TOP | JI_LEFT;
|
||||
if (arrowAlign & (JI_BOTTOM | JI_RIGHT)) arrowAlign ^= JI_BOTTOM | JI_RIGHT;
|
||||
if (arrowAlign & (TOP | LEFT)) arrowAlign ^= TOP | LEFT;
|
||||
if (arrowAlign & (BOTTOM | RIGHT)) arrowAlign ^= BOTTOM | RIGHT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ using namespace gfx;
|
||||
|
||||
View::View()
|
||||
: Widget(kViewWidget)
|
||||
, m_scrollbar_h(JI_HORIZONTAL)
|
||||
, m_scrollbar_v(JI_VERTICAL)
|
||||
, m_scrollbar_h(HORIZONTAL)
|
||||
, m_scrollbar_v(VERTICAL)
|
||||
{
|
||||
m_hasBars = true;
|
||||
|
||||
|
@ -49,7 +49,7 @@ using namespace gfx;
|
||||
static inline void mark_dirty_flag(Widget* widget)
|
||||
{
|
||||
while (widget) {
|
||||
widget->flags |= JI_DIRTY;
|
||||
widget->flags |= DIRTY;
|
||||
widget = widget->getParent();
|
||||
}
|
||||
}
|
||||
@ -162,7 +162,7 @@ void Widget::setTextf(const char *format, ...)
|
||||
void Widget::setTextQuiet(const std::string& text)
|
||||
{
|
||||
m_text = text;
|
||||
flags |= JI_HASTEXT;
|
||||
flags |= HAS_TEXT;
|
||||
}
|
||||
|
||||
she::Font* Widget::getFont() const
|
||||
@ -198,16 +198,16 @@ void Widget::setTheme(Theme* theme)
|
||||
void Widget::setVisible(bool state)
|
||||
{
|
||||
if (state) {
|
||||
if (this->flags & JI_HIDDEN) {
|
||||
this->flags &= ~JI_HIDDEN;
|
||||
if (this->flags & HIDDEN) {
|
||||
this->flags &= ~HIDDEN;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(this->flags & JI_HIDDEN)) {
|
||||
if (!(this->flags & HIDDEN)) {
|
||||
getManager()->freeWidget(this); // Free from manager
|
||||
|
||||
this->flags |= JI_HIDDEN;
|
||||
this->flags |= HIDDEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,18 +215,18 @@ void Widget::setVisible(bool state)
|
||||
void Widget::setEnabled(bool state)
|
||||
{
|
||||
if (state) {
|
||||
if (this->flags & JI_DISABLED) {
|
||||
this->flags &= ~JI_DISABLED;
|
||||
if (this->flags & DISABLED) {
|
||||
this->flags &= ~DISABLED;
|
||||
invalidate();
|
||||
|
||||
onEnable();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!(this->flags & JI_DISABLED)) {
|
||||
if (!(this->flags & DISABLED)) {
|
||||
getManager()->freeWidget(this); // Free from the manager
|
||||
|
||||
this->flags |= JI_DISABLED;
|
||||
this->flags |= DISABLED;
|
||||
invalidate();
|
||||
|
||||
onDisable();
|
||||
@ -237,16 +237,16 @@ void Widget::setEnabled(bool state)
|
||||
void Widget::setSelected(bool state)
|
||||
{
|
||||
if (state) {
|
||||
if (!(this->flags & JI_SELECTED)) {
|
||||
this->flags |= JI_SELECTED;
|
||||
if (!(this->flags & SELECTED)) {
|
||||
this->flags |= SELECTED;
|
||||
invalidate();
|
||||
|
||||
onSelect();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this->flags & JI_SELECTED) {
|
||||
this->flags &= ~JI_SELECTED;
|
||||
if (this->flags & SELECTED) {
|
||||
this->flags &= ~SELECTED;
|
||||
invalidate();
|
||||
|
||||
onDeselect();
|
||||
@ -257,33 +257,33 @@ void Widget::setSelected(bool state)
|
||||
void Widget::setExpansive(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_EXPANSIVE;
|
||||
this->flags |= EXPANSIVE;
|
||||
else
|
||||
this->flags &= ~JI_EXPANSIVE;
|
||||
this->flags &= ~EXPANSIVE;
|
||||
}
|
||||
|
||||
void Widget::setDecorative(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_DECORATIVE;
|
||||
this->flags |= DECORATIVE;
|
||||
else
|
||||
this->flags &= ~JI_DECORATIVE;
|
||||
this->flags &= ~DECORATIVE;
|
||||
}
|
||||
|
||||
void Widget::setFocusStop(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_FOCUSSTOP;
|
||||
this->flags |= FOCUS_STOP;
|
||||
else
|
||||
this->flags &= ~JI_FOCUSSTOP;
|
||||
this->flags &= ~FOCUS_STOP;
|
||||
}
|
||||
|
||||
void Widget::setFocusMagnet(bool state)
|
||||
{
|
||||
if (state)
|
||||
this->flags |= JI_FOCUSMAGNET;
|
||||
this->flags |= FOCUS_MAGNET;
|
||||
else
|
||||
this->flags &= ~JI_FOCUSMAGNET;
|
||||
this->flags &= ~FOCUS_MAGNET;
|
||||
}
|
||||
|
||||
bool Widget::isVisible() const
|
||||
@ -292,7 +292,7 @@ bool Widget::isVisible() const
|
||||
const Widget* lastWidget = nullptr;
|
||||
|
||||
do {
|
||||
if (widget->flags & JI_HIDDEN)
|
||||
if (widget->flags & HIDDEN)
|
||||
return false;
|
||||
|
||||
lastWidget = widget;
|
||||
@ -308,7 +308,7 @@ bool Widget::isEnabled() const
|
||||
const Widget* widget = this;
|
||||
|
||||
do {
|
||||
if (widget->flags & JI_DISABLED)
|
||||
if (widget->flags & DISABLED)
|
||||
return false;
|
||||
|
||||
widget = widget->m_parent;
|
||||
@ -319,27 +319,27 @@ bool Widget::isEnabled() const
|
||||
|
||||
bool Widget::isSelected() const
|
||||
{
|
||||
return (this->flags & JI_SELECTED) ? true: false;
|
||||
return (this->flags & SELECTED) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isExpansive() const
|
||||
{
|
||||
return (this->flags & JI_EXPANSIVE) ? true: false;
|
||||
return (this->flags & EXPANSIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isDecorative() const
|
||||
{
|
||||
return (this->flags & JI_DECORATIVE) ? true: false;
|
||||
return (this->flags & DECORATIVE) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isFocusStop() const
|
||||
{
|
||||
return (this->flags & JI_FOCUSSTOP) ? true: false;
|
||||
return (this->flags & FOCUS_STOP) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::isFocusMagnet() const
|
||||
{
|
||||
return (this->flags & JI_FOCUSMAGNET) ? true: false;
|
||||
return (this->flags & FOCUS_MAGNET) ? true: false;
|
||||
}
|
||||
|
||||
// ===============================================================
|
||||
@ -423,7 +423,7 @@ Widget* Widget::pick(const gfx::Point& pt)
|
||||
{
|
||||
Widget* inside, *picked = NULL;
|
||||
|
||||
if (!(this->flags & JI_HIDDEN) && // Is visible
|
||||
if (!(this->flags & HIDDEN) && // Is visible
|
||||
getBounds().contains(pt)) { // The point is inside the bounds
|
||||
picked = this;
|
||||
|
||||
@ -708,7 +708,7 @@ void Widget::getDrawableRegion(gfx::Region& region, DrawableRegionFlags flags)
|
||||
Region reg3;
|
||||
child->getRegion(reg3);
|
||||
|
||||
if (child->flags & JI_DECORATIVE) {
|
||||
if (child->flags & DECORATIVE) {
|
||||
reg1 = getBounds();
|
||||
reg1.createIntersection(reg1, reg3);
|
||||
}
|
||||
@ -721,7 +721,7 @@ void Widget::getDrawableRegion(gfx::Region& region, DrawableRegionFlags flags)
|
||||
}
|
||||
|
||||
// Intersect with the parent area
|
||||
if (!(this->flags & JI_DECORATIVE)) {
|
||||
if (!(this->flags & DECORATIVE)) {
|
||||
Widget* parent = getParent();
|
||||
|
||||
while (parent) {
|
||||
@ -799,8 +799,8 @@ void Widget::getTextIconInfo(
|
||||
}
|
||||
|
||||
/* box size */
|
||||
if (icon_align & JI_CENTER) { /* with the icon in the center */
|
||||
if (icon_align & JI_MIDDLE) { /* with the icon inside the text */
|
||||
if (icon_align & CENTER) { /* with the icon in the center */
|
||||
if (icon_align & MIDDLE) { /* with the icon inside the text */
|
||||
box_w = MAX(icon_w, text_w);
|
||||
box_h = MAX(icon_h, text_h);
|
||||
}
|
||||
@ -817,16 +817,16 @@ void Widget::getTextIconInfo(
|
||||
}
|
||||
|
||||
/* box position */
|
||||
if (getAlign() & JI_RIGHT)
|
||||
if (getAlign() & RIGHT)
|
||||
box_x = bounds.x2() - box_w - border_width.r;
|
||||
else if (getAlign() & JI_CENTER)
|
||||
else if (getAlign() & CENTER)
|
||||
box_x = (bounds.x+bounds.x2())/2 - box_w/2;
|
||||
else
|
||||
box_x = bounds.x + border_width.l;
|
||||
|
||||
if (getAlign() & JI_BOTTOM)
|
||||
if (getAlign() & BOTTOM)
|
||||
box_y = bounds.y2() - box_h - border_width.b;
|
||||
else if (getAlign() & JI_MIDDLE)
|
||||
else if (getAlign() & MIDDLE)
|
||||
box_y = (bounds.y+bounds.y2())/2 - box_h/2;
|
||||
else
|
||||
box_y = bounds.y + border_width.t;
|
||||
@ -834,11 +834,11 @@ void Widget::getTextIconInfo(
|
||||
// With text
|
||||
if (hasText()) {
|
||||
// Text/icon X position
|
||||
if (icon_align & JI_RIGHT) {
|
||||
if (icon_align & RIGHT) {
|
||||
text_x = box_x;
|
||||
icon_x = box_x + box_w - icon_w;
|
||||
}
|
||||
else if (icon_align & JI_CENTER) {
|
||||
else if (icon_align & CENTER) {
|
||||
text_x = box_x + box_w/2 - text_w/2;
|
||||
icon_x = box_x + box_w/2 - icon_w/2;
|
||||
}
|
||||
@ -848,11 +848,11 @@ void Widget::getTextIconInfo(
|
||||
}
|
||||
|
||||
// Text Y position
|
||||
if (icon_align & JI_BOTTOM) {
|
||||
if (icon_align & BOTTOM) {
|
||||
text_y = box_y;
|
||||
icon_y = box_y + box_h - icon_h;
|
||||
}
|
||||
else if (icon_align & JI_MIDDLE) {
|
||||
else if (icon_align & MIDDLE) {
|
||||
text_y = box_y + box_h/2 - text_h/2;
|
||||
icon_y = box_y + box_h/2 - icon_h/2;
|
||||
}
|
||||
@ -890,8 +890,8 @@ void Widget::flushRedraw()
|
||||
std::queue<Widget*> processing;
|
||||
Message* msg;
|
||||
|
||||
if (this->flags & JI_DIRTY) {
|
||||
this->flags ^= JI_DIRTY;
|
||||
if (this->flags & DIRTY) {
|
||||
this->flags ^= DIRTY;
|
||||
processing.push(this);
|
||||
}
|
||||
|
||||
@ -907,8 +907,8 @@ void Widget::flushRedraw()
|
||||
|
||||
UI_FOREACH_WIDGET(widget->getChildren(), it) {
|
||||
Widget* child = *it;
|
||||
if (child->flags & JI_DIRTY) {
|
||||
child->flags ^= JI_DIRTY;
|
||||
if (child->flags & DIRTY) {
|
||||
child->flags ^= DIRTY;
|
||||
processing.push(child);
|
||||
}
|
||||
}
|
||||
@ -995,7 +995,7 @@ bool Widget::paintEvent(Graphics* graphics)
|
||||
graphics->fillRect(gfx::rgba(255, 0, 0), getClientBounds());
|
||||
#endif
|
||||
|
||||
this->flags |= JI_HIDDEN;
|
||||
this->flags |= HIDDEN;
|
||||
|
||||
gfx::Region rgn(getParent()->getBounds());
|
||||
rgn.createIntersection(rgn,
|
||||
@ -1005,7 +1005,7 @@ bool Widget::paintEvent(Graphics* graphics)
|
||||
graphics->getInternalDeltaY())));
|
||||
getParent()->paint(graphics, rgn);
|
||||
|
||||
this->flags &= ~JI_HIDDEN;
|
||||
this->flags &= ~HIDDEN;
|
||||
}
|
||||
|
||||
PaintEvent ev(this, graphics);
|
||||
@ -1279,12 +1279,12 @@ void Widget::offerCapture(ui::MouseMessage* mouseMsg, int widget_type)
|
||||
|
||||
bool Widget::hasFocus()
|
||||
{
|
||||
return (this->flags & JI_HASFOCUS) ? true: false;
|
||||
return (this->flags & HAS_FOCUS) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::hasMouse()
|
||||
{
|
||||
return (this->flags & JI_HASMOUSE) ? true: false;
|
||||
return (this->flags & HAS_MOUSE) ? true: false;
|
||||
}
|
||||
|
||||
bool Widget::hasMouseOver()
|
||||
@ -1294,7 +1294,7 @@ bool Widget::hasMouseOver()
|
||||
|
||||
bool Widget::hasCapture()
|
||||
{
|
||||
return (this->flags & JI_HASCAPTURE) ? true: false;
|
||||
return (this->flags & HAS_CAPTURE) ? true: false;
|
||||
}
|
||||
|
||||
int Widget::getMnemonicChar() const
|
||||
@ -1447,8 +1447,8 @@ void Widget::onInitTheme(InitThemeEvent& ev)
|
||||
if (m_theme) {
|
||||
m_theme->initWidget(this);
|
||||
|
||||
if (!(flags & JI_INITIALIZED))
|
||||
flags |= JI_INITIALIZED;
|
||||
if (!(flags & INITIALIZED))
|
||||
flags |= INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace ui {
|
||||
|
||||
// Text property.
|
||||
|
||||
bool hasText() const { return (flags & JI_HASTEXT) == JI_HASTEXT; }
|
||||
bool hasText() const { return (flags & HAS_TEXT) == HAS_TEXT; }
|
||||
|
||||
const std::string& getText() const { return m_text; }
|
||||
int getTextInt() const;
|
||||
|
@ -51,7 +51,7 @@ Window::Window(Type type, const std::string& text)
|
||||
m_isAutoRemap = true;
|
||||
|
||||
setVisible(false);
|
||||
setAlign(JI_LEFT | JI_MIDDLE);
|
||||
setAlign(LEFT | MIDDLE);
|
||||
if (type == WithTitleBar)
|
||||
setText(text);
|
||||
|
||||
@ -246,7 +246,7 @@ void Window::openWindowInForeground()
|
||||
openWindow();
|
||||
|
||||
MessageLoop loop(getManager());
|
||||
while (!(this->flags & JI_HIDDEN))
|
||||
while (!(this->flags & HIDDEN))
|
||||
loop.pumpMessages();
|
||||
|
||||
m_isForeground = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user