/*
- 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;
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();
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;
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;
}