]> git.vomp.tv Git - vompclient.git/commitdiff
WOptionBox CWFs
authorChris Tallon <chris@vomp.tv>
Thu, 7 May 2020 15:13:21 +0000 (16:13 +0100)
committerChris Tallon <chris@vomp.tv>
Thu, 7 May 2020 15:13:21 +0000 (16:13 +0100)
woptionbox.cc

index 9d1316ff8f98fff4fc161cdea1915cf73fe2c03d..bf3fb73a3f6e66e6a6eecbd2fe8c8dd6914da43c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright 2004-2005 Chris Tallon
+    Copyright 2004-2020 Chris Tallon
 
     This file is part of VOMP.
 
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with VOMP; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+    along with VOMP.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-#include "woptionbox.h"
-
 #include "colour.h"
 #include "log.h"
 #ifndef WIN32
 #include "unistd.h"
 #endif
 
+#include "woptionbox.h"
+
 WOptionBox::WOptionBox()
 {
   numOptions = 0;
@@ -97,7 +96,7 @@ void WOptionBox::addOption(const char* takeText)
   int length = strlen(takeText);
   char* newOption = new char[length + 1];
   strcpy(newOption, takeText);
-  options = (char**)realloc(options, (numOptions+1) * sizeof(char*));
+  options = static_cast<char**>(realloc(options, (numOptions+1) * sizeof(char*)));
   options[numOptions] = newOption;
   numOptions++;
   setData();
@@ -188,9 +187,12 @@ void WOptionBox::setSelected(int toSelect)
 
 bool WOptionBox::mouseMove(int x, int y)
 {
-
-  if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
-    && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && !active)
+  if (   (x - getRootBoxOffsetX()) >= 0
+      && (y - getRootBoxOffsetY()) >= 0
+      && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
+      && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+      && !active
+     )
   {
     setActive(1);
     return true;
@@ -201,9 +203,11 @@ bool WOptionBox::mouseMove(int x, int y)
 
 bool WOptionBox::mouseLBDOWN(int x, int y)
 {
-
-  if ((x-getRootBoxOffsetX())>=0 && (y-getRootBoxOffsetY())>=0
-    && (x-getRootBoxOffsetX())<=(int)area.w && (y-getRootBoxOffsetY())<=(int)area.h && active)
+  if (   (x - getRootBoxOffsetX()) >= 0
+      && (y - getRootBoxOffsetY()) >= 0
+      && (x - getRootBoxOffsetX()) <= static_cast<int>(area.w)
+      && (y - getRootBoxOffsetY()) <= static_cast<int>(area.h)
+      && active)
   {
     return true;
   }