本文整理汇总了C++中InputContext类的典型用法代码示例。如果您正苦于以下问题:C++ InputContext类的具体用法?C++ InputContext怎么用?C++ InputContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InputContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_thread_data
void DisplayMessageQueue_X11::process_message()
{
std::shared_ptr<ThreadData> data = get_thread_data();
::Display *display = get_display();
XEvent event;
while (XPending(display) > 0)
{
XNextEvent(display, &event);
for (auto & elem : data->windows)
{
X11Window *window = elem;
if (window->get_window() == event.xany.window)
{
X11Window *mouse_capture_window = current_mouse_capture_window;
if (mouse_capture_window == nullptr)
mouse_capture_window = window;
window->process_message(event, mouse_capture_window);
}
}
}
for (auto & elem : data->windows)
{
elem->process_message_complete();
}
// Process all input context messages (done seperately, because of the mouse_capture hack)
for (auto & elem : data->windows)
{
InputContext context = elem->get_ic();
context.process_messages();
}
}
示例2: if
void gun::HighScoreEntryScreen::HandleInput(const InputContext& input_context)
{
std::string string = name_text_.string();
sf::Uint32 unicode = input_context.GetTextEnteredUnicode();
if (unicode >= 0)
{
if(unicode == '\b' && string.length() > 0)
{
string.erase(string.length() - 1, 1);
}
else if(unicode < 128 && string.length() < 10)
{
sf::String ch(unicode);
char ansi_ch = ch.toAnsiString()[0];
if(ch.getSize() > 0 && isalnum(ansi_ch))
{
string += ch;
}
}
}
boost::to_upper(string);
name_text_.set_string(string);
if (input_context.IsKeyReleased(sf::Keyboard::Return))
{
EnterHighScores();
}
}
示例3: get_thread_data
void DisplayMessageQueue_X11::process_message()
{
std::shared_ptr<ThreadData> data = get_thread_data();
XEvent event;
while(XPending(display) > 0)
{
XNextEvent(display, &event);
for (std::vector<X11Window *>::size_type i = 0; i < data->windows.size(); i++)
{
X11Window *window = data->windows[i];
if (window->get_window() == event.xany.window)
{
X11Window *mouse_capture_window = current_mouse_capture_window;
if (mouse_capture_window == NULL)
mouse_capture_window = window;
window->process_message(event, mouse_capture_window);
}
}
}
for (std::vector<X11Window *>::size_type i = 0; i < data->windows.size(); i++)
{
data->windows[i]->process_message_complete();
}
// Process all input context messages (done seperately, because of the mouse_capture hack)
for (std::vector<X11Window *>::size_type i = 0; i < data->windows.size(); i++)
{
InputContext context = data->windows[i]->get_ic();
context.process_messages();
}
}
示例4: CompWnd_Paint
void CompWnd_Paint(HWND hCompWnd) {
FOOTMARK();
PAINTSTRUCT ps;
HDC hDC = ::BeginPaint(hCompWnd, &ps);
HFONT hOldFont = NULL;
HFONT hFont = (HFONT)::GetWindowLongPtr(hCompWnd, FIGWLP_FONT);
if (hFont) hOldFont = (HFONT)::SelectObject(hDC, hFont);
HWND hSvrWnd = (HWND)::GetWindowLongPtr(hCompWnd, FIGWLP_SERVERWND);
HIMC hIMC = (HIMC)::GetWindowLongPtr(hSvrWnd, IMMGWLP_IMC);
if (hIMC) {
InputContext *lpIMC = TheIME.LockIMC(hIMC);
if (lpIMC) {
CompStr *lpCompStr = lpIMC->LockCompStr();
if (lpCompStr) {
if (lpCompStr->dwCompStrLen > 0) {
CompWnd_Draw(hCompWnd, hDC, lpIMC, lpCompStr);
}
lpIMC->UnlockCompStr();
}
TheIME.UnlockIMC(hIMC);
}
}
if (hFont && hOldFont) ::SelectObject(hDC, hOldFont);
::EndPaint(hCompWnd, &ps);
} // CompWnd_Paint
示例5: update_prop_label_cb
void InputContext::update_prop_label_cb(void *ptr, const char *str)
{
InputContext *ic = (InputContext *)ptr;
InputContext *focusedContext = InputContext::focusedContext();
if (ic == focusedContext)
ic->update_prop_label(str);
}
示例6: getActiveEditor
void DynamicEditor::render()
{
if (instanceTab->getTabCount() != 0)
{
InputContext* context = getActiveEditor();
context->render(); //FIXME put this back in
}
}
示例7:
InputContext * InputContextStack::popInputContext() {
InputContext * res = m_stack.back();
//reset states of all input listeners
res->resetListeners();
m_stack.pop_back();
return res;
}
示例8: get_thread_data
void DisplayMessageQueue_Win32::process_input_contexts()
{
std::shared_ptr<ThreadData> data = get_thread_data();
for (std::vector<Win32Window *>::size_type i = 0; i < data->windows.size(); i++)
{
InputContext context = data->windows[i]->get_ic();
context.process_messages();
}
}
示例9:
void
InputContext::commit_cb(void *ptr, const char *str)
{
InputContext *ic = (InputContext *)ptr;
XimIC *xic = ic->get_ic();
ic->clear_pe_stat();
ic->update_preedit();
xic->commit_string(str);
}
示例10: set_im
void XimServer::changeContext(const char *engine) {
set_im(engine);
std::list<InputContext *>::iterator it;
for (it = ic_list.begin(); it != ic_list.end(); ++it) {
(*it)->changeContext(engine);
}
// make sure to use appropriate locale for the focused context
InputContext *focusedContext = InputContext::focusedContext();
if (focusedContext)
focusedContext->focusIn();
}
示例11: reload_uim
void
reload_uim(int reload_libuim)
{
if (reload_libuim) {
fprintf(stderr, "\nReloading uim...\n\n");
terminate_canddisp_connection();
helper_disconnect_cb();
terminate_x_connection();
std::map<Window, XimServer *>::iterator it;
std::list<InputContext *>::iterator it_c;
for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
XimServer *xs = it->second;
for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c)
(*it_c)->clear();
}
uim_quit();
}
clear_uim_info();
get_uim_info();
//print_uim_info();
if (reload_libuim) {
std::map<Window, XimServer *>::iterator it;
std::list<InputContext *>::iterator it_c;
for (it = XimServer::gServerMap.begin(); it != XimServer::gServerMap.end(); ++it) {
XimServer *xs = it->second;
for (it_c = xs->ic_list.begin(); it_c != xs->ic_list.end(); ++it_c) {
const char *engine = (*it_c)->get_engine_name();
(*it_c)->createUimContext(engine);
}
}
// make sure to use appropriate locale for the focused context
InputContext *focusedContext = InputContext::focusedContext();
if (focusedContext)
focusedContext->focusIn();
pretrans_setup();
}
}
示例12: process
void InputConfigFile::process(InputContext &input)
{
//ファイル一行目のバージョン文字列を取得
std::string version = input.nextToken();
input.skipReturn();
//バージョン文字列に応じたInputProcedureを実行する
if(version == InputConfigFileEV3Linetracer_1_0::VERSION_STRING)
{
InputConfigFileEV3Linetracer_1_0 body(ev3LineTracer);
body.process(input);
}
else
{
//バージョンが一致しなかったら例外を投げる
throw std::ios::failure("バージョンが不正です");
}
}
示例13: candwin_read_cb
static void candwin_read_cb(int fd, int /* ev */)
{
char buf[1024];
int n;
n = static_cast<int>(read(fd, buf, 1024 - 1));
if (n == 0) {
terminate_canddisp_connection();
return;
}
if (n == -1)
return;
buf[n] = '\0';
if (!strcmp(buf, "err")) {
terminate_canddisp_connection();
return;
}
InputContext *focusedContext = InputContext::focusedContext();
if (focusedContext) {
char *line = buf;
char *eol = strchr(line, '\n');
if (eol != NULL)
*eol = '\0';
if (strcmp("index", line) == 0) {
line = eol + 1;
eol = strchr(line, '\n');
if (eol != NULL)
*eol = '\0';
int index;
sscanf(line, "%d", &index);
focusedContext->candidate_select(index);
uim_set_candidate_index(focusedContext->getUC(), index);
// send packet queue for drawing on-the-spot preedit strings
focusedContext->get_ic()->force_send_packet();
}
}
return;
}
示例14: process
/*
<SingleState>::=
<StateIndex><tab>;StateIndex
<RefMax><tab>;RefMax
<ControlCount>;ControlCount
*/
void ReadSingleState::process(InputContext &input)
{
idx stateindex;
real refmax;
idx controlcount;
//State[stateIndex]を読み取りev3LineTracerに設定する
stateindex = StringToData::parseTo<idx>(input.nextToken());
//読み取ったstateindexとstateIndexが異なっていれば例外発生
if(stateindex != stateIndex)
{
std::string msg("invalid stateIndex");
throw std::ios_base::failure(msg);
}
refmax = StringToData::parseTo<real>(input.nextToken());
controlcount = StringToData::parseTo<idx>(input.nextToken());
input.skipReturn();
ev3LineTracer.setState(stateindex,refmax,controlcount);
}
示例15: window
int HSV::start(const std::vector<std::string> &args)
{
DisplayWindow window("ClanLib HSV Example", 1024, 768);
Slot slot = window.sig_window_close().connect(this, &HSV::on_close);
Slot slot_input_up = (window.get_ic().get_keyboard()).sig_key_up().connect(this, &HSV::on_input_up);
Canvas canvas(window);
InputContext ic = window.get_ic();
ProgramObject program = create_shader_program(canvas);
Texture texture = create_texture(canvas);
clan::Font font(canvas, "tahoma", 24);
ubyte64 last_time = System::get_time();
float hue_offset = 0.0;
while (!quit)
{
ubyte64 current_time = System::get_time();
float time_delta_ms = static_cast<float> (current_time - last_time);
last_time = current_time;
if (ic.get_keyboard().get_keycode(keycode_left))
hue_offset += 0.0005f * time_delta_ms;
else if (ic.get_keyboard().get_keycode(keycode_right))
hue_offset -= 0.0005f * time_delta_ms;
if (hue_offset < -1.0f)
hue_offset += 1.0f;
if (hue_offset > 1.0f)
hue_offset -= 1.0f;
render_texture(canvas, program, texture, hue_offset);
font.draw_text(canvas, 32, 700, "Use cursor keys left and right");
window.flip();
KeepAlive::process(10);
}
return 0;
}