Пример #1
0
TextBuffer::TextBuffer(int texttype)
  : file (File::nonexistent),
    flags (0),
    prev (0),
    thisid (0),
    matchpos (-1)
{
  // set syntax right away since commands manager needs this
  // information for adding commands
  isfms = (texttype == TextIDs::Fomus);
  setSyntax(texttype);
  Preferences* prefs=Preferences::getInstance();
  manager=new ApplicationCommandManager();
  setFont(Font(Font::getDefaultMonospacedFontName(),
	        (float)prefs->getIntProp(T("EditorFontSize"), 16),
	        Font::plain));
  if (prefs->getBoolProp("EditorEmacsMode", false))
    setFlag(EditFlags::EmacsMode);
  addKeyListener(manager->getKeyMappings());
  addKeyListener(CommandManager::getInstance()->getKeyMappings());
  manager->registerAllCommandsForTarget(this);
  setWantsKeyboardFocus(true);
  setMultiLine(true);
  setReturnKeyStartsNewLine(true);
  setCaretPosition(0);
  setVisible(true);
  // add callback for registering changes.
  //addListener(&listener); 
}
Пример #2
0
void CGUIEditBox::setPasswordBox(bool passwordBox, wchar_t passwordChar)
{
    PasswordBox = passwordBox;
    if (PasswordBox)
    {
        PasswordChar = passwordChar;
        setMultiLine(false);
        setWordWrap(false);
        BrokenText.clear();
    }
}
Пример #3
0
    AlertTextComp (const String& message,
                   const Font& font)
    {
        setReadOnly (true);
        setMultiLine (true, true);
        setCaretVisible (false);
        setScrollbarsShown (true);
        lookAndFeelChanged();
        setWantsKeyboardFocus (false);

        setFont (font);
        setText (message, false);

        bestWidth = 2 * (int) std::sqrt (font.getHeight() * font.getStringWidth (message));

        setColour (TextEditor::backgroundColourId, Colours::transparentBlack);
        setColour (TextEditor::outlineColourId, Colours::transparentBlack);
        setColour (TextEditor::shadowColourId, Colours::transparentBlack);
    }
Пример #4
0
QgsExpressionLineEdit::QgsExpressionLineEdit( QWidget *parent )
    : QWidget( parent )
    , mLineEdit( nullptr )
    , mCodeEditor( nullptr )
    , mExpressionDialogTitle( tr( "Expression dialog" ) )
    , mDa( nullptr )
    , mExpressionContextGenerator( nullptr )
    , mLayer( nullptr )
{
  mButton = new QToolButton();
  mButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
  mButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconExpression.svg" ) ) );
  connect( mButton, SIGNAL( clicked() ), this, SLOT( editExpression() ) );

  //sets up layout
  setMultiLine( false );

  mExpressionContext = QgsExpressionContext();
  mExpressionContext << QgsExpressionContextUtils::globalScope()
  << QgsExpressionContextUtils::projectScope();
}
Пример #5
0
//! Reads attributes of the element
void CGUIEditBox::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
    IGUIEditBox::deserializeAttributes(in,options);

    setOverrideColor(in->getAttributeAsColor("OverrideColor"));
    enableOverrideColor(in->getAttributeAsBool("OverrideColorEnabled"));
    setMax(in->getAttributeAsInt("MaxChars"));
    setWordWrap(in->getAttributeAsBool("WordWrap"));
    setMultiLine(in->getAttributeAsBool("MultiLine"));
    setAutoScroll(in->getAttributeAsBool("AutoScroll"));
    core::stringw ch = in->getAttributeAsStringW("PasswordChar");

    if (!ch.size())
        setPasswordBox(in->getAttributeAsBool("PasswordBox"));
    else
        setPasswordBox(in->getAttributeAsBool("PasswordBox"), ch[0]);

    setTextAlignment( (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("HTextAlign", GUIAlignmentNames),
            (EGUI_ALIGNMENT) in->getAttributeAsEnumeration("VTextAlign", GUIAlignmentNames));

    // setOverrideFont(in->getAttributeAsFont("OverrideFont"));
}