Replace NULL to nullptr in ui library
parent
28a28cff50
commit
8b1b624320
|
@ -1,4 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -208,7 +209,7 @@ Accelerator::Accelerator(const std::string& str)
|
|||
}
|
||||
// F1, F2, ..., F11, F12
|
||||
else if (tok[0] == 'f' && (tok.size() <= 3)) {
|
||||
int num = std::strtol(tok.c_str()+1, NULL, 10);
|
||||
int num = std::strtol(tok.c_str()+1, nullptr, 10);
|
||||
if ((num >= 1) && (num <= 12))
|
||||
m_scancode = (KeyScancode)((int)kKeyF1 + num - 1);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -9,9 +9,6 @@
|
|||
#define UI_BASE_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
// Get the system's definition of NULL
|
||||
#include <stddef.h>
|
||||
|
||||
namespace ui {
|
||||
|
||||
// Widget flags
|
||||
|
|
|
@ -220,7 +220,7 @@ Widget* ComboBox::getItem(const int itemIndex) const
|
|||
return m_items[itemIndex];
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::string& ComboBox::getItemText(int itemIndex) const
|
||||
|
@ -506,7 +506,8 @@ bool ComboBoxEntry::onProcessMessage(Message* msg)
|
|||
Widget* pick = manager()->pick(mouseMsg->position());
|
||||
Widget* listbox = m_comboBox->m_listbox;
|
||||
|
||||
if (pick != NULL && (pick == listbox || pick->hasAncestor(listbox))) {
|
||||
if (pick != nullptr &&
|
||||
(pick == listbox || pick->hasAncestor(listbox))) {
|
||||
releaseMouse();
|
||||
|
||||
MouseMessage mouseMsg2(kMouseDownMessage,
|
||||
|
|
|
@ -547,7 +547,7 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
|
|||
std::string text = this->text();
|
||||
int selbeg, selend;
|
||||
|
||||
getEntryThemeInfo(NULL, NULL, NULL, &selbeg, &selend);
|
||||
getEntryThemeInfo(nullptr, nullptr, nullptr, &selbeg, &selend);
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -29,8 +29,8 @@ using namespace gfx;
|
|||
|
||||
Grid::Cell::Cell()
|
||||
{
|
||||
parent = NULL;
|
||||
child = NULL;
|
||||
parent = nullptr;
|
||||
child = nullptr;
|
||||
hspan = 0;
|
||||
vspan = 0;
|
||||
align = 0;
|
||||
|
@ -141,8 +141,8 @@ void Grid::onResize(ResizeEvent& ev)
|
|||
for (col=0; col<(int)m_colstrip.size(); ++col) {
|
||||
Cell* cell = m_cells[row][col];
|
||||
|
||||
if (cell->child != NULL &&
|
||||
cell->parent == NULL &&
|
||||
if (cell->child != nullptr &&
|
||||
cell->parent == nullptr &&
|
||||
!(cell->child->hasFlags(HIDDEN))) {
|
||||
x = pos_x;
|
||||
y = pos_y;
|
||||
|
@ -278,8 +278,8 @@ void Grid::calculateStripSize(std::vector<Strip>& colstrip,
|
|||
else
|
||||
cell = m_cells[col][row]; // Transposed
|
||||
|
||||
if (cell->child != NULL) {
|
||||
if (cell->parent == NULL) {
|
||||
if (cell->child != nullptr) {
|
||||
if (cell->parent == nullptr) {
|
||||
// If the widget isn't hidden then we can request its size
|
||||
if (!(cell->child->hasFlags(HIDDEN))) {
|
||||
Size reqSize = cell->child->sizeHint();
|
||||
|
@ -338,8 +338,8 @@ void Grid::expandStrip(std::vector<Strip>& colstrip,
|
|||
cell_span = cell->vspan;
|
||||
}
|
||||
|
||||
if (cell->child != NULL &&
|
||||
cell->parent == NULL &&
|
||||
if (cell->child != nullptr &&
|
||||
cell->parent == nullptr &&
|
||||
cell_size > 0) {
|
||||
ASSERT(cell_span > 0);
|
||||
|
||||
|
@ -464,7 +464,7 @@ bool Grid::putWidgetInCell(Widget* child, int hspan, int vspan, int align)
|
|||
for (col=0; col<(int)m_colstrip.size(); ++col) {
|
||||
cell = m_cells[row][col];
|
||||
|
||||
if (cell->child == NULL) {
|
||||
if (cell->child == nullptr) {
|
||||
cell->child = child;
|
||||
cell->hspan = hspan;
|
||||
cell->vspan = vspan;
|
||||
|
@ -483,8 +483,8 @@ bool Grid::putWidgetInCell(Widget* child, int hspan, int vspan, int align)
|
|||
// If these asserts fails, it's really possible that you
|
||||
// specified bad values for hspan or vspan (they are
|
||||
// overlapping with other cells).
|
||||
ASSERT(cell->parent == NULL);
|
||||
ASSERT(cell->child == NULL);
|
||||
ASSERT(cell->parent == nullptr);
|
||||
ASSERT(cell->child == nullptr);
|
||||
|
||||
cell->parent = parentcell;
|
||||
cell->child = child;
|
||||
|
@ -496,8 +496,8 @@ bool Grid::putWidgetInCell(Widget* child, int hspan, int vspan, int align)
|
|||
for (col=colbeg; col<colend; ++col) {
|
||||
cell = m_cells[row][col];
|
||||
|
||||
ASSERT(cell->parent == NULL);
|
||||
ASSERT(cell->child == NULL);
|
||||
ASSERT(cell->parent == nullptr);
|
||||
ASSERT(cell->child == nullptr);
|
||||
|
||||
cell->parent = parentcell;
|
||||
cell->child = child;
|
||||
|
@ -542,8 +542,8 @@ void Grid::incColSize(int col, int size)
|
|||
for (int row=0; row<(int)m_rowstrip.size(); ) {
|
||||
Cell* cell = m_cells[row][col];
|
||||
|
||||
if (cell->child != NULL) {
|
||||
if (cell->parent != NULL)
|
||||
if (cell->child != nullptr) {
|
||||
if (cell->parent != nullptr)
|
||||
cell->parent->w -= size;
|
||||
else
|
||||
cell->w -= size;
|
||||
|
@ -562,8 +562,8 @@ void Grid::incRowSize(int row, int size)
|
|||
for (int col=0; col<(int)m_colstrip.size(); ) {
|
||||
Cell* cell = m_cells[row][col];
|
||||
|
||||
if (cell->child != NULL) {
|
||||
if (cell->parent != NULL)
|
||||
if (cell->child != nullptr) {
|
||||
if (cell->parent != nullptr)
|
||||
cell->parent->h -= size;
|
||||
else
|
||||
cell->h -= size;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -37,7 +38,7 @@ ImageView::~ImageView()
|
|||
void ImageView::onSizeHint(SizeHintEvent& ev)
|
||||
{
|
||||
gfx::Rect box;
|
||||
getTextIconInfo(&box, NULL, NULL,
|
||||
getTextIconInfo(&box, nullptr, nullptr,
|
||||
align(), m_sur->width(), m_sur->height());
|
||||
|
||||
ev.setSizeHint(
|
||||
|
|
|
@ -204,9 +204,9 @@ void IntEntry::closePopup()
|
|||
if (m_popupWindow) {
|
||||
removeSlider();
|
||||
|
||||
m_popupWindow->closeWindow(NULL);
|
||||
m_popupWindow->closeWindow(nullptr);
|
||||
delete m_popupWindow;
|
||||
m_popupWindow = NULL;
|
||||
m_popupWindow = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ struct Filter {
|
|||
typedef std::list<Message*> Messages;
|
||||
typedef std::list<Filter*> Filters;
|
||||
|
||||
Manager* Manager::m_defaultManager = NULL;
|
||||
Manager* Manager::m_defaultManager = nullptr;
|
||||
gfx::Region Manager::m_dirtyRegion;
|
||||
|
||||
#ifdef DEBUG_UI_THREADS
|
||||
|
@ -162,9 +162,9 @@ bool Manager::widgetAssociatedToManager(Widget* widget)
|
|||
|
||||
Manager::Manager()
|
||||
: Widget(kManagerWidget)
|
||||
, m_display(NULL)
|
||||
, m_eventQueue(NULL)
|
||||
, m_lockedWindow(NULL)
|
||||
, m_display(nullptr)
|
||||
, m_eventQueue(nullptr)
|
||||
, m_lockedWindow(nullptr)
|
||||
, m_mouseButton(kButtonNone)
|
||||
{
|
||||
#ifdef DEBUG_UI_THREADS
|
||||
|
@ -178,9 +178,9 @@ Manager::Manager()
|
|||
mouse_widgets_list.clear();
|
||||
|
||||
// Reset variables
|
||||
focus_widget = NULL;
|
||||
mouse_widget = NULL;
|
||||
capture_widget = NULL;
|
||||
focus_widget = nullptr;
|
||||
mouse_widget = nullptr;
|
||||
capture_widget = nullptr;
|
||||
}
|
||||
|
||||
setBounds(gfx::Rect(0, 0, ui::display_w(), ui::display_h()));
|
||||
|
@ -428,7 +428,7 @@ void Manager::generateMessagesFromOSEvents()
|
|||
|
||||
case os::Event::MouseLeave: {
|
||||
set_mouse_cursor(kOutsideDisplay);
|
||||
setMouse(NULL);
|
||||
setMouse(nullptr);
|
||||
|
||||
_internal_no_mouse_position();
|
||||
|
||||
|
@ -639,7 +639,7 @@ void Manager::handleWindowZOrder()
|
|||
|
||||
// The clicked window
|
||||
Window* window = mouse_widget->window();
|
||||
Manager* win_manager = (window ? window->manager(): NULL);
|
||||
Manager* win_manager = (window ? window->manager(): nullptr);
|
||||
|
||||
if ((window) &&
|
||||
// We cannot change Z-order of desktop windows
|
||||
|
@ -650,7 +650,7 @@ void Manager::handleWindowZOrder()
|
|||
(!window->isForeground()) &&
|
||||
// If the window is not already the top window of the manager.
|
||||
(window != win_manager->getTopWindow())) {
|
||||
base::ScopedValue<Widget*> scoped(m_lockedWindow, window, NULL);
|
||||
base::ScopedValue<Widget*> scoped(m_lockedWindow, window, nullptr);
|
||||
|
||||
// Put it in the top of the list
|
||||
win_manager->removeChild(window);
|
||||
|
@ -837,7 +837,7 @@ void Manager::setMouse(Widget* widget)
|
|||
mouse_widget = widget;
|
||||
if (widget) {
|
||||
auto msg = newMouseMessage(
|
||||
kMouseEnterMessage, NULL,
|
||||
kMouseEnterMessage, nullptr,
|
||||
get_mouse_position(),
|
||||
PointerType::Unknown,
|
||||
m_mouseButton,
|
||||
|
@ -896,19 +896,19 @@ void Manager::focusFirstChild(Widget* widget)
|
|||
|
||||
void Manager::freeFocus()
|
||||
{
|
||||
setFocus(NULL);
|
||||
setFocus(nullptr);
|
||||
}
|
||||
|
||||
void Manager::freeMouse()
|
||||
{
|
||||
setMouse(NULL);
|
||||
setMouse(nullptr);
|
||||
}
|
||||
|
||||
void Manager::freeCapture()
|
||||
{
|
||||
if (capture_widget) {
|
||||
capture_widget->disableFlags(HAS_CAPTURE);
|
||||
capture_widget = NULL;
|
||||
capture_widget = nullptr;
|
||||
|
||||
m_display->releaseMouse();
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ void Manager::onInitTheme(InitThemeEvent& ev)
|
|||
|
||||
LayoutIO* Manager::onGetLayoutIO()
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Manager::onNewDisplayConfiguration()
|
||||
|
@ -1375,7 +1375,7 @@ int Manager::pumpQueue()
|
|||
|
||||
// Call Timer::tick() if this is a tick message.
|
||||
if (msg->type() == kTimerMessage) {
|
||||
ASSERT(static_cast<TimerMessage*>(msg)->timer() != NULL);
|
||||
ASSERT(static_cast<TimerMessage*>(msg)->timer() != nullptr);
|
||||
static_cast<TimerMessage*>(msg)->timer()->tick();
|
||||
}
|
||||
|
||||
|
@ -1670,7 +1670,7 @@ Widget* Manager::findMagneticWidget(Widget* widget)
|
|||
if (widget->isFocusMagnet())
|
||||
return widget;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -1733,11 +1733,11 @@ void Manager::broadcastKeyMsg(Message* msg)
|
|||
|
||||
bool Manager::processFocusMovementMessage(Message* msg)
|
||||
{
|
||||
int (*cmp)(Widget*, int, int) = NULL;
|
||||
Widget* focus = NULL;
|
||||
int (*cmp)(Widget*, int, int) = nullptr;
|
||||
Widget* focus = nullptr;
|
||||
Widget* it;
|
||||
bool ret = false;
|
||||
Window* window = NULL;
|
||||
Window* window = nullptr;
|
||||
int c, count;
|
||||
|
||||
// Who have the focus
|
||||
|
@ -1877,7 +1877,7 @@ static Widget* next_widget(Widget* widget)
|
|||
widget = widget->parent();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int cmp_left(Widget* widget, int x, int y)
|
||||
|
|
|
@ -154,7 +154,7 @@ static void add_scrollbars_if_needed(Window* window)
|
|||
|
||||
Menu::Menu()
|
||||
: Widget(kMenuWidget)
|
||||
, m_menuitem(NULL)
|
||||
, m_menuitem(nullptr)
|
||||
{
|
||||
enableFlags(IGNORE_MOUSE);
|
||||
initTheme();
|
||||
|
@ -164,10 +164,10 @@ Menu::~Menu()
|
|||
{
|
||||
if (m_menuitem) {
|
||||
if (m_menuitem->getSubmenu() == this) {
|
||||
m_menuitem->setSubmenu(NULL);
|
||||
m_menuitem->setSubmenu(nullptr);
|
||||
}
|
||||
else {
|
||||
ASSERT(m_menuitem->getSubmenu() == NULL);
|
||||
ASSERT(m_menuitem->getSubmenu() == nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ Menu::~Menu()
|
|||
|
||||
MenuBox::MenuBox(WidgetType type)
|
||||
: Widget(type)
|
||||
, m_base(NULL)
|
||||
, m_base(nullptr)
|
||||
{
|
||||
this->setFocusStop(true);
|
||||
initTheme();
|
||||
|
@ -219,8 +219,8 @@ MenuItem::MenuItem(const std::string& text)
|
|||
: Widget(kMenuItemWidget)
|
||||
{
|
||||
m_highlighted = false;
|
||||
m_submenu = NULL;
|
||||
m_submenu_menubox = NULL;
|
||||
m_submenu = nullptr;
|
||||
m_submenu_menubox = nullptr;
|
||||
|
||||
setText(text);
|
||||
initTheme();
|
||||
|
@ -265,7 +265,7 @@ void MenuBox::setMenu(Menu* menu)
|
|||
void MenuItem::setSubmenu(Menu* menu)
|
||||
{
|
||||
if (m_submenu)
|
||||
m_submenu->setOwnerMenuItem(NULL);
|
||||
m_submenu->setOwnerMenuItem(nullptr);
|
||||
|
||||
m_submenu = menu;
|
||||
|
||||
|
@ -449,13 +449,13 @@ bool MenuBox::onProcessMessage(Message* msg)
|
|||
// Here we catch the filtered messages (menu-bar or the
|
||||
// popuped menu-box) to detect if the user press outside of
|
||||
// the widget
|
||||
if (msg->type() == kMouseDownMessage && m_base != NULL) {
|
||||
if (msg->type() == kMouseDownMessage && m_base != nullptr) {
|
||||
Widget* picked = manager()->pick(mousePos);
|
||||
|
||||
// If one of these conditions are accomplished we have to
|
||||
// close all menus (back to menu-bar or close the popuped
|
||||
// menubox), this is the place where we control if...
|
||||
if (picked == NULL || // If the button was clicked nowhere
|
||||
if (picked == nullptr || // If the button was clicked nowhere
|
||||
picked == this || // If the button was clicked in this menubox
|
||||
// The picked widget isn't from the same tree of menus
|
||||
(get_base_menubox(picked) != this ||
|
||||
|
@ -531,7 +531,7 @@ bool MenuBox::onProcessMessage(Message* msg)
|
|||
MenuItem* highlight = menu->getHighlightedItem();
|
||||
if (highlight &&
|
||||
!highlight->hasSubmenuOpened() &&
|
||||
highlight->m_submenu_timer == NULL) {
|
||||
highlight->m_submenu_timer == nullptr) {
|
||||
menu->closeAll();
|
||||
highlight->executeClick();
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ bool MenuBox::onProcessMessage(Message* msg)
|
|||
// Highlight movement with keyboard
|
||||
if (this->hasFocus()) {
|
||||
MenuItem* highlight = menu->getHighlightedItem();
|
||||
MenuItem* child_with_submenu_opened = NULL;
|
||||
MenuItem* child_with_submenu_opened = nullptr;
|
||||
bool used = false;
|
||||
|
||||
// Search a child with highlight or the submenu opened
|
||||
|
@ -805,7 +805,7 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||
MenuBaseData* base = get_base(this);
|
||||
bool select_first = static_cast<OpenMenuItemMessage*>(msg)->select_first();
|
||||
|
||||
ASSERT(base != NULL);
|
||||
ASSERT(base != nullptr);
|
||||
ASSERT(base->is_processing);
|
||||
ASSERT(hasSubmenu());
|
||||
|
||||
|
@ -862,7 +862,7 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||
// Setup the highlight of the new menubox
|
||||
if (select_first) {
|
||||
// Select the first child
|
||||
MenuItem* first_child = NULL;
|
||||
MenuItem* first_child = nullptr;
|
||||
|
||||
for (auto child : m_submenu->children()) {
|
||||
if (child->type() != kMenuItemWidget)
|
||||
|
@ -893,22 +893,22 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||
bool last_of_close_chain = static_cast<CloseMenuItemMessage*>(msg)->last_of_close_chain();
|
||||
MenuBaseData* base = get_base(this);
|
||||
|
||||
ASSERT(base != NULL);
|
||||
ASSERT(base != nullptr);
|
||||
ASSERT(base->is_processing);
|
||||
|
||||
MenuBox* menubox = m_submenu_menubox;
|
||||
m_submenu_menubox = NULL;
|
||||
m_submenu_menubox = nullptr;
|
||||
|
||||
ASSERT(menubox != NULL);
|
||||
ASSERT(menubox != nullptr);
|
||||
|
||||
Window* window = menubox->window();
|
||||
ASSERT(window && window->type() == kWindowWidget);
|
||||
|
||||
// Fetch the "menu" to avoid destroy it with 'delete'.
|
||||
menubox->setMenu(NULL);
|
||||
menubox->setMenu(nullptr);
|
||||
|
||||
// Destroy the window
|
||||
window->closeWindow(NULL);
|
||||
window->closeWindow(nullptr);
|
||||
|
||||
// Set the focus to this menu-box of this menu-item
|
||||
if (base->close_all)
|
||||
|
@ -945,7 +945,7 @@ bool MenuItem::onProcessMessage(Message* msg)
|
|||
stopTimer();
|
||||
|
||||
// If the submenu is closed, and we are not processing messages, open it
|
||||
if (m_submenu_menubox == NULL && !base->is_processing)
|
||||
if (m_submenu_menubox == nullptr && !base->is_processing)
|
||||
openSubmenu(false);
|
||||
}
|
||||
break;
|
||||
|
@ -1014,8 +1014,8 @@ static MenuBox* get_base_menubox(Widget* widget)
|
|||
else {
|
||||
Menu* menu = static_cast<MenuBox*>(widget)->getMenu();
|
||||
|
||||
ASSERT(menu != NULL);
|
||||
ASSERT(menu->getOwnerMenuItem() != NULL);
|
||||
ASSERT(menu != nullptr);
|
||||
ASSERT(menu->getOwnerMenuItem() != nullptr);
|
||||
|
||||
widget = menu->getOwnerMenuItem();
|
||||
}
|
||||
|
@ -1055,7 +1055,7 @@ MenuItem* Menu::getHighlightedItem()
|
|||
if (menuitem->isHighlighted())
|
||||
return menuitem;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Menu::highlightItem(MenuItem* menuitem, bool click, bool open_submenu, bool select_first_child)
|
||||
|
@ -1098,7 +1098,7 @@ void Menu::highlightItem(MenuItem* menuitem, bool click, bool open_submenu, bool
|
|||
}
|
||||
|
||||
// Highlight parents
|
||||
if (getOwnerMenuItem() != NULL) {
|
||||
if (getOwnerMenuItem() != nullptr) {
|
||||
static_cast<Menu*>(getOwnerMenuItem()->parent())
|
||||
->highlightItem(getOwnerMenuItem(), false, false, false);
|
||||
}
|
||||
|
@ -1124,7 +1124,7 @@ void Menu::highlightItem(MenuItem* menuitem, bool click, bool open_submenu, bool
|
|||
|
||||
void Menu::unhighlightItem()
|
||||
{
|
||||
highlightItem(NULL, false, false, false);
|
||||
highlightItem(nullptr, false, false, false);
|
||||
}
|
||||
|
||||
bool MenuItem::inBar()
|
||||
|
@ -1145,7 +1145,7 @@ void MenuItem::openSubmenu(bool select_first)
|
|||
menu = this->parent();
|
||||
|
||||
// The menu item is already opened?
|
||||
ASSERT(m_submenu_menubox == NULL);
|
||||
ASSERT(m_submenu_menubox == nullptr);
|
||||
|
||||
ASSERT_VALID_WIDGET(menu);
|
||||
|
||||
|
@ -1168,7 +1168,7 @@ void MenuItem::openSubmenu(bool select_first)
|
|||
|
||||
// Get the 'base'
|
||||
MenuBaseData* base = get_base(this);
|
||||
ASSERT(base != NULL);
|
||||
ASSERT(base != nullptr);
|
||||
ASSERT(base->is_processing == false);
|
||||
|
||||
// Reset flags
|
||||
|
@ -1190,11 +1190,11 @@ void MenuItem::closeSubmenu(bool last_of_close_chain)
|
|||
Message* msg;
|
||||
MenuBaseData* base;
|
||||
|
||||
ASSERT(m_submenu_menubox != NULL);
|
||||
ASSERT(m_submenu_menubox != nullptr);
|
||||
|
||||
// First: recursively close the children
|
||||
menu = m_submenu_menubox->getMenu();
|
||||
ASSERT(menu != NULL);
|
||||
ASSERT(menu != nullptr);
|
||||
|
||||
for (auto child : menu->children()) {
|
||||
if (child->type() != kMenuItemWidget)
|
||||
|
@ -1214,7 +1214,7 @@ void MenuItem::closeSubmenu(bool last_of_close_chain)
|
|||
if (last_of_close_chain) {
|
||||
// Get the 'base'
|
||||
base = get_base(this);
|
||||
ASSERT(base != NULL);
|
||||
ASSERT(base != nullptr);
|
||||
ASSERT(base->is_processing == false);
|
||||
|
||||
// Start processing
|
||||
|
@ -1224,7 +1224,7 @@ void MenuItem::closeSubmenu(bool last_of_close_chain)
|
|||
|
||||
void MenuItem::startTimer()
|
||||
{
|
||||
if (m_submenu_timer == NULL)
|
||||
if (m_submenu_timer == nullptr)
|
||||
m_submenu_timer.reset(new Timer(kTimeoutToOpenSubmenu, this));
|
||||
|
||||
m_submenu_timer->start();
|
||||
|
@ -1240,7 +1240,7 @@ void MenuItem::stopTimer()
|
|||
void Menu::closeAll()
|
||||
{
|
||||
Menu* menu = this;
|
||||
MenuItem* menuitem = NULL;
|
||||
MenuItem* menuitem = nullptr;
|
||||
while (menu->m_menuitem) {
|
||||
menuitem = menu->m_menuitem;
|
||||
menu = static_cast<Menu*>(menuitem->parent());
|
||||
|
@ -1262,7 +1262,7 @@ void Menu::closeAll()
|
|||
|
||||
menu->unhighlightItem();
|
||||
|
||||
if (menuitem != NULL) {
|
||||
if (menuitem != nullptr) {
|
||||
if (menuitem->hasSubmenuOpened())
|
||||
menuitem->closeSubmenu(true);
|
||||
}
|
||||
|
@ -1346,10 +1346,10 @@ static MenuItem* check_for_letter(Menu* menu, const KeyMessage* keymsg)
|
|||
if (menuitem->isMnemonicPressed(keymsg))
|
||||
return menuitem;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Finds the next item of `menuitem', if `menuitem' is NULL searchs
|
||||
// Finds the next item of `menuitem', if `menuitem' is nullptr searchs
|
||||
// from the first item in `menu'
|
||||
static MenuItem* find_nextitem(Menu* menu, MenuItem* menuitem)
|
||||
{
|
||||
|
@ -1371,9 +1371,9 @@ static MenuItem* find_nextitem(Menu* menu, MenuItem* menuitem)
|
|||
}
|
||||
|
||||
if (menuitem)
|
||||
return find_nextitem(menu, NULL);
|
||||
return find_nextitem(menu, nullptr);
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static MenuItem* find_previtem(Menu* menu, MenuItem* menuitem)
|
||||
|
@ -1396,9 +1396,9 @@ static MenuItem* find_previtem(Menu* menu, MenuItem* menuitem)
|
|||
}
|
||||
|
||||
if (menuitem)
|
||||
return find_previtem(menu, NULL);
|
||||
return find_previtem(menu, nullptr);
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -117,11 +118,11 @@ namespace ui {
|
|||
|
||||
// Returns true if the submenu is opened.
|
||||
bool hasSubmenuOpened() const {
|
||||
return (m_submenu_menubox != NULL);
|
||||
return (m_submenu_menubox != nullptr);
|
||||
}
|
||||
|
||||
// Returns the menu-box where the sub-menu has been opened, or just
|
||||
// NULL if the sub-menu is closed.
|
||||
// Returns the menu-box where the sub-menu has been opened, or
|
||||
// just nullptr if the sub-menu is closed.
|
||||
MenuBox* getSubmenuContainer() const {
|
||||
return m_submenu_menubox;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -24,11 +24,11 @@ static bool less_than(Overlay* x, Overlay* y) {
|
|||
return *x < *y;
|
||||
}
|
||||
|
||||
OverlayManager* OverlayManager::m_singleton = NULL;
|
||||
OverlayManager* OverlayManager::m_singleton = nullptr;
|
||||
|
||||
OverlayManager* OverlayManager::instance()
|
||||
{
|
||||
if (m_singleton == NULL)
|
||||
if (m_singleton == nullptr)
|
||||
m_singleton = new OverlayManager;
|
||||
return m_singleton;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -146,14 +147,14 @@ bool PopupWindow::onProcessMessage(Message* msg)
|
|||
case ClickBehavior::CloseOnClickInOtherWindow: {
|
||||
Widget* picked = pick(mousePos);
|
||||
if (!picked || picked->window() != this) {
|
||||
closeWindow(NULL);
|
||||
closeWindow(nullptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ClickBehavior::CloseOnClickOutsideHotRegion:
|
||||
if (!m_hotRegion.contains(mousePos)) {
|
||||
closeWindow(NULL);
|
||||
closeWindow(nullptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -163,13 +164,13 @@ bool PopupWindow::onProcessMessage(Message* msg)
|
|||
case kMouseMoveMessage:
|
||||
if (m_fixed &&
|
||||
!m_hotRegion.isEmpty() &&
|
||||
manager()->getCapture() == NULL) {
|
||||
manager()->getCapture() == nullptr) {
|
||||
gfx::Point mousePos = static_cast<MouseMessage*>(msg)->position();
|
||||
|
||||
// If the mouse is outside the hot-region we have to close the
|
||||
// window.
|
||||
if (!m_hotRegion.contains(mousePos))
|
||||
closeWindow(NULL);
|
||||
closeWindow(nullptr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -55,7 +55,7 @@ void ScrollBar::setSize(int size)
|
|||
|
||||
void ScrollBar::getScrollBarThemeInfo(int* pos, int* len)
|
||||
{
|
||||
getScrollBarInfo(pos, len, NULL, NULL);
|
||||
getScrollBarInfo(pos, len, nullptr, nullptr);
|
||||
}
|
||||
|
||||
bool ScrollBar::onProcessMessage(Message* msg)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -86,7 +86,7 @@ int Slider::convertTextToValue(const std::string& text) const
|
|||
if (m_delegate)
|
||||
return m_delegate->onGetValueFromText(text);
|
||||
else {
|
||||
return std::strtol(text.c_str(), NULL, 10);
|
||||
return std::strtol(text.c_str(), nullptr, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,9 +72,9 @@ static void update_mouse_overlay(const Cursor* cursor)
|
|||
}
|
||||
else if (mouse_cursor_overlay) {
|
||||
OverlayManager::instance()->removeOverlay(mouse_cursor_overlay);
|
||||
mouse_cursor_overlay->setSurface(NULL);
|
||||
mouse_cursor_overlay->setSurface(nullptr);
|
||||
delete mouse_cursor_overlay;
|
||||
mouse_cursor_overlay = NULL;
|
||||
mouse_cursor_overlay = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ bool get_clipboard_text(std::string& text)
|
|||
|
||||
void update_cursor_overlay()
|
||||
{
|
||||
if (mouse_cursor_overlay != NULL && mouse_scares == 0) {
|
||||
if (mouse_cursor_overlay != nullptr && mouse_scares == 0) {
|
||||
gfx::Point newPos =
|
||||
get_mouse_position() - mouse_cursor->getFocus();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -794,7 +794,7 @@ void Theme::drawTextBox(Graphics* g, Widget* widget,
|
|||
}
|
||||
// With word-wrap
|
||||
else {
|
||||
old_end = NULL;
|
||||
old_end = nullptr;
|
||||
for (beg_end=beg;;) {
|
||||
end = std::strpbrk(beg_end, " \n");
|
||||
if (end) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -18,7 +19,7 @@ namespace ui {
|
|||
|
||||
class Timer {
|
||||
public:
|
||||
Timer(int interval, Widget* owner = NULL);
|
||||
Timer(int interval, Widget* owner = nullptr);
|
||||
virtual ~Timer();
|
||||
|
||||
int interval() const { return m_interval; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -77,7 +77,7 @@ bool TooltipManager::onProcessMessage(Message* msg)
|
|||
m_target.widget = it->first;
|
||||
m_target.tipInfo = it->second;
|
||||
|
||||
if (m_timer == NULL) {
|
||||
if (m_timer == nullptr) {
|
||||
m_timer.reset(new Timer(kTooltipDelayMsecs, this));
|
||||
m_timer->Tick.connect(&TooltipManager::onTick, this);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ bool TooltipManager::onProcessMessage(Message* msg)
|
|||
case kMouseDownMessage:
|
||||
case kMouseLeaveMessage:
|
||||
if (m_tipWindow) {
|
||||
m_tipWindow->closeWindow(NULL);
|
||||
m_tipWindow->closeWindow(nullptr);
|
||||
m_tipWindow.reset();
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ bool TipWindow::onProcessMessage(Message* msg)
|
|||
case kKeyDownMessage:
|
||||
if (m_closeOnKeyDown &&
|
||||
static_cast<KeyMessage*>(msg)->scancode() < kKeyFirstModifierScancode)
|
||||
closeWindow(NULL);
|
||||
closeWindow(nullptr);
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -425,17 +425,17 @@ Widget* Widget::nextSibling()
|
|||
assert_ui_thread();
|
||||
|
||||
if (!m_parent)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
WidgetsList::iterator begin = m_parent->m_children.begin();
|
||||
WidgetsList::iterator end = m_parent->m_children.end();
|
||||
WidgetsList::iterator it = std::find(begin, end, this);
|
||||
|
||||
if (it == end)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (++it == end)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return *it;
|
||||
}
|
||||
|
@ -445,14 +445,14 @@ Widget* Widget::previousSibling()
|
|||
assert_ui_thread();
|
||||
|
||||
if (!m_parent)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
WidgetsList::iterator begin = m_parent->m_children.begin();
|
||||
WidgetsList::iterator end = m_parent->m_children.end();
|
||||
WidgetsList::iterator it = std::find(begin, end, this);
|
||||
|
||||
if (it == begin || it == end)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return *(++it);
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ void Widget::removeChild(WidgetsList::iterator& it)
|
|||
if (manager)
|
||||
manager->freeWidget(child);
|
||||
|
||||
child->m_parent = NULL;
|
||||
child->m_parent = nullptr;
|
||||
}
|
||||
|
||||
void Widget::removeChild(Widget* child)
|
||||
|
@ -1380,7 +1380,7 @@ bool Widget::isMnemonicPressed(const KeyMessage* keyMsg) const
|
|||
|
||||
bool Widget::onProcessMessage(Message* msg)
|
||||
{
|
||||
ASSERT(msg != NULL);
|
||||
ASSERT(msg != nullptr);
|
||||
|
||||
switch (msg->type()) {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#define ASSERT_VALID_WIDGET(widget) ASSERT((widget) != NULL)
|
||||
#define ASSERT_VALID_WIDGET(widget) ASSERT((widget) != nullptr)
|
||||
|
||||
namespace os {
|
||||
class Font;
|
||||
|
@ -171,12 +171,12 @@ namespace ui {
|
|||
Widget* at(int index) { return m_children[index]; }
|
||||
int getChildIndex(Widget* child);
|
||||
|
||||
// Returns the first/last child or NULL if it doesn't exist.
|
||||
// Returns the first/last child or nullptr if it doesn't exist.
|
||||
Widget* firstChild() {
|
||||
return (!m_children.empty() ? m_children.front(): NULL);
|
||||
return (!m_children.empty() ? m_children.front(): nullptr);
|
||||
}
|
||||
Widget* lastChild() {
|
||||
return (!m_children.empty() ? m_children.back(): NULL);
|
||||
return (!m_children.empty() ? m_children.back(): nullptr);
|
||||
}
|
||||
|
||||
// Returns the next or previous siblings.
|
||||
|
@ -205,7 +205,7 @@ namespace ui {
|
|||
if (T* specificChild = dynamic_cast<T*>(child))
|
||||
return specificChild;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void addChild(Widget* child);
|
||||
|
@ -282,8 +282,8 @@ namespace ui {
|
|||
|
||||
void getTextIconInfo(
|
||||
gfx::Rect* box,
|
||||
gfx::Rect* text = NULL,
|
||||
gfx::Rect* icon = NULL,
|
||||
gfx::Rect* text = nullptr,
|
||||
gfx::Rect* icon = nullptr,
|
||||
int icon_align = 0, int icon_w = 0, int icon_h = 0);
|
||||
|
||||
// ===============================================================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -12,7 +12,7 @@
|
|||
#include <vector>
|
||||
|
||||
#define UI_FIRST_WIDGET(list_name) \
|
||||
((list_name).empty() ? NULL: (list_name).front())
|
||||
((list_name).empty() ? nullptr: (list_name).front())
|
||||
|
||||
namespace ui {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite UI Library
|
||||
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -348,7 +348,7 @@ bool Window::onProcessMessage(Message* msg)
|
|||
switch (msg->type()) {
|
||||
|
||||
case kOpenMessage:
|
||||
m_closer = NULL;
|
||||
m_closer = nullptr;
|
||||
break;
|
||||
|
||||
case kCloseMessage:
|
||||
|
@ -364,7 +364,7 @@ bool Window::onProcessMessage(Message* msg)
|
|||
|
||||
if (m_hitTest != HitTestNowhere &&
|
||||
m_hitTest != HitTestClient) {
|
||||
if (clickedWindowPos == NULL)
|
||||
if (clickedWindowPos == nullptr)
|
||||
clickedWindowPos = new gfx::Rect(bounds());
|
||||
else
|
||||
*clickedWindowPos = bounds();
|
||||
|
@ -381,9 +381,9 @@ bool Window::onProcessMessage(Message* msg)
|
|||
releaseMouse();
|
||||
set_mouse_cursor(kArrowCursor);
|
||||
|
||||
if (clickedWindowPos != NULL) {
|
||||
if (clickedWindowPos != nullptr) {
|
||||
delete clickedWindowPos;
|
||||
clickedWindowPos = NULL;
|
||||
clickedWindowPos = nullptr;
|
||||
}
|
||||
|
||||
m_hitTest = HitTestNowhere;
|
||||
|
|
Loading…
Reference in New Issue