コード例 #1
0
ファイル: inputtext.cpp プロジェクト: nicrohobak/AnsiGL
	void InputText::Clear()
	{
		_Input->Clear();
		_Cursor->MoveTo( Point2D(0, _Layout->Height() - 1) );
		_CurColor = achar();
		setCursorColor();
		this->Format();
	}
コード例 #2
0
int GraphView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = CommonView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 6)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 6;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< GraphWidget::Orientation*>(_v) = orientation(); break;
        case 1: *reinterpret_cast< GraphWidget::Mode*>(_v) = mode(); break;
        case 2: *reinterpret_cast< int*>(_v) = timeLinesCount(); break;
        case 3: *reinterpret_cast< int*>(_v) = valueLinesCount(); break;
        case 4: *reinterpret_cast< QColor*>(_v) = cursorColor(); break;
        case 5: *reinterpret_cast< QColor*>(_v) = linesColor(); break;
        case 6: *reinterpret_cast< QColor*>(_v) = textColor(); break;
        case 7: *reinterpret_cast< QColor*>(_v) = backColor(); break;
        case 8: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 9: *reinterpret_cast< Plots*>(_v) = plots(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setOrientation(*reinterpret_cast< GraphWidget::Orientation*>(_v)); break;
        case 1: setMode(*reinterpret_cast< GraphWidget::Mode*>(_v)); break;
        case 2: setTimeLinesCount(*reinterpret_cast< int*>(_v)); break;
        case 3: setValueLinesCount(*reinterpret_cast< int*>(_v)); break;
        case 4: setCursorColor(*reinterpret_cast< QColor*>(_v)); break;
        case 5: setLinesColor(*reinterpret_cast< QColor*>(_v)); break;
        case 6: setTextColor(*reinterpret_cast< QColor*>(_v)); break;
        case 7: setBackColor(*reinterpret_cast< QColor*>(_v)); break;
        case 8: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 9: setPlots(*reinterpret_cast< Plots*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #3
0
ファイル: window.cpp プロジェクト: kylelk/warpdriveoverload
ncursesWindow::ncursesWindow(int height, int length, int ypos, int xpos) : m_height(height), m_length(length), m_ypos(ypos), m_xpos(xpos)
{
    
    m_window = newwin(height, length, ypos, xpos);
    m_border = _SharedPtr<winBorder>(new winBorder);
    setborder('|', '|', '=', '=', '+', '+', '+', '+');
    
    
    init_pair(1, COLOR_GREEN, COLOR_BLACK); // A default Background Color
    setBGColor(COLOR_BLACK);
    setFGColor(COLOR_GREEN);
    setNormalColor(1);
    
    init_pair(2, COLOR_BLUE, COLOR_BLACK); // A default Background Color
    setCursorColor(2);
    
    init_pair(3, COLOR_RED, COLOR_BLACK); // A default Background Color
    setSelectedColor(3);
    
    init_pair(4, COLOR_RED, COLOR_BLACK); // A default Background Color
    setBorderColor(4);
    
}
コード例 #4
0
ファイル: inputtext.cpp プロジェクト: nicrohobak/AnsiGL
	void InputText::InputChar( const achar &ch )
	{
		if ( !_Enabled )
			return;

		char Glyph = ch.Glyph().c_str()[0];
		achar NewCh = ch;
		NewCh.Color = _CurColor.Color;

		// Skip unprintables (TODO: Fix me(?).  This probably breaks unicode.)
		if ( Glyph < 32 || Glyph > 127 )
			return;

		// Special buffering for color sequences
		if ( _CaptureColor )
		{
			// Sacrificing the switch for flexibility
			if ( Glyph == 8
			  || Glyph == 127 )
			{
				_Input->pop_back();
				_ColorBuffer.pop_back();
				--_RemoveChars;

				if ( _ColorBuffer.empty() )
				{
					_CaptureColor = false;
					_CaptureColorList = false;
					_RemoveChars = 0;
				}

				this->Format();
			}
			// If we try to terminate the color too early, just cancel the color altogether
			else if ( Glyph == '\n' )
			{
				CancelColorCapture();
			}
			else if ( _ColorCodes && Glyph == _ColorCodes[ColorCode_List_Start] )
			{
				_ColorBuffer.push_back( Glyph );
				_CaptureColorList = true;

				// Update our UI, and make note that we should remove this character later
				*_Input << Glyph;
				++_RemoveChars;
				this->Format();
			}
			else if ( _ColorCodes && Glyph == _ColorCodes[ColorCode_List_End] )
			{
				_ColorBuffer.push_back( Glyph );

				achar ColorCh( _ColorBuffer );
				_CurColor.Color = ColorCh.Color;
				setCursorColor();

				CancelColorCapture();
			}
			else
			{
				_ColorBuffer.push_back( Glyph );

				if ( _CaptureColorList )
				{
					// Update our UI, and make note that we should remove this character later
					*_Input << Glyph;
					++_RemoveChars;
					this->Format();
				}

				achar ColorCh( _ColorBuffer, _CurColor, _ColorCodes );
				_CurColor.Color = ColorCh.Color;
				setCursorColor();

				CancelColorCapture();
			}

			return;
		}

		// Sacrificing the switch for flexibility
		// Backspace / delete
		if ( Glyph == 8
		  || Glyph == 127 )
		{
			_Input->pop_back();
		}
		// Color code handling
		else if ( _ColorCodes && Glyph == _ColorCodes[ColorCode_Escape] )
		{
			_ColorBuffer.push_back( _ColorCodes[ColorCode_Escape] );
			NewCh.Color.Clear();
			*_Input << NewCh;
			++_RemoveChars;
			_CaptureColor = true;
		}
		else
			*_Input << NewCh;

		this->Format();
	}