diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-06 00:04:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-06 00:04:33 +0300 |
commit | 7b155f111daf5d7ae477b16d0f0789b1113bea74 (patch) | |
tree | 2d2711ab1f9daed793171383af1a7e1fa6ff737c /src/guichan/widgets | |
parent | c3afff20d4989ab2835545715bbe67e5b5d9b353 (diff) | |
download | manaverse-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.gz manaverse-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.bz2 manaverse-7b155f111daf5d7ae477b16d0f0789b1113bea74.tar.xz manaverse-7b155f111daf5d7ae477b16d0f0789b1113bea74.zip |
Fix some issues after auto checking.
Diffstat (limited to 'src/guichan/widgets')
-rw-r--r-- | src/guichan/widgets/container.cpp | 4 | ||||
-rw-r--r-- | src/guichan/widgets/icon.cpp | 6 | ||||
-rw-r--r-- | src/guichan/widgets/label.cpp | 10 | ||||
-rw-r--r-- | src/guichan/widgets/radiobutton.cpp | 2 | ||||
-rw-r--r-- | src/guichan/widgets/scrollarea.cpp | 129 | ||||
-rw-r--r-- | src/guichan/widgets/slider.cpp | 20 | ||||
-rw-r--r-- | src/guichan/widgets/tab.cpp | 2 | ||||
-rw-r--r-- | src/guichan/widgets/textbox.cpp | 24 | ||||
-rw-r--r-- | src/guichan/widgets/textfield.cpp | 16 |
9 files changed, 98 insertions, 115 deletions
diff --git a/src/guichan/widgets/container.cpp b/src/guichan/widgets/container.cpp index b3edc0bcb..d6951f06a 100644 --- a/src/guichan/widgets/container.cpp +++ b/src/guichan/widgets/container.cpp @@ -56,9 +56,9 @@ namespace gcn { - Container::Container() + Container::Container() : + mOpaque(true) { - mOpaque = true; } Container::~Container() diff --git a/src/guichan/widgets/icon.cpp b/src/guichan/widgets/icon.cpp index d3d4d65ff..26139716d 100644 --- a/src/guichan/widgets/icon.cpp +++ b/src/guichan/widgets/icon.cpp @@ -64,11 +64,9 @@ namespace gcn } Icon::Icon(const std::string& filename) : - mImage(nullptr), - mInternalImage(false) + mImage(Image::load(filename)), + mInternalImage(true) { - mImage = Image::load(filename); - mInternalImage = true; setSize(mImage->getWidth(), mImage->getHeight()); } diff --git a/src/guichan/widgets/label.cpp b/src/guichan/widgets/label.cpp index 03ca04576..3e0eecb3c 100644 --- a/src/guichan/widgets/label.cpp +++ b/src/guichan/widgets/label.cpp @@ -56,16 +56,14 @@ namespace gcn { - Label::Label() + Label::Label() : mAlignment(Graphics::LEFT) { - mAlignment = Graphics::LEFT; } - Label::Label(const std::string& caption) + Label::Label(const std::string& caption) : + mCaption(caption), + mAlignment(Graphics::LEFT) { - mCaption = caption; - mAlignment = Graphics::LEFT; - setWidth(getFont()->getWidth(caption)); setHeight(getFont()->getHeight()); } diff --git a/src/guichan/widgets/radiobutton.cpp b/src/guichan/widgets/radiobutton.cpp index 7811ea558..c5c0b1ebd 100644 --- a/src/guichan/widgets/radiobutton.cpp +++ b/src/guichan/widgets/radiobutton.cpp @@ -123,7 +123,7 @@ namespace gcn return mCaption; } - void RadioButton::setCaption(const std::string caption) + void RadioButton::setCaption(const std::string &caption) { mCaption = caption; } diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp index 21f7b5930..a9d84dd98 100644 --- a/src/guichan/widgets/scrollarea.cpp +++ b/src/guichan/widgets/scrollarea.cpp @@ -55,84 +55,81 @@ namespace gcn { - ScrollArea::ScrollArea() + ScrollArea::ScrollArea() : + mVScroll(0), + mHScroll(0), + mScrollbarWidth(12), + mHPolicy(SHOW_AUTO), + mVPolicy(SHOW_AUTO), + mVBarVisible(false), + mHBarVisible(false), + mUpButtonPressed(false), + mDownButtonPressed(false), + mLeftButtonPressed(false), + mRightButtonPressed(false), + mUpButtonScrollAmount(10), + mDownButtonScrollAmount(10), + mLeftButtonScrollAmount(10), + mRightButtonScrollAmount(10), + mIsVerticalMarkerDragged(false), + mIsHorizontalMarkerDragged(false), + mHorizontalMarkerDragOffset(0), + mVerticalMarkerDragOffset(0), + mOpaque(true) { - mVScroll = 0; - mHScroll = 0; - mHPolicy = SHOW_AUTO; - mVPolicy = SHOW_AUTO; - mVBarVisible = false; - mHBarVisible = false; - mScrollbarWidth = 12; - mUpButtonPressed = false; - mDownButtonPressed = false; - mLeftButtonPressed = false; - mRightButtonPressed = false; - mUpButtonScrollAmount = 10; - mDownButtonScrollAmount = 10; - mLeftButtonScrollAmount = 10; - mRightButtonScrollAmount = 10; - mIsVerticalMarkerDragged = false; - mIsHorizontalMarkerDragged = false; - mHorizontalMarkerDragOffset = 0; - mVerticalMarkerDragOffset = 0; - mOpaque = true; - addMouseListener(this); } - ScrollArea::ScrollArea(Widget *content) + ScrollArea::ScrollArea(Widget *content) : + mVScroll(0), + mHScroll(0), + mScrollbarWidth(12), + mHPolicy(SHOW_AUTO), + mVPolicy(SHOW_AUTO), + mVBarVisible(false), + mHBarVisible(false), + mUpButtonPressed(false), + mDownButtonPressed(false), + mLeftButtonPressed(false), + mRightButtonPressed(false), + mUpButtonScrollAmount(10), + mDownButtonScrollAmount(10), + mLeftButtonScrollAmount(10), + mRightButtonScrollAmount(10), + mIsVerticalMarkerDragged(false), + mIsHorizontalMarkerDragged(false), + mHorizontalMarkerDragOffset(0), + mVerticalMarkerDragOffset(0), + mOpaque(true) { - mVScroll = 0; - mHScroll = 0; - mHPolicy = SHOW_AUTO; - mVPolicy = SHOW_AUTO; - mVBarVisible = false; - mHBarVisible = false; - mScrollbarWidth = 12; - mUpButtonPressed = false; - mDownButtonPressed = false; - mLeftButtonPressed = false; - mRightButtonPressed = false; - mUpButtonScrollAmount = 10; - mDownButtonScrollAmount = 10; - mLeftButtonScrollAmount = 10; - mRightButtonScrollAmount = 10; - mIsVerticalMarkerDragged = false; - mIsHorizontalMarkerDragged = false; - mHorizontalMarkerDragOffset = 0; - mVerticalMarkerDragOffset = 0; - mOpaque = true; - setContent(content); addMouseListener(this); } ScrollArea::ScrollArea(Widget *content, ScrollPolicy hPolicy, - ScrollPolicy vPolicy) + ScrollPolicy vPolicy) : + mVScroll(0), + mHScroll(0), + mScrollbarWidth(12), + mHPolicy(hPolicy), + mVPolicy(vPolicy), + mVBarVisible(false), + mHBarVisible(false), + mUpButtonPressed(false), + mDownButtonPressed(false), + mLeftButtonPressed(false), + mRightButtonPressed(false), + mUpButtonScrollAmount(10), + mDownButtonScrollAmount(10), + mLeftButtonScrollAmount(10), + mRightButtonScrollAmount(10), + mIsVerticalMarkerDragged(false), + mIsHorizontalMarkerDragged(false), + mHorizontalMarkerDragOffset(0), + mVerticalMarkerDragOffset(0), + mOpaque(true) { - mVScroll = 0; - mHScroll = 0; - mHPolicy = hPolicy; - mVPolicy = vPolicy; - mScrollbarWidth = 12; - mVBarVisible = false; - mHBarVisible = false; - mUpButtonPressed = false; - mDownButtonPressed = false; - mLeftButtonPressed = false; - mRightButtonPressed = false; - mUpButtonScrollAmount = 10; - mDownButtonScrollAmount = 10; - mLeftButtonScrollAmount = 10; - mRightButtonScrollAmount = 10; - mIsVerticalMarkerDragged = false; - mIsHorizontalMarkerDragged = false; - mHorizontalMarkerDragOffset = 0; - mVerticalMarkerDragOffset = 0; - mOpaque = true; - setContent(content); addMouseListener(this); } diff --git a/src/guichan/widgets/slider.cpp b/src/guichan/widgets/slider.cpp index d7e8084cc..189ee6e7b 100644 --- a/src/guichan/widgets/slider.cpp +++ b/src/guichan/widgets/slider.cpp @@ -56,13 +56,11 @@ namespace gcn { - Slider::Slider(double scaleEnd) + Slider::Slider(double scaleEnd) : + mDragged(false), + mScaleStart(0), + mScaleEnd(scaleEnd) { - mDragged = false; - - mScaleStart = 0; - mScaleEnd = scaleEnd; - setFocusable(true); setFrameSize(1); setOrientation(HORIZONTAL); @@ -74,13 +72,11 @@ namespace gcn addKeyListener(this); } - Slider::Slider(double scaleStart, double scaleEnd) + Slider::Slider(double scaleStart, double scaleEnd) : + mDragged(false), + mScaleStart(scaleStart), + mScaleEnd(scaleEnd) { - mDragged = false; - - mScaleStart = scaleStart; - mScaleEnd = scaleEnd; - setFocusable(true); setFrameSize(1); setOrientation(HORIZONTAL); diff --git a/src/guichan/widgets/tab.cpp b/src/guichan/widgets/tab.cpp index 8afc248c5..fa70f1e08 100644 --- a/src/guichan/widgets/tab.cpp +++ b/src/guichan/widgets/tab.cpp @@ -59,10 +59,10 @@ namespace gcn { Tab::Tab() : + mLabel(new Label()), mHasMouse(false), mTabbedArea(nullptr) { - mLabel = new Label(); mLabel->setPosition(4, 4); add(mLabel); diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp index 44fb5d718..fc133ba9b 100644 --- a/src/guichan/widgets/textbox.cpp +++ b/src/guichan/widgets/textbox.cpp @@ -58,15 +58,13 @@ namespace gcn { - TextBox::TextBox() + TextBox::TextBox() : + mCaretColumn(0), + mCaretRow(0), + mEditable(true), + mOpaque(true) { - mCaretColumn = 0; - mCaretRow = 0; - mEditable = true; - mOpaque = true; - setText(""); - setFocusable(true); addMouseListener(this); @@ -74,15 +72,13 @@ namespace gcn adjustSize(); } - TextBox::TextBox(const std::string& text) + TextBox::TextBox(const std::string& text) : + mCaretColumn(0), + mCaretRow(0), + mEditable(true), + mOpaque(true) { - mCaretColumn = 0; - mCaretRow = 0; - mEditable = true; - mOpaque = true; - setText(text); - setFocusable(true); addMouseListener(this); diff --git a/src/guichan/widgets/textfield.cpp b/src/guichan/widgets/textfield.cpp index c0e89cf1c..b23722cc4 100644 --- a/src/guichan/widgets/textfield.cpp +++ b/src/guichan/widgets/textfield.cpp @@ -57,23 +57,21 @@ namespace gcn { - TextField::TextField() + TextField::TextField() : + mCaretPosition(0), + mXScroll(0) { - mCaretPosition = 0; - mXScroll = 0; - setFocusable(true); addMouseListener(this); addKeyListener(this); } - TextField::TextField(const std::string& text) + TextField::TextField(const std::string& text) : + mText(text), + mCaretPosition(0), + mXScroll(0) { - mCaretPosition = 0; - mXScroll = 0; - - mText = text; adjustSize(); setFocusable(true); |