static void user_identify(void *data) { reset_passwd_lbl(); if (who == NULL) { show_tip(&pwderr); CLEARA(passbuf); passlen = 0; return; } if ((passlen > 0)&&(strcmp(passbuf, who->passwd) == 0)) { clear_usrinp(); stb_set_user(who->name); curr_usr = who; if (get_alarm_count() == 0) { show_main_win(); } else { show_zalrm_win(); } send_event(EV_LOGIN, 0); } else { show_tip(&pwderr); } CLEARA(passbuf); passlen = 0; }
void pwd_diag_error(pwd_diag_t *diag) { utk_entry_clear_text(diag->ent); utk_entry_update((UtkWindow *)diag->ent); show_tip(&diag->pwderr); }
void ttechnology_tree::signal_handler_mouse_enter(ttoggle_button& widget) { int toggled_index = widget.get_data(); const ttechnology& t = unit_types.technologies().find(technology_tv_[toggled_index].first)->second; show_tip(t); }
bool ContactTree::viewportEvent(QEvent *e) { if(e->type() == QEvent::ToolTip) { QHelpEvent *he = static_cast<QHelpEvent *>(e); if(tip_shown) emit hide_tip(); tip_shown = false; QModelIndex i = indexAt(he->pos()); if(i.isValid()) { tip_shown = true; emit show_tip(i, QCursor::pos()); // mapToGlobal(he->pos()); } } return QTreeView::viewportEvent(e); }
static void pz_arm(void) { int id; if ((id = get_selected_pitemid()) < 0) return; if (!pz_get(pzarr[id]+1)) { show_tip(&prterr); return; } cur_pz = &pzone[pzarr[id]]; pzone_arm(pzarr[id]+1); if (selectedid >= 0) { utk_list_box_unselect(plb, selectedid); selectedid = -1; } }
LRESULT CALLBACK callback_vis_window(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static int mdown = 0, dx, dy, lx, ly, maximized = 0; switch(msg) { case WM_TIMER: break; case WM_USER: /* overlay message: lparam = &hdc */ { HDC odc = *((HDC*)lParam); vis_lyrics_draw(odc); } break; case WM_MOUSEMOVE: { RECT rct; int x = (int)LOWORD(lParam), y = (int)HIWORD(lParam); GetClientRect(hwnd, &rct); if(x > rct.right - 20 && y > rct.bottom - 20 && x <= rct.right && y <= rct.bottom) { SetCursor(LoadCursor(0, IDC_SIZENWSE)); } if(mdown == 1) { POINT pt; GetCursorPos(&pt); move_docking_window(window_id_vis, pt.x - dx, pt.y - dy); }else if(mdown == 2){ /* resize */ POINT pt; GetCursorPos(&pt); skin_settings.vis_w = max(pt.x - lx + dx, 100); skin_settings.vis_h = max(pt.y - ly + dy, 50); if(skin_settings.vis_d) { if(skin_main_width > skin_settings.vis_w - 10 && skin_main_width < skin_settings.vis_w + 10) skin_settings.vis_w = skin_main_width; if(skin_main_height > skin_settings.vis_h - 10 && skin_main_height < skin_settings.vis_h + 10) skin_settings.vis_h = skin_main_height; } SetWindowPos(hwnd, 0, 0, 0, skin_settings.vis_w, skin_settings.vis_h, SWP_NOMOVE | SWP_NOZORDER); vis_draw_background(maximized); }else{ visualization_messages(2 /* mouse move */, x, y); } if(!maximized) { if(incoord_vpos_nozoom((int)LOWORD(lParam), (int)HIWORD(lParam), &coords.window_vis.button_close, coords.window_vis.button_close_align, skin_settings.vis_w, skin_settings.vis_h)) { show_tip(oooo_skins_close, 0); blt_coord_vpos_nozoom(hdc_vis, mdc_sheet, 1, &coords.window_vis.button_close, coords.window_vis.button_close_align, skin_settings.vis_w, skin_settings.vis_h); }else{ blt_coord_vpos_nozoom(hdc_vis, mdc_sheet, 0, &coords.window_vis.button_close, coords.window_vis.button_close_align, skin_settings.vis_w, skin_settings.vis_h); } if(incoord_vpos_nozoom((int)LOWORD(lParam), (int)HIWORD(lParam), &coords.window_vis.button_max, coords.window_vis.button_max_align, skin_settings.vis_w, skin_settings.vis_h)) { show_tip(oooo_skins_maximize, 0); blt_coord_vpos_nozoom(hdc_vis, mdc_sheet, 1, &coords.window_vis.button_max, coords.window_vis.button_max_align, skin_settings.vis_w, skin_settings.vis_h); }else{ blt_coord_vpos_nozoom(hdc_vis, mdc_sheet, 0, &coords.window_vis.button_max, coords.window_vis.button_max_align, skin_settings.vis_w, skin_settings.vis_h); } } } break; case WM_MOUSEWHEEL: SendMessage(skin.wnd, msg, wParam, lParam); break; case WM_KEYDOWN: if(visualization_messages(msg_keys, (int)wParam, (int)lParam))break; SendMessage(skin.wnd, msg, wParam, lParam); break; case WM_LBUTTONDBLCLK: offset_fullscreen: { WINDOWPLACEMENT wp; GetWindowPlacement(hwnd, &wp); if(wp.showCmd == SW_MAXIMIZE) { ShowWindow(hwnd, SW_RESTORE); maximized = 0; }else{ ShowWindow(hwnd, SW_MAXIMIZE); maximized = 1; } sys_sleep(30); vis_draw_background(maximized); } break; case WM_LBUTTONDOWN: { RECT rct; if(visualization_messages(msg_leftdown, (int)LOWORD(lParam), (int)HIWORD(lParam)))break; if(maximized)break; if(!maximized) { if(incoord_vpos_nozoom((int)LOWORD(lParam), (int)HIWORD(lParam), &coords.window_vis.button_close, coords.window_vis.button_close_align, skin_settings.vis_w, skin_settings.vis_h)) { if(skin_settings.skin_lock) { SendMessage(skin.wnd, WM_DESTROY, 0, 0); }else{ vis_close(); skin_settings.vis_show = 0; } break; } if(incoord_vpos_nozoom((int)LOWORD(lParam), (int)HIWORD(lParam), &coords.window_vis.button_max, coords.window_vis.button_max_align, skin_settings.vis_w, skin_settings.vis_h)) { goto offset_fullscreen; break; } } GetClientRect(hwnd, &rct); dx = (int)LOWORD(lParam); dy = (int)HIWORD(lParam); if(skin_settings.skin_lock) { RECT rctm; POINT pt; GetWindowRect(skin.wnd, &rctm); GetCursorPos(&pt); last_dx = pt.x - rctm.left; last_dy = pt.y - rctm.top; } if(dx > rct.right - 20 && dy > rct.bottom - 20 && dx <= rct.right && dy <= rct.bottom) { dx = rct.right - dx; dy = rct.bottom - dy; GetWindowRect(hwnd, &rct); lx = rct.left; ly = rct.top; mdown = 2; }else{ mdown = 1; } SetCapture(hwnd); } break; case WM_LBUTTONUP: mdown = 0; ReleaseCapture(); if(visualization_messages(msg_leftup, (int)LOWORD(lParam), (int)HIWORD(lParam)))break; break; case WM_RBUTTONDOWN: visualization_messages(msg_rightdown, (int)LOWORD(lParam), (int)HIWORD(lParam)); break; case WM_RBUTTONUP: if(!visualization_messages(msg_rightup, (int)LOWORD(lParam), (int)HIWORD(lParam))) { skin.shared->general.show_settings(0, 0, panel_visualizations); } break; case WM_CREATE: hdc_vis = GetDC(hwnd); vis_lyrics_font_size = MulDiv(20, GetDeviceCaps(hdc_vis, LOGPIXELSY), 72); vis_lyric_font = CreateFont(-vis_lyrics_font_size, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH, skin_settings.font_display); vis_lyric_font_b = CreateFont(-vis_lyrics_font_size, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, skin_settings.font_display); vis_lyric_timer = SetTimer(hwnd, 4000101, 10, 0); break; case WM_DESTROY: DeleteObject(vis_lyric_font); KillTimer(hwnd, vis_lyric_timer); break; case WM_PAINT: vis_draw_background(maximized); break; } return DefWindowProc(hwnd, msg, wParam, lParam); }
void ttechnology_tree::pre_show(CVideo& /*video*/, twindow& window) { window_ = &window; ing_technology_ = current_team_.ing_technology(); std::stringstream strstr; tlabel* label = find_widget<tlabel>(&window, "title", false, true); strstr << _("Technology tree") << "(" << current_team_.name() << ")"; label->set_label(strstr.str()); if (browse_) { label = find_widget<tlabel>(&window, "flag", false, true); strstr.str(""); strstr << "(" << _("Browse") << ")"; label->set_label(strstr.str()); } ttree_view& parent_tree = find_widget<ttree_view>(&window, "player_tree", false); tree_= &parent_tree; parent_tree.set_left_align(); string_map tree_group_field; std::map<std::string, string_map> tree_group_item; utils::string_map symbols; std::vector<std::string> advances_from; ttree_view_node* htvi; const std::vector<const ttechnology*>& holded = current_team_.holded_technologies(); const std::vector<advance_tree::node*>& technology_tree = unit_types.technology_tree(); for (std::vector<advance_tree::node*>::const_iterator it = technology_tree.begin(); it != technology_tree.end(); ++ it) { const advance_tree::node* n = *it; const ttechnology* current = dynamic_cast<const ttechnology*>(n->current); bool hold = std::find(holded.begin(), holded.end(), current) != holded.end(); strstr.str(""); strstr << current->name() << "\n"; strstr << "<format>"; int max_experience = current_team_.technology_max_experience(*current); if (max_experience != current->max_experience()) { strstr << "color=blue "; } strstr << "text='(" << exp_str(*current) << "/" << max_experience << ")'</format>"; tree_group_field["label"] = strstr.str(); if (hold) { tree_group_field["icon"] = "misc/ok2.png"; } else { tree_group_field["icon"] = ""; } tree_group_item["tree_view_node_label"] = tree_group_field; htvi = &parent_tree.add_node("item", tree_group_item); ttoggle_button* toggle = dynamic_cast<ttoggle_button*>(htvi->find("tree_view_node_label", true)); toggle->set_callback_state_change(boost::bind(&ttechnology_tree::technology_toggled, this, _1)); toggle->set_data(technology_tv_.size()); toggle->set_active(!browse_ && !hold); if (current == ing_technology_) { tree_->set_select_item(htvi); } toggle->connect_signal<event::MOUSE_ENTER>(boost::bind( &ttechnology_tree::signal_handler_mouse_enter, this, boost::ref(*toggle)), event::tdispatcher::front_child); toggle->connect_signal<event::MOUSE_LEAVE>(boost::bind( &ttechnology_tree::signal_handler_mouse_leave, this), event::tdispatcher::front_child); advances_from.clear(); technology_tv_.push_back(std::make_pair(current->id(), advances_from)); if (!n->advances_to.empty()) { advances_from.push_back(current->id()); technology_tree_2_tv_internal(htvi, n->advances_to, advances_from, hold); } } if (ing_technology_) { show_tip(*ing_technology_); } if (browse_) { // tree_->set_active(false); } }
void ttechnology_tree::signal_handler_mouse_leave() { if (ing_technology_) { show_tip(*ing_technology_); } }