From 933d316dc462b24c43b89ba95519d6612708abc1 Mon Sep 17 00:00:00 2001 From: young40 Date: Sun, 3 Mar 2013 18:58:51 +0800 Subject: [PATCH 1/3] add setVisible() to CCEditBox [ios & mac] --- extensions/GUI/CCEditBox/CCEditBox.cpp | 9 +++++++++ extensions/GUI/CCEditBox/CCEditBox.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImpl.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplIOS.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm | 5 +++++ extensions/GUI/CCEditBox/CCEditBoxImplMac.h | 1 + extensions/GUI/CCEditBox/CCEditBoxImplMac.mm | 5 +++++ 7 files changed, 23 insertions(+) diff --git a/extensions/GUI/CCEditBox/CCEditBox.cpp b/extensions/GUI/CCEditBox/CCEditBox.cpp index 8e17e203b9..92d99375ce 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.cpp +++ b/extensions/GUI/CCEditBox/CCEditBox.cpp @@ -232,6 +232,15 @@ void CCEditBox::setPosition(const CCPoint& pos) } } +void CCEditBox::setVisible(bool visible) +{ + CCControlButton::setVisible(visible); + if (m_pEditBoxImpl != NULL) + { + m_pEditBoxImpl->setVisible(visible); + } +} + void CCEditBox::setContentSize(const CCSize& size) { CCControlButton::setContentSize(size); diff --git a/extensions/GUI/CCEditBox/CCEditBox.h b/extensions/GUI/CCEditBox/CCEditBox.h index b25437a918..56ee396026 100644 --- a/extensions/GUI/CCEditBox/CCEditBox.h +++ b/extensions/GUI/CCEditBox/CCEditBox.h @@ -286,6 +286,7 @@ public: /* override functions */ virtual void setPosition(const CCPoint& pos); + virtual void setVisible(bool visible); virtual void setContentSize(const CCSize& size); virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImpl.h b/extensions/GUI/CCEditBox/CCEditBoxImpl.h index 950579333c..e0b2073441 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImpl.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImpl.h @@ -60,6 +60,7 @@ public: virtual void closeKeyboard() = 0; virtual void setPosition(const CCPoint& pos) = 0; + virtual void setVisible(bool visible) = 0; virtual void setContentSize(const CCSize& size) = 0; virtual void setAnchorPoint(const CCPoint& anchorPoint) = 0; virtual void visit(void) = 0; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h index 8a70af58fa..daac661abd 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.h @@ -89,6 +89,7 @@ public: virtual const char* getText(void); virtual void setPlaceHolder(const char* pText); virtual void setPosition(const CCPoint& pos); + virtual void setVisible(bool visible); virtual void setContentSize(const CCSize& size); virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 9c1ba6cc6b..ac1cc1dbc3 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -412,6 +412,11 @@ void CCEditBoxImplIOS::setPosition(const CCPoint& pos) } } +void CCEditBoxImplIOS::setVisible(bool visible) +{ + m_systemControl.textField.hidden = !visible; +} + void CCEditBoxImplIOS::setContentSize(const CCSize& size) { m_tContentSize = size; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h index 23f0fcc6ab..932d44df1e 100755 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.h @@ -89,6 +89,7 @@ public: virtual const char* getText(void); virtual void setPlaceHolder(const char* pText); virtual void setPosition(const CCPoint& pos); + virtual void setVisible(bool visible); virtual void setContentSize(const CCSize& size); virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void); diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 959bb515a7..f75b835f0d 100755 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -345,6 +345,11 @@ void CCEditBoxImplMac::setPosition(const CCPoint& pos) } +void CCEditBoxImplMac::setVisible(bool visible) +{ + [GET_IMPL.textField setHidden:!visible]; +} + void CCEditBoxImplMac::setContentSize(const CCSize& size) { m_tContentSize = size; From 882a6761b6d62eb29a775142bb1bc677e4091bae Mon Sep 17 00:00:00 2001 From: young40 Date: Sun, 3 Mar 2013 20:08:50 +0800 Subject: [PATCH 2/3] add setVisible() to CCEditBox [Android] --- extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp | 5 +++++ extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h | 1 + 2 files changed, 6 insertions(+) diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp index d5dfde8cf6..925558cf61 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.cpp @@ -209,6 +209,11 @@ void CCEditBoxImplAndroid::setPosition(const CCPoint& pos) } +void CCEditBoxImplAndroid::setVisible(bool visible) +{ // don't need to be implemented on android platform. + +} + void CCEditBoxImplAndroid::setContentSize(const CCSize& size) { // don't need to be implemented on android platform. diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h index 7dea554800..988dcd82bb 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplAndroid.h @@ -59,6 +59,7 @@ public: virtual const char* getText(void); virtual void setPlaceHolder(const char* pText); virtual void setPosition(const CCPoint& pos); + virtual void setVisible(bool visible); virtual void setContentSize(const CCSize& size); virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void); From 43e791746340ce07bf0e6c45eac27ed57970f234 Mon Sep 17 00:00:00 2001 From: young40 Date: Sun, 3 Mar 2013 20:13:22 +0800 Subject: [PATCH 3/3] add setVisible() to CCEditBox [Win32] --- extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp | 4 ++++ extensions/GUI/CCEditBox/CCEditBoxImplWin.h | 1 + 2 files changed, 5 insertions(+) mode change 100644 => 100755 extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp mode change 100644 => 100755 extensions/GUI/CCEditBox/CCEditBoxImplWin.h diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp old mode 100644 new mode 100755 index 118ddc40c7..b6fe85c2d9 --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.cpp @@ -206,6 +206,10 @@ void CCEditBoxImplWin::setPosition(const CCPoint& pos) //m_pLabelPlaceHolder->setPosition(pos); } +void CCEditBoxImplWin::setVisible(bool visible) +{ // don't need to be implemented on win32 platform. +} + void CCEditBoxImplWin::setContentSize(const CCSize& size) { } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h old mode 100644 new mode 100755 index c4f7d316d9..a61b121ebc --- a/extensions/GUI/CCEditBox/CCEditBoxImplWin.h +++ b/extensions/GUI/CCEditBox/CCEditBoxImplWin.h @@ -59,6 +59,7 @@ public: virtual const char* getText(void); virtual void setPlaceHolder(const char* pText); virtual void setPosition(const CCPoint& pos); + virtual void setVisible(bool visible); virtual void setContentSize(const CCSize& size); virtual void setAnchorPoint(const CCPoint& anchorPoint); virtual void visit(void);