当前位置: 首页>>代码示例>>C++>>正文


C++ InputContext类代码示例

本文整理汇总了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();
		}
	}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:35,代码来源:display_message_queue_x11.cpp

示例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();
	}
}
开发者ID:dsc5085,项目名称:Gunfire,代码行数:31,代码来源:HighScoreEntryScreen.cpp

示例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();
	}
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:35,代码来源:display_message_queue_x11.cpp

示例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
开发者ID:katahiromz,项目名称:mzimeja,代码行数:29,代码来源:uicomp.cpp

示例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);
}
开发者ID:NgoHuy,项目名称:uim,代码行数:7,代码来源:ximserver.cpp

示例6: getActiveEditor

void DynamicEditor::render()
{
    if (instanceTab->getTabCount() != 0)
    {
        InputContext* context = getActiveEditor();
        context->render(); //FIXME put this back in
    }
}
开发者ID:jsj2008,项目名称:framework2d,代码行数:8,代码来源:DynamicEditor.cpp

示例7:

InputContext * InputContextStack::popInputContext() {
    InputContext * res = m_stack.back();

    //reset states of all input listeners
    res->resetListeners(); 
    m_stack.pop_back();

    return res;
}
开发者ID:ill,项目名称:illEngine,代码行数:9,代码来源:InputContextStack.cpp

示例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();
		}
	}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:9,代码来源:display_message_queue_win32.cpp

示例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);
}
开发者ID:NgoHuy,项目名称:uim,代码行数:10,代码来源:ximserver.cpp

示例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();
}
开发者ID:NgoHuy,项目名称:uim,代码行数:11,代码来源:ximserver.cpp

示例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();
    }
}
开发者ID:dai-vdr,项目名称:uim,代码行数:45,代码来源:main.cpp

示例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("バージョンが不正です");
	}
}
开发者ID:verxirtam,项目名称:ReinforcementLearning,代码行数:18,代码来源:InputConfigFile.cpp

示例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;
}
开发者ID:NgoHuy,项目名称:uim,代码行数:42,代码来源:canddisp.cpp

示例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);

}
开发者ID:verxirtam,项目名称:ReinforcementLearning,代码行数:27,代码来源:ReadSingleState.cpp

示例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;
}
开发者ID:Zenol,项目名称:clanLib-3,代码行数:40,代码来源:hsv.cpp


注:本文中的InputContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。