summaryrefslogtreecommitdiff
path: root/src/guichan/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-07 19:34:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-07 19:34:52 +0300
commit9e83411f7e4147d09af5a5006888dcc187ea0ef8 (patch)
treec084bdf8afabc6220779645dcb5dbf71af6a151f /src/guichan/widgets
parentbc7d91cc0c9c0f6dcad01d612932c6899afb5514 (diff)
downloadmv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.gz
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.bz2
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.tar.xz
mv-9e83411f7e4147d09af5a5006888dcc187ea0ef8.zip
Fix some warnings under gcc 4.7.
Diffstat (limited to 'src/guichan/widgets')
-rw-r--r--src/guichan/widgets/dropdown.cpp16
-rw-r--r--src/guichan/widgets/icon.cpp8
-rw-r--r--src/guichan/widgets/imagebutton.cpp8
-rw-r--r--src/guichan/widgets/listbox.cpp8
-rw-r--r--src/guichan/widgets/scrollarea.cpp14
-rw-r--r--src/guichan/widgets/tab.cpp6
-rw-r--r--src/guichan/widgets/tabbedarea.cpp16
-rw-r--r--src/guichan/widgets/textbox.cpp4
-rw-r--r--src/guichan/widgets/window.cpp2
9 files changed, 41 insertions, 41 deletions
diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp
index 3ecbd75d8..17513931f 100644
--- a/src/guichan/widgets/dropdown.cpp
+++ b/src/guichan/widgets/dropdown.cpp
@@ -68,8 +68,8 @@ namespace gcn
setInternalFocusHandler(&mInternalFocusHandler);
- mInternalScrollArea = (scrollArea == NULL);
- mInternalListBox = (listBox == NULL);
+ mInternalScrollArea = (!scrollArea);
+ mInternalListBox = (!listBox);
if (mInternalScrollArea)
mScrollArea = new ScrollArea();
@@ -110,16 +110,16 @@ namespace gcn
if (mInternalScrollArea)
{
delete mScrollArea;
- mScrollArea = 0;
+ mScrollArea = nullptr;
}
if (mInternalListBox)
{
delete mListBox;
- mListBox = 0;
+ mListBox = nullptr;
}
- setInternalFocusHandler(NULL);
+ setInternalFocusHandler(nullptr);
}
int DropDown::getSelected() const
@@ -223,10 +223,10 @@ namespace gcn
void DropDown::adjustHeight()
{
- if (mScrollArea == NULL)
+ if (!mScrollArea)
throw GCN_EXCEPTION("Scroll area has been deleted.");
- if (mListBox == NULL)
+ if (!mListBox)
throw GCN_EXCEPTION("List box has been deleted.");
int listBoxHeight = mListBox->getHeight();
@@ -296,7 +296,7 @@ namespace gcn
void DropDown::death(const Event& event)
{
if (event.getSource() == mScrollArea)
- mScrollArea = NULL;
+ mScrollArea = nullptr;
BasicContainer::death(event);
}
diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp
index 2983c7c29..13a9f1309 100644
--- a/src/guichan/widgets/icon.cpp
+++ b/src/guichan/widgets/icon.cpp
@@ -56,14 +56,14 @@
namespace gcn
{
Icon::Icon()
- : mImage(0)
+ : mImage(nullptr)
, mInternalImage(false)
{
setSize(0, 0);
}
Icon::Icon(const std::string& filename)
- : mImage(0),
+ : mImage(nullptr),
mInternalImage(false)
{
mImage = Image::load(filename);
@@ -85,7 +85,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -107,7 +107,7 @@ namespace gcn
void Icon::draw(Graphics* graphics)
{
- if (mImage != NULL)
+ if (mImage)
{
const int x = (getWidth() - mImage->getWidth()) / 2;
const int y = (getHeight() - mImage->getHeight()) / 2;
diff --git a/src/guichan/widgets/imagebutton.cpp b/src/guichan/widgets/imagebutton.cpp
index 2f4c5dcde..feeed795d 100644
--- a/src/guichan/widgets/imagebutton.cpp
+++ b/src/guichan/widgets/imagebutton.cpp
@@ -55,7 +55,7 @@
namespace gcn
{
ImageButton::ImageButton() :
- mImage(0),
+ mImage(nullptr),
mInternalImage(false)
{
setWidth(0);
@@ -63,7 +63,7 @@ namespace gcn
}
ImageButton::ImageButton(const std::string& filename) :
- mImage(0),
+ mImage(nullptr),
mInternalImage(false)
{
mImage = Image::load(filename);
@@ -85,7 +85,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
}
@@ -94,7 +94,7 @@ namespace gcn
if (mInternalImage)
{
delete mImage;
- mImage = 0;
+ mImage = nullptr;
}
mImage = image;
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index 95f04fc68..80989cc72 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -61,7 +61,7 @@ namespace gcn
{
ListBox::ListBox() :
mSelected(-1),
- mListModel(NULL),
+ mListModel(nullptr),
mWrappingEnabled(false)
{
setWidth(100);
@@ -88,7 +88,7 @@ namespace gcn
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
- if (mListModel == NULL)
+ if (!mListModel)
return;
graphics->setColor(getForegroundColor());
@@ -161,7 +161,7 @@ namespace gcn
void ListBox::setSelected(int selected)
{
- if (mListModel == NULL)
+ if (!mListModel)
{
mSelected = -1;
}
@@ -286,7 +286,7 @@ namespace gcn
void ListBox::adjustSize()
{
- if (mListModel != NULL)
+ if (mListModel)
setHeight(getRowHeight() * mListModel->getNumberOfElements());
}
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index 7dc7566c0..574308b7c 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -138,12 +138,12 @@ namespace gcn
ScrollArea::~ScrollArea()
{
- setContent(NULL);
+ setContent(nullptr);
}
void ScrollArea::setContent(Widget* widget)
{
- if (widget != NULL)
+ if (widget)
{
clear();
add(widget);
@@ -162,7 +162,7 @@ namespace gcn
if (!mWidgets.empty())
return *mWidgets.begin();
- return NULL;
+ return nullptr;
}
void ScrollArea::setHorizontalScrollPolicy(ScrollPolicy hPolicy)
@@ -240,7 +240,7 @@ namespace gcn
{
checkPolicies();
- if (getContent() == NULL)
+ if (!getContent())
return 0;
int value = getContent()->getWidth() - getChildrenArea().width +
@@ -256,7 +256,7 @@ namespace gcn
{
checkPolicies();
- if (getContent() == NULL)
+ if (!getContent())
return 0;
int value;
@@ -790,7 +790,7 @@ namespace gcn
setVerticalScrollAmount(getVerticalScrollAmount());
setHorizontalScrollAmount(getHorizontalScrollAmount());
- if (getContent() != NULL)
+ if (getContent())
{
getContent()->setPosition(-mHScroll + getContent()->getFrameSize(),
-mVScroll + getContent()->getFrameSize());
@@ -1126,7 +1126,7 @@ namespace gcn
if (getChildrenArea().isPointInRect(x, y))
return getContent();
- return NULL;
+ return nullptr;
}
void ScrollArea::mouseWheelMovedUp(MouseEvent& mouseEvent)
diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp
index 9b7424748..768e2c695 100644
--- a/src/guichan/widgets/tab.cpp
+++ b/src/guichan/widgets/tab.cpp
@@ -59,7 +59,7 @@ namespace gcn
{
Tab::Tab() :
mHasMouse(false),
- mTabbedArea(NULL)
+ mTabbedArea(nullptr)
{
mLabel = new Label();
mLabel->setPosition(4, 4);
@@ -71,7 +71,7 @@ namespace gcn
Tab::~Tab()
{
delete mLabel;
- mLabel = 0;
+ mLabel = nullptr;
}
void Tab::adjustSize()
@@ -79,7 +79,7 @@ namespace gcn
setSize(mLabel->getWidth() + 8,
mLabel->getHeight() + 8);
- if (mTabbedArea != NULL)
+ if (mTabbedArea)
mTabbedArea->adjustTabPositions();
}
diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp
index 3c556eeca..4ee164778 100644
--- a/src/guichan/widgets/tabbedarea.cpp
+++ b/src/guichan/widgets/tabbedarea.cpp
@@ -62,7 +62,7 @@
namespace gcn
{
TabbedArea::TabbedArea() :
- mSelectedTab(NULL),
+ mSelectedTab(nullptr),
mOpaque(false)
{
setFocusable(true);
@@ -83,14 +83,14 @@ namespace gcn
remove(mWidgetContainer);
delete mTabContainer;
- mTabContainer = 0;
+ mTabContainer = nullptr;
delete mWidgetContainer;
- mWidgetContainer = 0;
+ mWidgetContainer = nullptr;
for (unsigned int i = 0; i < mTabsToDelete.size(); i++)
{
delete mTabsToDelete[i];
- mTabsToDelete[i] = 0;
+ mTabsToDelete[i] = nullptr;
}
}
@@ -102,7 +102,7 @@ namespace gcn
mTabContainer->add(tab);
mTabs.push_back(std::pair<Tab*, Widget*>(tab, widget));
- if (mSelectedTab == NULL)
+ if (!mSelectedTab)
setSelectedTab(tab);
adjustTabPositions();
@@ -224,7 +224,7 @@ namespace gcn
// If a tab is selected, remove the line right underneath
// the selected tab.
- if (mSelectedTab != NULL)
+ if (mSelectedTab)
{
graphics->setColor(getBaseColor());
graphics->drawLine(mSelectedTab->getX() + 1,
@@ -332,7 +332,7 @@ namespace gcn
{
Tab* tab = dynamic_cast<Tab*>(event.getSource());
- if (tab != NULL)
+ if (tab)
removeTab(tab);
else
BasicContainer::death(event);
@@ -343,7 +343,7 @@ namespace gcn
Widget* source = actionEvent.getSource();
Tab* tab = dynamic_cast<Tab*>(source);
- if (tab == NULL)
+ if (!tab)
{
throw GCN_EXCEPTION("Received an action from a "
"widget that's not a tab!");
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 35fbf5437..7b5b03ab8 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -270,7 +270,7 @@ namespace gcn
{
Widget* par = getParent();
- if (par != NULL)
+ if (par)
{
int rowsPerPage = par->getChildrenArea().height
/ getFont()->getHeight();
@@ -284,7 +284,7 @@ namespace gcn
{
Widget* par = getParent();
- if (par != NULL)
+ if (par)
{
int rowsPerPage = par->getChildrenArea().height
/ getFont()->getHeight();
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index 550b23749..1c46b2283 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -130,7 +130,7 @@ namespace gcn
if (mouseEvent.getSource() != this)
return;
- if (getParent() != NULL)
+ if (getParent())
getParent()->moveToTop(this);
mDragOffsetX = mouseEvent.getX();