/*************************************************************************** form_field.cpp ------------------- begin : Tue Jul 30 2002 copyright : (C) 2002 - 2003 by Roland Riegel email : feedback@roland-riegel.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "form_field.h" #include "window.h" Field::Field( int x, int y, int width, int height ) : m_field(0) { m_field = new_field( height, width, y, x, 0, 0 ); } Field::~Field() { free_field( m_field ); } void Field::setBuffer( const char* new_buffer ) { set_field_buffer( m_field, 0, new_buffer ); } const char* Field::buffer() { return field_buffer( m_field, 0 ); } void Field::move( int x, int y ) { move_field( m_field, y, x ); } void Field::setVisible( bool new_visible ) { set_field_opts( m_field, new_visible ? field_opts( m_field ) | O_VISIBLE : field_opts( m_field ) & ~O_VISIBLE ); } bool Field::visible() { return ( field_opts( m_field ) & O_VISIBLE ) == O_VISIBLE; } void Field::setEnabled( bool new_enabled ) { set_field_opts( m_field, new_enabled ? field_opts( m_field ) | O_ACTIVE : field_opts( m_field ) & ~O_ACTIVE ); } bool Field::enabled() { return ( field_opts( m_field ) & O_ACTIVE ) == O_ACTIVE; } void Field::setIntegerField( int min, int max ) { set_field_type( m_field, TYPE_INTEGER, 0, min, max ); } void Field::setEnumField( const char* elements[] ) { set_field_type( m_field, TYPE_ENUM, elements, false, false ); } void Field::setFixed( bool new_fixed ) { set_field_opts( m_field, new_fixed ? field_opts( m_field ) & ~O_EDIT : field_opts( m_field ) | O_EDIT ); } bool Field::fixed() { return ( field_opts( m_field ) & O_EDIT ) != O_EDIT; } void Field::setBlankWithFirstChar( bool new_blankwithfirstchar ) { set_field_opts( m_field, new_blankwithfirstchar ? field_opts( m_field ) | O_BLANK : field_opts( m_field ) & ~O_BLANK ); } bool Field::blankWithFirstChar() { return ( field_opts( m_field ) & O_BLANK ) == O_BLANK; } void Field::setAutoSkip( bool new_autoskip ) { set_field_opts( m_field, new_autoskip ? field_opts( m_field ) | O_AUTOSKIP : field_opts( m_field ) & ~O_AUTOSKIP ); } bool Field::autoSkip() { return ( field_opts( m_field ) & O_AUTOSKIP ) == O_AUTOSKIP; } void Field::setValidateBlank( bool new_validateblank ) { set_field_opts( m_field, new_validateblank ? field_opts( m_field ) & ~O_NULLOK : field_opts( m_field ) | O_NULLOK ); } bool Field::validateBlank() { return ( field_opts( m_field ) & O_NULLOK ) != O_NULLOK; } void Field::setNewPage( bool new_newpage ) { set_new_page( m_field, new_newpage ); } bool Field::newPage() { return new_page( m_field ); } bool operator==( const Field& field1, const Field& field2 ) { return field1.m_field == field2.m_field; } bool operator==( const Field& field1, const FIELD* field2 ) { return field1.m_field == field2; } Form::Form( Slots* slots ) : m_slots( slots ), m_form(0), m_visible( false ) { m_instances.push_back( this ); } Form::~Form() { for( list