本文整理汇总了C++中twindow类的典型用法代码示例。如果您正苦于以下问题:C++ twindow类的具体用法?C++ twindow怎么用?C++ twindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了twindow类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pre_show
void tdata_manage::pre_show(CVideo& /*video*/, twindow& window)
{
assert(txtFilter_);
ttext_box* filter
= find_widget<ttext_box>(&window, "txtFilter", false, true);
window.keyboard_capture(filter);
filter->set_text_changed_callback(
boost::bind(&tdata_manage::filter_text_changed, this, _1, _2));
tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
window.keyboard_capture(&list);
#ifdef GUI2_EXPERIMENTAL_LISTBOX
connect_signal_notify_modified(list,
boost::bind(&tdata_manage::list_item_clicked,
this,
boost::ref(window)));
#else
list.set_callback_value_change(
dialog_callback<tdata_manage, &tdata_manage::list_item_clicked>);
#endif
{
cursor::setter cur(cursor::WAIT);
games_ = savegame::get_saves_list();
}
fill_game_list(window, games_);
connect_signal_mouse_left_click(
find_widget<tbutton>(&window, "clear", false),
boost::bind(&tdata_manage::delete_button_callback,
this,
boost::ref(window)));
}
开发者ID:Heark,项目名称:wesnoth,代码行数:35,代码来源:data_manage.cpp
示例2: pre_show
void tcombo_box::pre_show(CVideo& /*video*/, twindow& window)
{
window.set_canvas_variable("border", variant("default-border"));
tlabel* title = find_widget<tlabel>(&window, "title", false, true);
if (type_ == EXTRACT) {
title->set_label(_("Extract hero"));
} else {
title->set_visible(twidget::INVISIBLE);
find_widget<twidget>(&window, "ok", false, true)->set_visible(twidget::INVISIBLE);
find_widget<twidget>(&window, "cancel", false, true)->set_visible(twidget::INVISIBLE);
}
tlistbox& list = find_widget<tlistbox>(&window, "listbox", false);
window.keyboard_capture(&list);
std::map<std::string, string_map> data;
int item_index = 0;
for (std::vector<tval_str>::const_iterator it = items_.begin(); it != items_.end(); ++ it) {
const tval_str& item = *it;
data["label"]["label"] = item.str;
list.add_row(data);
item_index ++;
}
list.set_callback_value_change(dialog_callback3<tcombo_box, tlistbox, &tcombo_box::item_selected>);
if (index_ != -1) {
list.select_row(index_);
}
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:32,代码来源:combo_box.cpp
示例3: pre_show
void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window)
{
window.set_canvas_variable("border", variant("default-border"));
tlistbox& list = find_widget<tlistbox>(&window, "language_list", false);
window.keyboard_capture(&list);
const std::vector<language_def>& languages = get_languages();
const language_def& current_language = get_language();
std::stringstream strstr;
int number = hero::number_normal_min;
BOOST_FOREACH (const language_def& lang, languages) {
string_map list_item;
std::map<std::string, string_map> list_item_item;
strstr.str("");
strstr << "hero-64/" << number << ".png";
list_item["label"] = strstr.str();
list_item_item.insert(std::make_pair("icon", list_item));
list_item["label"] = lang.language;
list_item_item.insert(std::make_pair("name", list_item));
list.add_row(list_item_item);
if (lang == current_language) {
list.select_row(list.get_item_count() - 1);
}
number ++;
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:30,代码来源:language_selection.cpp
示例4: update_tod_display
void tcustom_tod::update_tod_display(twindow& window)
{
image::set_color_adjustment(tod_red_field_->get_value(),
tod_green_field_->get_value(),
tod_blue_field_->get_value());
if(!display_) {
return;
}
// Prevent a floating slice of window appearing alone over the
// theme UI sidebar after redrawing tiles and before we have a
// chance to redraw the rest of this window.
window.undraw();
// NOTE: We only really want to re-render the gamemap tiles here.
// Redrawing everything is a significantly more expensive task.
// At this time, tiles are the only elements on which ToD tint is
// meant to have a visible effect. This is very strongly tied to
// the image caching mechanism.
//
// If this ceases to be the case in the future, you'll need to call
// redraw_everything() instead.
// invalidate all tiles so they are redrawn with the new ToD tint next
display_->invalidate_all();
// redraw tiles
display_->draw(false);
window.invalidate_layout();
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:32,代码来源:custom_tod.cpp
示例5: pre_show
void tstory_screen::pre_show(CVideo& video, twindow& window)
{
// set_restore(false);
window.set_click_dismiss(false);
window.set_enter_disabled(true);
window.set_escape_disabled(true);
if (!part_["story"].str().empty()) {
window.canvas()[0].set_variable("background_image", variant(part_["story"].str()));
} else {
window.canvas()[0].set_variable("background_image", variant(game_config::images::game_title));
}
connect_signal_mouse_left_click(
find_widget<tbutton>(&window, "next_tip", false)
, boost::bind(
&tstory_screen::update_tip
, this
, boost::ref(window)
, true));
connect_signal_mouse_left_click(
find_widget<tbutton>(&window, "previous_tip", false)
, boost::bind(
&tstory_screen::update_tip
, this
, boost::ref(window)
, false));
}
开发者ID:SkyPrayerStudio,项目名称:War-Of-Kingdom,代码行数:31,代码来源:story_screen.cpp
示例6: pre_show
void tmessage::pre_show(CVideo& /*video*/, twindow& window)
{
// ***** Validate the required buttons ***** ***** ***** *****
tmessage_implementation::
init_button(window, buttons_[left_1], "left_side");
tmessage_implementation::
init_button(window, buttons_[cancel], "cancel");
tmessage_implementation::
init_button(window, buttons_[ok] ,"ok");
tmessage_implementation::
init_button(window, buttons_[right_1], "right_side");
// ***** ***** ***** ***** Set up the widgets ***** ***** ***** *****
if(!title_.empty()) {
find_widget<tlabel>(&window, "title", false).set_label(title_);
}
if(!image_.empty()) {
find_widget<timage>(&window, "image", false).set_label(image_);
}
tcontrol& label = find_widget<tcontrol>(&window, "label", false);
label.set_label(message_);
// The label might not always be a scroll_label but the capturing
// shouldn't hurt.
window.keyboard_capture(&label);
// Override the user value, to make sure it's set properly.
window.set_click_dismiss(auto_close_);
}
开发者ID:RushilPatel,项目名称:BattleForWesnoth,代码行数:31,代码来源:message.cpp
示例7: pre_show
void taddon_connect::pre_show(CVideo& /*video*/, twindow& window)
{
ttext_box* host_widget = dynamic_cast<ttext_box*>(window.find_widget("host_name", false));
VALIDATE(host_widget, missing_widget("host_name"));
host_widget->set_value(host_name_);
window.keyboard_capture(host_widget);
}
开发者ID:dodikk,项目名称:iWesnoth,代码行数:8,代码来源:addon_connect.cpp
示例8: show_preferences_button_callback
void tlobby_main::post_build(twindow& window)
{
/** @todo Should become a global hotkey after 1.8, then remove it here. */
window.register_hotkey(hotkey::HOTKEY_FULLSCREEN, std::bind(fullscreen, std::ref(window.video())));
/*** Local hotkeys. ***/
window.register_hotkey(hotkey::HOTKEY_PREFERENCES, [this](event::tdispatcher& win, hotkey::HOTKEY_COMMAND)->bool {
show_preferences_button_callback(dynamic_cast<twindow&>(win));
return true;
});
}
开发者ID:shikadilord,项目名称:wesnoth,代码行数:11,代码来源:lobby.cpp
示例9: pre_show
void tmp_method_selection::pre_show(CVideo& /*video*/, twindow& window)
{
user_name_ = preferences::login();
ttext_box* user_widget = find_widget<ttext_box>(
&window, "user_name", false, true);
user_widget->set_value(user_name_);
user_widget->set_maximum_length(mp::max_login_size);
window.keyboard_capture(user_widget);
tlistbox* list = find_widget<tlistbox>(&window, "method_list", false, true);
window.add_to_keyboard_chain(list);
}
开发者ID:asimonov-im,项目名称:wesnoth,代码行数:13,代码来源:mp_method_selection.cpp
示例10: _
void tinapp_purchase::quit(twindow& window)
{
if (operating_anim_ == twidget::npos) {
window.set_retval(twindow::OK);
return;
}
std::string message = _("System is processing inapp-purchase request, and force to quit maybe result data not integrated. Do you want to Quit?");
int res = gui2::show_message(disp_.video(), "", message, gui2::tmessage::yes_no_buttons);
if (res != gui2::twindow::OK) {
return;
}
window.set_retval(twindow::OK);
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:14,代码来源:inapp_purchase.cpp
示例11: init_fields
void tdialog::init_fields(twindow& window)
{
for(auto field : fields_)
{
field->attach_to_window(window);
field->widget_init(window);
}
if(!focus_.empty()) {
if(twidget* widget = window.find(focus_, false)) {
window.keyboard_capture(widget);
}
}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:14,代码来源:dialog.cpp
示例12: post_show
void tmp_cmd_wrapper::post_show(twindow& window)
{
ttext_box* message =
dynamic_cast<ttext_box*>(window.find("message", false));
message_ = message ? message_ = message->get_value() : "";
ttext_box* reason =
dynamic_cast<ttext_box*>(window.find("reason", false));
reason_ = reason ? reason_ = reason->get_value() : "";
ttext_box* time =
dynamic_cast<ttext_box*>(window.find("time", false));
time_ = time ? time_ = time->get_value() : "";
}
开发者ID:aelthwin,项目名称:Battle-for-Wesnoth--Zombie-Edition,代码行数:15,代码来源:mp_cmd_wrapper.cpp
示例13: pre_show
void teditor_set_starting_position::pre_show(CVideo& /*video*/, twindow& window)
{
tlistbox& list = find_widget<tlistbox>(&window, "listbox", false);
window.keyboard_capture(&list);
std::map<std::string, string_map> data;
string_map column;
column["label"] = _("player^None");
data.insert(std::make_pair("player", column));
list.add_row(data);
for(unsigned i = 0; i < starting_positions_.size(); ++i) {
const map_location& player_pos = starting_positions_[i];
data.clear();
utils::string_map symbols;
symbols["player_number"] = str_cast(i + 1);
column["label"] = utils::interpolate_variables_into_string(_("Player $player_number"), &symbols);
data.insert(std::make_pair("player", column));
if(player_pos.valid()) {
column["label"] = (formatter() << "(" << player_pos.x + 1 << ", " << player_pos.y + 1 << ")").str();
data.insert(std::make_pair("location", column));
}
list.add_row(data);
}
list.select_row(selection_);
}
开发者ID:asimonov-im,项目名称:wesnoth,代码行数:33,代码来源:editor_set_starting_position.cpp
示例14: update_relation
void tlobby_player_info::update_relation(twindow& w)
{
add_to_friends_->set_active(false);
add_to_ignores_->set_active(false);
remove_from_list_->set_active(false);
switch(info_.relation) {
case user_info::FRIEND:
relation_->set_label(_("On friends list"));
add_to_ignores_->set_active(true);
remove_from_list_->set_active(true);
break;
case user_info::IGNORED:
relation_->set_label(_("On ignores list"));
add_to_friends_->set_active(true);
remove_from_list_->set_active(true);
break;
case user_info::NEUTRAL:
relation_->set_label(_("Neither a friend nor ignored"));
add_to_friends_->set_active(true);
add_to_ignores_->set_active(true);
break;
case user_info::ME:
relation_->set_label(_("You"));
break;
default:
relation_->set_label(_("Error"));
}
w.invalidate_layout();
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:29,代码来源:player_info.cpp
示例15: pre_show
void tnetdiag::pre_show(CVideo& /*video*/, twindow& window)
{
window.set_canvas_variable("border", variant("default-border"));
log_ = &find_widget<tscroll_label>(&window, "log", false);
log_->set_label(lobby->format_log_str());
log_->set_scroll_to_end(true);
connect_signal_mouse_left_click(
find_widget<tbutton>(&window, "connect", false)
, boost::bind(
&tnetdiag::connect_button_callback
, this
, boost::ref(window)));
find_widget<tbutton>(&window, "connect", false).set_active(false);
connect_signal_mouse_left_click(
find_widget<tbutton>(&window, "clear", false)
, boost::bind(
&tnetdiag::clear_button_callback
, this
, boost::ref(window)));
join();
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:25,代码来源:netdiag.cpp
示例16: child_populate_dirty_list
void tstacked_widget::child_populate_dirty_list(twindow& caller,
const std::vector<twidget*>& call_stack)
{
std::vector<twidget*> layers;
for (size_t n = 0; n < generator_->get_item_count(); ++ n) {
std::vector<tdirty_list>& dirty_list = caller.dirty_list();
size_t dirty_size = dirty_list.size();
// tgrid <==> [layer]
tgrid& grid = generator_->item(n);
if (grid.get_visible() != twidget::VISIBLE) {
continue;
}
std::vector<twidget*> child_call_stack = call_stack;
if (n > 0) {
child_call_stack.insert(child_call_stack.end(), layers.begin(), layers.end());
}
grid.populate_dirty_list(caller, child_call_stack);
if (n > 0 && dirty_list.size() != dirty_size) {
std::vector<tdirty_list>::iterator it = dirty_list.begin();
for (std::advance(it, dirty_size); it != dirty_list.end(); ++ it) {
it->children = layers;
}
}
layers.push_back(&grid);
}
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:28,代码来源:stacked_widget.cpp
示例17: pre_show
void pre_show(twindow& window)
{
LOG_CHAT_LOG << "Entering tchat_log::view::pre_show" << std::endl;
controller_.update_view_from_model(true);
window.invalidate_layout(); // workaround for assertion failure
LOG_CHAT_LOG << "Exiting tchat_log::view::pre_show" << std::endl;
}
开发者ID:shikadilord,项目名称:wesnoth,代码行数:7,代码来源:chat_log.cpp
示例18: pre_show
void ttheme_list::pre_show(twindow& window)
{
tlistbox& list = find_widget<tlistbox>(&window, "themes", false);
window.keyboard_capture(&list);
for(const auto & t : themes_)
{
std::map<std::string, string_map> data;
string_map column;
std::string theme_name = t.name;
if(theme_name.empty()) {
theme_name = t.id;
}
column["label"] = theme_name;
data.emplace("name", column);
column["label"] = t.description;
data.emplace("description", column);
list.add_row(data);
}
if(index_ != -1 && static_cast<unsigned>(index_) < list.get_item_count()) {
list.select_row(index_);
}
index_ = -1;
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:29,代码来源:theme_list.cpp
示例19: pre_show
void teditor_generate_map::pre_show(CVideo& /*video*/, twindow& window)
{
window.set_canvas_variable("border", variant("default-border"));
assert(!map_generators_.empty());
assert(gui_);
current_generator_label_ =
&find_widget<tlabel>(&window, "current_generator", false);
tbutton& settings_button =
find_widget<tbutton>(&window, "settings", false);
connect_signal_mouse_left_click(settings_button, boost::bind(
&teditor_generate_map::do_settings
, this
, boost::ref(window)));
tbutton& next_generator_button =
find_widget<tbutton>(&window, "next_generator", false);
connect_signal_mouse_left_click(next_generator_button, boost::bind(
&teditor_generate_map::do_next_generator
, this
, boost::ref(window)));
update_current_generator_label(window);
}
开发者ID:freeors,项目名称:War-Of-Kingdom,代码行数:26,代码来源:editor_generate_map.cpp
示例20: join_global_button_callback
void tlobby_main::join_global_button_callback(twindow& window)
{
if(do_game_join(gamelistbox_->get_selected_row(), false)) {
legacy_result_ = JOIN;
window.close();
}
}
开发者ID:CliffsDover,项目名称:wesnoth,代码行数:7,代码来源:lobby.cpp
注:本文中的twindow类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论