2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2002-01-21 23:30:43 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2002-01-21 23:30:43 +03:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2001-11-05 02:05:21 +03:00
|
|
|
#include "cmCursesWidget.h"
|
|
|
|
|
2016-09-01 22:55:09 +03:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2001-11-05 02:05:21 +03:00
|
|
|
cmCursesWidget::cmCursesWidget(int width, int height, int left, int top)
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
this->Field = new_field(height, width, top, left, 0, 0);
|
|
|
|
set_field_userptr(this->Field, reinterpret_cast<char*>(this));
|
2016-05-16 17:34:04 +03:00
|
|
|
field_opts_off(this->Field, O_AUTOSKIP);
|
2006-03-16 18:44:55 +03:00
|
|
|
this->Page = 0;
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
cmCursesWidget::~cmCursesWidget()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->Field) {
|
2006-03-16 18:44:55 +03:00
|
|
|
free_field(this->Field);
|
2016-06-27 23:44:16 +03:00
|
|
|
this->Field = CM_NULLPTR;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmCursesWidget::Move(int x, int y, bool isNewPage)
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->Field) {
|
2001-11-05 02:05:21 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2001-11-05 02:05:21 +03:00
|
|
|
|
2006-03-16 18:44:55 +03:00
|
|
|
move_field(this->Field, y, x);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (isNewPage) {
|
2006-03-16 18:44:55 +03:00
|
|
|
set_new_page(this->Field, TRUE);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2006-03-16 18:44:55 +03:00
|
|
|
set_new_page(this->Field, FALSE);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
|
2014-02-22 04:05:55 +04:00
|
|
|
void cmCursesWidget::SetValue(const std::string& value)
|
2001-11-05 02:05:21 +03:00
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
this->Value = value;
|
2016-05-16 17:34:04 +03:00
|
|
|
set_field_buffer(this->Field, 0, const_cast<char*>(value.c_str()));
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
const char* cmCursesWidget::GetValue()
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
return this->Value.c_str();
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|