2002-01-21 23:30:43 +03:00
|
|
|
/*=========================================================================
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Program: CMake - Cross-Platform Makefile Generator
|
2002-01-21 23:30:43 +03:00
|
|
|
Module: $RCSfile$
|
|
|
|
Language: C++
|
|
|
|
Date: $Date$
|
|
|
|
Version: $Revision$
|
|
|
|
|
2002-10-24 02:03:27 +04:00
|
|
|
Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
|
|
|
|
See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
|
2002-01-21 23:30:43 +03:00
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE. See the above copyright notices for more information.
|
|
|
|
|
|
|
|
=========================================================================*/
|
2001-11-05 02:05:21 +03:00
|
|
|
#include "cmCursesWidget.h"
|
|
|
|
|
|
|
|
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));
|
|
|
|
field_opts_off(this->Field, O_AUTOSKIP);
|
|
|
|
this->Page = 0;
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
cmCursesWidget::~cmCursesWidget()
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
if (this->Field)
|
2001-11-05 02:05:21 +03:00
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
free_field(this->Field);
|
|
|
|
this->Field = 0;
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmCursesWidget::Move(int x, int y, bool isNewPage)
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
if (!this->Field)
|
2001-11-05 02:05:21 +03:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-16 18:44:55 +03:00
|
|
|
move_field(this->Field, y, x);
|
2001-11-05 02:05:21 +03:00
|
|
|
if (isNewPage)
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
set_new_page(this->Field, TRUE);
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
set_new_page(this->Field, FALSE);
|
2001-11-05 02:05:21 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmCursesWidget::SetValue(const char* value)
|
|
|
|
{
|
2006-03-16 18:44:55 +03:00
|
|
|
this->Value = value;
|
|
|
|
set_field_buffer(this->Field, 0, value);
|
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
|
|
|
}
|