コード例 #1
0
ファイル: steshell.cpp プロジェクト: Aetherdyne/glintercept
void wxSTEditorShell::SetPromptText(const wxString& text)
{
    BeginWriteable();
    int length = GetLength();
    wxString promptText = GetPromptText();
    SetTargetStart(length - promptText.Length());
    SetTargetEnd(length);
    ReplaceTarget(text);
    GotoPos(GetLength());
    EndWriteable();
}
コード例 #2
0
ファイル: ScreenSaveSync.cpp プロジェクト: prappe/openitg
ScreenSaveSync::ScreenSaveSync( const CString &sScreenName ) :
    ScreenPrompt(
        sScreenName,
        SM_None,
        GetPromptText(),
        PROMPT_YES_NO,
        ANSWER_YES,
        SaveSyncChanges,
        RevertSyncChanges,
        NULL )
{
}
コード例 #3
0
// static
void ClientHandler::OnDialogResponse(GtkDialog* dialog,
                                     gint response_id,
                                     ClientHandler* handler) {
  CEF_REQUIRE_UI_THREAD();

  DCHECK_EQ(dialog, GTK_DIALOG(handler->gtk_dialog_));
  switch (response_id) {
    case GTK_RESPONSE_OK:
      handler->js_dialog_callback_->Continue(true, GetPromptText(dialog));
      break;
    case GTK_RESPONSE_CANCEL:
    case GTK_RESPONSE_DELETE_EVENT:
      handler->js_dialog_callback_->Continue(false, CefString());
      break;
    default:
      NOTREACHED();
  }

  handler->OnResetDialogState(NULL);
}
コード例 #4
0
ファイル: steshell.cpp プロジェクト: Aetherdyne/glintercept
void wxSTEditorShell::OnKeyDown(wxKeyEvent &event)
{
    event.Skip(false);
    CheckReadOnly(true);

    switch (event.GetKeyCode())
    {
        case WXK_UP : case WXK_NUMPAD_UP :
        {
            // you can scroll up through multiline entry
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if ((current_line < prompt_line) || (current_line > prompt_line))
                break;

            // up/down arrows go through the history buffer
            wxString promptText = GetPromptText();
            SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            return;
        }
        case WXK_DOWN : case WXK_NUMPAD_DOWN :
        {
            // you can scroll down through multiline entry
            int total_lines = GetLineCount();
            total_lines = wxMax(0, total_lines - 1);
            int current_line = GetCurrentLine();
            if (current_line < total_lines)
                break;

            // up/down arrows go through the history buffer
            if ((int)GetHistoryIndex() < (int)GetHistoryCount()-1)
            {
                wxString promptText = GetPromptText();
                SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            }
            return;
        }
        case WXK_LEFT : case WXK_NUMPAD_LEFT :
        {
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if (current_line >= prompt_line)
            {
                int caret_pos = 0;
                GetCurLine(&caret_pos);
                if (caret_pos < 1)
                    return;
            }
            break;
        }

        case WXK_PRIOR : case WXK_NUMPAD_PRIOR : //case WXK_NUMPAD_PAGEUP :
        case WXK_NEXT  : case WXK_NUMPAD_NEXT  : //case WXK_NUMPAD_PAGEDOWN :
        case WXK_END   : case WXK_NUMPAD_END   :
        case WXK_HOME  : case WXK_NUMPAD_HOME  :
        case WXK_RIGHT : case WXK_NUMPAD_RIGHT :

        case WXK_SHIFT :
        case WXK_CONTROL :
        case WXK_ALT :
        {
            // default processing for these keys
            event.Skip();
            return;
        }

        case WXK_RETURN : case WXK_NUMPAD_ENTER :
        {
            // put cursor at end if not already on the last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }

            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();

            // allow multiline entry for shift+enter
            if ((current_line >= prompt_line) && event.ShiftDown())
            {
                event.Skip();
                return;
            }

            wxString promptText = GetPromptText();

            // goto the end of the line and store the line for the history
            LineEnd();
            if (!promptText.IsEmpty())
                AddHistoryLine(promptText, true);

            // just send the event, the receiver can do what they like
            SendEvent(wxEVT_STESHELL_ENTER, 0, GetState(), promptText);
            return;
        }
        case WXK_BACK :
        {
            // go to the end of the last line if not on last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }
            // don't let them backspace into previous line
            int caret_pos = 0;
            GetCurLine(&caret_pos);
            if (caret_pos < 1)
                return;

            break;
        }
        default : // move cursor to end if not already there
        {
            CaretOnPromptLine(STE_CARET_MOVE_ENDTEXT);
            break;
        }
    }

    event.Skip();
}