void TritonIm(HWND hWindow, char* szMsg) { HWND hLink = NULL; for(unsigned int i = 0; i < strlen(szMsg); ++i) { if (szMsg[i] == '[') { keybd_event(VK_CONTROL, 0, 0, 0); short sKey = VkKeyScan('l'); keybd_event((unsigned char)sKey, 0, 0, 0); keybd_event((unsigned char)sKey, 0, KEYEVENTF_KEYUP, 0); keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); do { hLink = FindWindowEx(NULL, hLink, "__oxFrame.class__", "Edit Hyperlink"); } while(!IsWindow(hLink)); FocusWindow(hLink); } else if (szMsg[i] == '+') { HitKey(VK_TAB, 1); } else if (szMsg[i] == ']') { HitKey(VK_TAB, 1); HitKey(VK_RETURN, 1); Sleep(250); FocusWindow(hWindow); } else { short sKey = VkKeyScan(szMsg[i]); if((sKey >> 8) & 1) keybd_event(VK_LSHIFT, 0, 0, 0); keybd_event((unsigned char)sKey, 0, 0, 0); keybd_event((unsigned char)sKey, 0, KEYEVENTF_KEYUP, 0); if((sKey >> 8) & 1) keybd_event(VK_LSHIFT, 0, KEYEVENTF_KEYUP, 0); } } FocusWindow(hWindow); HitKey(VK_RETURN, 1); Sleep(250); }
void CoreManager::RemoveWindow(FreeWindow& window) { Windows::iterator i; for (i = windows.begin(); i != windows.end(); i++) if (*i == &window) break; g_assert(i != windows.end()); windows.erase(i); FocusWindow(); Redraw(); }
bool Controller::ShowDash() { // Don't want to show at the wrong time if (visible_) return false; WindowManager& wm = WindowManager::Default(); if (wm.IsExpoActive()) wm.TerminateExpo(); // We often need to wait for the mouse/keyboard to be available while a plugin // is finishing it's animations/cleaning up. In these cases, we patiently wait // for the screen to be available again before honouring the request. if (wm.IsScreenGrabbed()) { screen_ungrabbed_slot_ = wm.screen_ungrabbed.connect([this] { grab_wait_.reset(); ShowDash(); }); // Let's wait ungrab event for maximum a couple of seconds... grab_wait_.reset(new glib::TimeoutSeconds(2, [this] { screen_ungrabbed_slot_->disconnect(); return false; })); return false; } EnsureDash(); monitor_ = GetIdealMonitor(); screen_ungrabbed_slot_->disconnect(); int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); view_->SetMonitorOffset(launcher_width, panel::Style::Instance().PanelHeight(monitor_)); view_->AboutToShow(monitor_); FocusWindow(); visible_ = true; StartShowHideTimeline(); nux::Geometry const& view_content_geo = view_->GetContentGeometry(); GVariant* info = g_variant_new(UBUS_OVERLAY_FORMAT_STRING, "dash", TRUE, monitor_, view_content_geo.width, view_content_geo.height); ubus_manager_.SendMessage(UBUS_OVERLAY_SHOWN, info); return true; }
TSharedRef<FPropertyEditorToolkit> FPropertyEditorToolkit::CreateEditor( const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, const TArray<UObject*>& ObjectsToEdit ) { if( ObjectsToEdit.Num() == 1 ) { auto ExistingEditor = FindExistingEditor( ObjectsToEdit[0] ); if( ExistingEditor.IsValid() ) { ExistingEditor->FocusWindow(); return ExistingEditor.ToSharedRef(); } } TSharedRef< FPropertyEditorToolkit > NewEditor( new FPropertyEditorToolkit() ); NewEditor->Initialize( Mode, InitToolkitHost, ObjectsToEdit ); return NewEditor; }
void CoreManager::AddWindow(FreeWindow& window) { Windows::iterator i = FindWindow(window); if (i != windows.end()) { /* Window is already added, AddWindow() was called to bring the window to * the top. */ windows.erase(i); windows.push_back(&window); } else { windows.push_back(&window); window.ScreenResized(); } FocusWindow(); Redraw(); }
bool TritonSetupList(HWND hBuddyList, bool bFix) { FocusWindow(hBuddyList); SysKey(hBuddyList, VK_ESCAPE, 2); SysKey(hBuddyList, VK_MENU, 1); SysKey(hBuddyList, VK_RIGHT, 2); SysKey(hBuddyList, VK_UP, 3); SysKey(hBuddyList, VK_RIGHT, 1); SysKey(hBuddyList, VK_DOWN, (bFix?1:2)); SysKey(hBuddyList, VK_RETURN, 1); SysKey(hBuddyList, VK_MENU, 1); SysKey(hBuddyList, VK_RIGHT, 2); SysKey(hBuddyList, VK_UP, 7); SysKey(hBuddyList, VK_RIGHT, 1); if (!bFix) SysKey(hBuddyList, VK_DOWN, 1); SysKey(hBuddyList, VK_RETURN, 1); SysKey(hBuddyList, VK_HOME, 1); return true; }
void CInspectorDialog::SetMode(int mode, bool updateTabs) { FocusWindow ( mode ); }
void CTabsDlg::DockWindow(int ID , bool dock) { DockedWindowInfo *info = NULL; m_Windows.Lookup((WORD)ID , (void* &)info); ASSERT(info); ASSERT(m_Tabs.GetSafeHwnd()); ShowAllWindows(FALSE); if (!dock) { //make a containing window and assign the dialog to it CRect rect; CString classname = AfxRegisterWndClass(CS_DBLCLKS , 0 , 0 , 0); info->m_State = DockedWindowInfo::FLOATING; info->m_Window->GetWindowRect(rect); info->m_Container.CreateEx(WS_EX_TOOLWINDOW , classname , info->m_Title , WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_CAPTION, rect , this , 0); info->m_Window->SetParent(&info->m_Container); info->m_Window->ShowWindow(TRUE); info->m_Container.SetDockManager(this); info->m_Container.ShowWindow(TRUE); info->m_Container.SetDialog(info->m_Window , info->m_ID); if (info->m_TabControlIndex >= 0) { m_Tabs.DeleteItem(info->m_TabControlIndex); } if (m_Tabs.GetItemCount() > 0) { m_Tabs.SetCurFocus(0); } CString placementName = info->m_Title + "Placement"; LoadWindowPlacement(info->m_Container , placementName); } else { info->m_State = DockedWindowInfo::DOCKED; info->m_TabControlIndex = m_Tabs.InsertItem(TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM , 0 , info->m_Title , info->m_ImageID , (LPARAM)info); info->m_Window->SetParent(this); info->m_Window->ShowWindow(TRUE); info->m_Container.SetDockManager(NULL); //so it doesn't try to call back and redock this window info->m_Container.DestroyWindow(); CRect rect; GetWindowRect(rect); //stupid hack to get the window reitself properly rect.DeflateRect(0,0,0,1); MoveWindow(rect); rect.InflateRect(0,0,0,1); MoveWindow(rect); } UpdateTabControlIndices(); FocusWindow(ID); if (info->m_DockCallback) { info->m_DockCallback(dock , info->m_ID , info->m_Window); } SaveWindowPlacement(); }
bool ImGui::InputTextM(const char* label, std::string& text) { #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) bool ret = InputTextEx(label, &text[0], text.capacity(), ImVec2(0, 0), 0, 0, nullptr); return ret; #else ImGuiWindow* window = GetCurrentWindow(); if (window->SkipItems) return false; ImGuiContext& g = *GImGui; const ImGuiIO& io = g.IO; const ImGuiStyle& style = g.Style; //============================================ const ImGuiID id = window->GetID(label); const ImVec2 label_size = CalcTextSize(label, NULL, true); ImVec2 size = CalcItemSize(ImVec2(0, 0), CalcItemWidth(), label_size.y + style.FramePadding.y*2.0f); const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size); const ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f)); //============================================ ItemSize(total_bb, style.FramePadding.y); if (!ItemAdd(total_bb, &id)) return false; const bool hovered = IsHovered(frame_bb, id); if (hovered) { SetHoveredID(id); g.MouseCursor = ImGuiMouseCursor_TextInput; } ImGuiTextEditState& edit_state = g.InputTextState; const bool user_clicked = hovered && io.MouseClicked[0]; if (user_clicked) { if (g.ActiveId != id) { edit_state.CursorAnimReset(); } SetActiveID(id, window); FocusWindow(window); } else if (io.MouseClicked[0]) { // Release focus when we click outside if (g.ActiveId == id) SetActiveID(0, NULL); } if (g.ActiveId == id) { //window->DrawList->AddRectFilled(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_TextSelectedBg), style.FrameRounding); RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_TextSelectedBg), true, style.FrameRounding); ImRect frame_select(frame_bb); frame_select.Reduce(ImVec2(2, 2)); RenderFrame(frame_select.Min, frame_select.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); }else { RenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); } //============================================ int w = snprintf(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), "%s", text.c_str()); int tempSize = IM_ARRAYSIZE(g.TempBuffer); g.TempBuffer[tempSize - 1] = 0; const char* text_end = g.TempBuffer + ((w == -1) ? tempSize : w); // Render Text const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size ImVec2 render_pos = frame_bb.Min + style.FramePadding; window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), g.TempBuffer, text_end, 0.0f, &clip_rect); if (label_size.x > 0) RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label); return user_clicked; #endif }
//void TritonMessage(char* szMsg, unsigned int iDelay) DWORD WINAPI TritonMessage(LPVOID param) { NTHREAD tim = *((NTHREAD *)param); NTHREAD *tims = (NTHREAD *)param; tims->gotinfo = TRUE; IRC* irc=(IRC*)tim.conn; char szMsg[512]; strncpy(szMsg,tim.data1,sizeof(szMsg)); bool bDone = false; char szWindowText[256], szLastBuddy[256]; ZeroMemory(&szLastBuddy, 256); HWND hTray = FindWindow("imAppSystemTrayHandler", "imApp"), hBuddyList = NULL, hKill = NULL; if(IsWindow(hTray)) { SendMessage(hTray, 0x0065, 0x00000141, 0x00000203); do { hBuddyList = FindWindow("__oxFrame.class__", "AIM"); } while(!IsWindow(hBuddyList)); do { hKill = FindWindowEx(NULL, hKill, "__oxFrame.class__", NULL); ZeroMemory(&szWindowText, 256); GetWindowText(hKill, szWindowText, 256); if(strcmp(szWindowText, "AIM") != 0) SendMessage(hKill, WM_CLOSE, 0, 0); } while(IsWindow(hKill)); TritonSetupList(hBuddyList, false); while(!bDone) { Sleep(3000); FocusWindow(hBuddyList); SysKey(hBuddyList, VK_DOWN, 1); SysKey(hBuddyList, VK_RETURN, 1); HWND hWindow = NULL; do { hWindow = FindWindowEx(NULL, hWindow, "__oxFrame.class__", NULL); if(IsWindow(hWindow)) { ZeroMemory(&szWindowText, 256); GetWindowText(hWindow, szWindowText, 256); if((strcmp(szWindowText, " IMs") == 0) || (strstr(szWindowText, "IM with ") != NULL)) { if(strcmp(szLastBuddy, szWindowText) == 0) bDone = true; else { strncpy(szLastBuddy, szWindowText, 256); FocusWindow(hWindow); TritonIm(hWindow, szMsg); } SendMessage(hWindow, WM_CLOSE, 0, 0); } } } while(IsWindow(hWindow)); } TritonSetupList(hBuddyList, true); } clearthread(tim.threadnum); ExitThread(0); return 0; }