virtual INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_NOTIFY) { LPNMHDR lpnmhdr = (LPNMHDR)lParam; if (lpnmhdr->idFrom == IDC_EXTRAORDER && lpnmhdr->code == NM_RCLICK) { HTREEITEM hSelected = m_tree.GetDropHilight(); if (hSelected != NULL && !m_tree.IsSelected(hSelected)) { m_tree.UnselectAll(); m_tree.SelectItem(hSelected); } int sels = m_tree.GetNumSelected(); if (sels > 1) { if (ShowPopup(0) == ID_GROUP) { GroupSelectedItems(); NotifyChange(); } } else if (sels == 1) { HTREEITEM hItem = m_tree.GetSelection(); intlist *ids = Tree_GetIDs(hItem); if (ids->count > 1) { if (ShowPopup(1) == ID_UNGROUP) { UngroupSelectedItems(); NotifyChange(); } } } } } return CDlgBase::DlgProc(msg, wParam, lParam); }
void ShowExamplePopups() { PopupData pd = {sizeof(PopupData)}; pd.hIcon = hPopupIcon; pd.flags = PDF_TCHAR; pd.ptzTitle = TranslateT("Example"); pd.ptzText = TranslateT("The quick brown fox jumped over the lazy dog."); ShowPopup(pd); pd.ptzTitle = TranslateT("Example With a Long Title"); pd.ptzText = TranslateT("The quick brown fox jumped over the lazy dog."); ShowPopup(pd); pd.ptzTitle = TranslateT("Example"); pd.ptzText = TranslateT("Thequickbrownfoxjumpedoverthelazydog."); ShowPopup(pd); for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) { AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); if (ace && (ace->dwFlags & AVS_BITMAP_VALID)) { pd.hContact = hContact; pd.ptzText = TranslateT("An avatar."); ShowPopup(pd); break; } } } }
int _notify(MCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage) { char *tmp, *tmporig; TCHAR msg[MAX_BUFFER_LENGTH]; mir_sntprintf(msg, MAX_BUFFER_LENGTH, message, CONTACT_NAME(hContact)); if (_getOptB("LogActions", defaultLogActions)) { tmp = mir_u2a(msg); tmporig = mir_u2a(origmessage); LogToSystemHistory(tmp, origmessage ? tmporig : NULL); mir_free(tmp); mir_free(tmporig); } if (_NOTIFYP) { if (type == POPUP_BLOCKED) { if (_getOptB("NotifyPopupBlocked", defaultNotifyPopupBlocked)) ShowPopup(hContact, type, NULL, msg); } else if (type == POPUP_APPROVED) { if (_getOptB("NotifyPopupApproved", defaultNotifyPopupApproved)) ShowPopup(hContact, type, NULL, msg); } else if (type == POPUP_CHALLENGE) { if (_getOptB("NotifyPopupChallenge", defaultNotifyPopupChallenge)) ShowPopup(hContact, type, NULL, msg); } else { ShowPopup(hContact, type, NULL, msg); } } return 0; }
static void GetList(void *) { TCHAR tszTempPath[MAX_PATH]; DWORD dwLen = GetTempPath(_countof(tszTempPath), tszTempPath); if (tszTempPath[dwLen-1] == '\\') tszTempPath[dwLen-1] = 0; ptrT updateUrl( GetDefaultUrl()), baseUrl; SERVLIST hashes(50, CompareHashes); if (!ParseHashes(updateUrl, baseUrl, hashes)) { hListThread = NULL; return; } FILELIST *UpdateFiles = new FILELIST(20); VARST dirname(_T("%miranda_path%")); for (int i=0; i < hashes.getCount(); i++) { ServListEntry &hash = hashes[i]; TCHAR tszPath[MAX_PATH]; mir_sntprintf(tszPath, _countof(tszPath), _T("%s\\%s"), dirname, hash.m_name); if (GetFileAttributes(tszPath) == INVALID_FILE_ATTRIBUTES) { FILEINFO *FileInfo = new FILEINFO; FileInfo->bDeleteOnly = FALSE; // copy the relative old name _tcsncpy(FileInfo->tszOldName, hash.m_name, _countof(FileInfo->tszOldName)); _tcsncpy(FileInfo->tszNewName, hash.m_name, _countof(FileInfo->tszNewName)); TCHAR tszFileName[MAX_PATH]; _tcsncpy(tszFileName, _tcsrchr(tszPath, L'\\') + 1, _countof(tszFileName)); TCHAR *tp = _tcschr(tszFileName, L'.'); *tp = 0; TCHAR tszRelFileName[MAX_PATH]; _tcsncpy(tszRelFileName, hash.m_name, MAX_PATH); tp = _tcsrchr(tszRelFileName, L'.'); if (tp) *tp = 0; tp = _tcschr(tszRelFileName, L'\\'); if (tp) tp++; else tp = tszRelFileName; _tcslwr(tp); mir_sntprintf(FileInfo->File.tszDiskPath, _countof(FileInfo->File.tszDiskPath), _T("%s\\Temp\\%s.zip"), tszRoot, tszFileName); mir_sntprintf(FileInfo->File.tszDownloadURL, _countof(FileInfo->File.tszDownloadURL), _T("%s/%s.zip"), baseUrl, tszRelFileName); for (tp = _tcschr(FileInfo->File.tszDownloadURL, '\\'); tp != 0; tp = _tcschr(tp, '\\')) *tp++ = '/'; FileInfo->File.CRCsum = hash.m_crc; // Deselect all plugins by default FileInfo->bEnabled = false; UpdateFiles->insert(FileInfo); } } // Show dialog if (UpdateFiles->getCount() == 0) { ShowPopup(TranslateT("Plugin Updater"), TranslateT("List is empty."), POPUP_TYPE_INFO); delete UpdateFiles; } else CallFunctionAsync(LaunchListDialog, UpdateFiles); hListThread = NULL; }
bool wxGenericComboCtrl::PerformAction(const wxControlAction& action, long numArg, const wxString& strArg) { bool processed = false; if ( action == wxACTION_COMBOBOX_POPUP ) { if ( !IsPopupShown() ) { ShowPopup(); processed = true; } } else if ( action == wxACTION_COMBOBOX_DISMISS ) { if ( IsPopupShown() ) { HidePopup(); processed = true; } } if ( !processed ) { // pass along return wxControl::PerformAction(action, numArg, strArg); } return true; }
void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { wchar_t* l1 = (line1) ? mir_utf8decodeW(line1) : nullptr; wchar_t* l2 = (line2) ? mir_utf8decodeW(line2) : nullptr; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); }
void TwitterProto::UpdateFriends() { try { ScopedLock s(twitter_lock_); std::vector<twitter_user> friends = twit_.get_friends(); s.Unlock(); for(std::vector<twitter_user>::iterator i=friends.begin(); i!=friends.end(); ++i) { if(i->username == twit_.get_username()) continue; HANDLE hContact = AddToClientList(i->username.c_str(),i->status.text.c_str()); UpdateAvatar(hContact,i->profile_image_url); } LOG("***** Friends list updated"); } catch(const bad_response &) { LOG("***** Bad response from server, signing off"); SetStatus(ID_STATUS_OFFLINE); } catch(const std::exception &e) { ShowPopup( (std::string("While updating friends list, an error occurred: ") +e.what()).c_str() ); LOG("***** Error updating friends list: %s",e.what()); } }
static int PluginMessageReceived(WPARAM wParam,LPARAM lParam) { CCSDATA *pccsd = (CCSDATA *)lParam; PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam; TCHAR response[256]; TCHAR msg[1024], buff[1024]; if (_tcsncmp(ppre->tszMessage, szGamePrefix, _tcslen(szGamePrefix))) return CallService(MS_PROTO_CHAINRECV, wParam, lParam ); _tcsncpy(msg, ppre->tszMessage + _tcslen(szGamePrefix),SIZEOF(msg)); TCHAR *savedMsg = ppre->tszMessage; if (!_tcscmp(msg, _T(" ffw"))) { mir_sntprintf(buff, SIZEOF(buff), _T("%s"), _T("Fast forward!")); HWND hWnd = FindWindow(0, _T("Windows Media Player")); PostMessage(hWnd, WM_COMMAND, WMP_NEXT, 0); } else mir_sntprintf(buff, SIZEOF(buff), TranslateT("Unknown command issued: \"%s\""), msg); ShowPopup(pccsd->hContact, buff); _tcsncpy(response, buff,SIZEOF(response)); PluginSendMessage((WPARAM)pccsd->hContact, (LPARAM)response); return 0; }
void ShowDebugPopup(MCONTACT hContact, const TCHAR *title, const TCHAR *description) { if (db_get_b(NULL,MODULE_NAME,"Debug",0)) { ShowPopup(hContact,title,description); } }
////////////////// // Timer popped: display myself and kill timer. // If Mouse moved outside of parent window, cancel and set flag void CPopupText::OnTimer(UINT nIDEvent) { CWnd::OnTimer (nIDEvent); if (nIDEvent == m_DelayTimer) { ShowPopup (); StopDelayTimer(); } else if (nIDEvent == m_MoveOutsideTimer) { CWnd* pParent = GetParent (); if (pParent) { CPoint Pos; GetCursorPos (&Pos); CWnd* pOverWindow = WindowFromPoint (Pos); if (pOverWindow) { if (!((pOverWindow->m_hWnd == m_hWnd) || (pOverWindow->m_hWnd == pParent->m_hWnd))) { m_bMovedOutside = TRUE; Cancel (); } } } } }
void ShowPopupUtf(const char* line1, const char* line2, int timeout, const MCONTACT hContact) { TCHAR* l1 = (line1) ? mir_utf8decodeT(line1) : NULL; TCHAR* l2 = (line2) ? mir_utf8decodeT(line2) : NULL; ShowPopup(l1, l2, timeout, hContact); if (l1) mir_free(l1); if (l2) mir_free(l2); }
void Notify(HANDLE hContact, TCHAR *text) { if (text != NULL && text[0] == _T('\0')) text = NULL; if (!opts.track_changes && text != NULL) return; if (!opts.track_removes && text == NULL) return; // Replace template with nick TCHAR templ[1024]; lstrcpyn(templ, text == NULL ? opts.template_removed : opts.template_changed, MAX_REGS(templ)); ReplaceChars(templ); TCHAR log[1024]; mir_sntprintf(log, sizeof(log), templ, text == NULL ? TranslateT("<no nickname>") : text); if (opts.history_enable) HistoryLog(hContact, log); if (opts.popup_enable) ShowPopup(hContact, NULL, log); }
void TwitterProto::UpdateFriends() { try { ScopedLock s(twitter_lock_); std::vector<twitter_user> friends = twit_.get_friends(); s.Unlock(); for(std::vector<twitter_user>::iterator i=friends.begin(); i!=friends.end(); ++i) { if(i->username == twit_.get_username()) continue; HANDLE hContact = AddToClientList(i->username.c_str(),i->status.text.c_str()); UpdateAvatar(hContact,i->profile_image_url); } disconnectionCount = 0; debugLogA( _T("***** Friends list updated")); } catch(const bad_response &) { ++disconnectionCount; debugLogA( _T("***** UpdateFriends - Bad response from server, this has happened %d time(s)"), disconnectionCount); if (disconnectionCount > 2) { debugLogA( _T("***** UpdateFriends - Too many bad responses from the server, signing off")); SetStatus(ID_STATUS_OFFLINE); } } catch(const std::exception &e) { ShowPopup( (std::string("While updating friends list, an error occurred: ")+e.what()).c_str()); debugLogA( _T("***** Error updating friends list: %s"), e.what()); } }
void ExplainCanvas::OnMouseMotion(wxMouseEvent &ev) { ev.Skip(true); if (ev.Dragging()) return; wxClientDC dc(this); PrepareDC(dc); wxPoint logPos(ev.GetLogicalPosition(dc)); double x, y; x = (double) logPos.x; y = (double) logPos.y; // Find the nearest object int attachment = 0; ExplainShape *nearestObj = dynamic_cast<ExplainShape *>(FindShape(x, y, &attachment)); if (nearestObj) { ShowPopup(nearestObj); } }
void CAimProto::report_file_error(TCHAR *fname) { TCHAR errmsg[512]; TCHAR* error = mir_a2t(_strerror(NULL)); mir_sntprintf(errmsg, TranslateT("Failed to open file: %s : %s"), fname, error); mir_free(error); ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP); }
void ExtraStatusChanged(XSTATUSCHANGE *xsc) { if (xsc == NULL) return; BOOL bEnablePopup = true, bEnableSound = true; char buff[12] = {0}; mir_snprintf(buff, SIZEOF(buff), "%d", ID_STATUS_EXTRASTATUS); if (( db_get_b(0, MODULE, buff, 1) == 0) || (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) || (!opt.HiddenContactsToo && db_get_b(xsc->hContact, "CList", "Hidden", 0)) || (opt.TempDisabled) || (opt.IgnoreEmpty && (xsc->stzTitle == NULL || xsc->stzTitle[0] == '\0') && (xsc->stzText == NULL || xsc->stzText[0] == '\0'))) { FreeXSC(xsc); return; } char statusIDs[12], statusIDp[12]; if (opt.AutoDisable) { WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0); mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus); mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus); bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE; bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE; } if (!(templates.PopupFlags & xsc->action)) bEnableSound = bEnablePopup = false; int xstatusID = db_get_b(xsc->hContact, xsc->szProto, "XStatusId", 0); if (opt.PDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC) bEnableSound = bEnablePopup = false; if (bEnablePopup && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1) && db_get_b(0, MODULE, xsc->szProto, 1)) ShowPopup(xsc); if (bEnableSound && db_get_b(xsc->hContact, MODULE, "EnableXStatusNotify", 1)) PlayXStatusSound(xsc->action); BYTE enableLog = opt.EnableLogging; if (opt.LDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC) enableLog = FALSE; if (!(templates.LogFlags & xsc->action)) enableLog = FALSE; if (enableLog && db_get_b(xsc->hContact, MODULE, "EnableLogging", 1) && CallService(MS_MSG_MOD_MESSAGEDIALOGOPENED, (WPARAM)xsc->hContact, 0)) LogToMessageWindow(xsc, FALSE); if (opt.Log) LogChangeToFile(xsc); FreeXSC(xsc); }
static void ApplyDownloads(void *param) { HWND hDlg = (HWND)param; ////////////////////////////////////////////////////////////////////////////////////// // if we need to escalate priviledges, launch a atub if (!PrepareEscalation()) { PostMessage(hDlg, WM_CLOSE, 0, 0); return; } ////////////////////////////////////////////////////////////////////////////////////// // ok, let's unpack all zips AutoHandle pipe(hPipe); HWND hwndList = GetDlgItem(hDlg, IDC_LIST_UPDATES); OBJLIST<FILEINFO> &todo = *(OBJLIST<FILEINFO> *)GetWindowLongPtr(hDlg, GWLP_USERDATA); //create needed folders after escalating priviledges. Folders creates when we actually install updates TCHAR tszFileTemp[MAX_PATH], tszFileBack[MAX_PATH]; mir_sntprintf(tszFileBack, _countof(tszFileBack), _T("%s\\Backups"), tszRoot); SafeCreateDirectory(tszFileBack); mir_sntprintf(tszFileTemp, _countof(tszFileTemp), _T("%s\\Temp"), tszRoot); SafeCreateDirectory(tszFileTemp); VARST tszMirandaPath(_T("%miranda_path%")); HANDLE nlc = NULL; for (int i=0; i < todo.getCount(); ++i) { ListView_EnsureVisible(hwndList, i, FALSE); if (todo[i].bEnabled) { // download update ListView_SetItemText(hwndList, i, 1, TranslateT("Downloading...")); if (DownloadFile(&todo[i].File, nlc)) { ListView_SetItemText(hwndList, i, 1, TranslateT("Succeeded.")); if (unzip(todo[i].File.tszDiskPath, tszMirandaPath, tszFileBack,false)) SafeDeleteFile(todo[i].File.tszDiskPath); // remove .zip after successful update } else ListView_SetItemText(hwndList, i, 1, TranslateT("Failed!")); } else ListView_SetItemText(hwndList, i, 1, TranslateT("Skipped.")); } Netlib_CloseHandle(nlc); ShowPopup(TranslateT("Plugin Updater"), TranslateT("Download complete"), POPUP_TYPE_INFO); int rc = MessageBox(hDlg, TranslateT("Download complete. Do you want to go to plugins option page?"), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION); if (rc == IDYES) CallFunctionAsync(OpenPluginOptions, 0); PostMessage(hDlg, WM_CLOSE, 0, 0); }
void TwitterProto::UpdateStatuses(bool pre_read,bool popups) { try { ScopedLock s(twitter_lock_); twitter::status_list updates = twit_.get_statuses(200,since_id_); s.Unlock(); if(!updates.empty()) since_id_ = std::max(since_id_, updates[0].status.id); for(twitter::status_list::reverse_iterator i=updates.rbegin(); i!=updates.rend(); ++i) { if(!pre_read && in_chat_) UpdateChat(*i); if(i->username == twit_.get_username()) continue; HANDLE hContact = AddToClientList(i->username.c_str(),""); DBEVENTINFO dbei = {sizeof(dbei)}; dbei.pBlob = (BYTE*)(i->status.text.c_str()); dbei.cbBlob = i->status.text.size()+1; dbei.eventType = TWITTER_DB_EVENT_TYPE_TWEET; dbei.flags = DBEF_UTF; //dbei.flags = DBEF_READ; dbei.timestamp = static_cast<DWORD>(i->status.time); dbei.szModule = m_szModuleName; CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei); DBWriteContactSettingUTF8String(hContact,"CList","StatusMsg", i->status.text.c_str()); if(!pre_read && popups) ShowContactPopup(hContact,i->status.text); } db_pod_set(0,m_szModuleName,TWITTER_KEY_SINCEID,since_id_); LOG("***** Status messages updated"); } catch(const bad_response &) { LOG("***** Bad response from server, signing off"); SetStatus(ID_STATUS_OFFLINE); } catch(const std::exception &e) { ShowPopup( (std::string("While updating status messages, an error occurred: ") +e.what()).c_str() ); LOG("***** Error updating status messages: %s",e.what()); } }
void ExtraStatusChanged(XSTATUSCHANGE *xsc) { BOOL bEnablePopup = true, bEnableSound = true; char buff[12] = {0}; wsprintfA(buff, "%d", ID_STATUS_EXTRASTATUS); if ((DBGetContactSettingByte(0, MODULE, buff, 1) == 0) || (DBGetContactSettingWord(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) || (!opt.HiddenContactsToo && DBGetContactSettingByte(xsc->hContact, "CList", "Hidden", 0)) || (opt.TempDisabled)) { return; } char statusIDs[12], statusIDp[12]; if (opt.AutoDisable) { WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0); wsprintfA(statusIDs, "s%d", myStatus); wsprintfA(statusIDp, "p%d", myStatus); bEnableSound = DBGetContactSettingByte(0, MODULE, statusIDs, 1) ? FALSE : TRUE; bEnablePopup = DBGetContactSettingByte(0, MODULE, statusIDp, 1) ? FALSE : TRUE; } if (!(templates.PopupFlags & xsc->action)) bEnableSound = bEnablePopup = false; int xstatusID = DBGetContactSettingByte(xsc->hContact, xsc->szProto, "XStatusId", 0); if (opt.PDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC) bEnableSound = bEnablePopup = false; if (bEnablePopup && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableXStatusNotify", 1) && TimeoutCheck()) ShowPopup(xsc); if (bEnableSound && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableXStatusNotify", 1)) PlayXStatusSound(xsc->action); BYTE enableLog = opt.EnableLogging; if (opt.LDisableForMusic && xsc->type == TYPE_ICQ_XSTATUS && xstatusID == XSTATUS_MUSIC) enableLog = FALSE; if (!(templates.LogFlags & xsc->action)) enableLog = FALSE; if (enableLog && DBGetContactSettingByte(xsc->hContact, MODULE, "EnableLogging", 1) && CallService(MS_MSG_MOD_MESSAGEDIALOGOPENED, (WPARAM)xsc->hContact, 0)) { LogToMessageWindow(xsc, FALSE); } if (opt.Log) LogChangeToFile(xsc); }
void CAimProto::login_error(unsigned short error) { switch(error) { case 0x0004: ShowPopup(LPGEN("Invalid Screen Name or password."), ERROR_POPUP); break; case 0x0005: ShowPopup(LPGEN("Mismatched Screen Name or password."), ERROR_POPUP); break; case 0x0018: ShowPopup(LPGEN("You are connecting too frequently. Try waiting 10 minutes to reconnect."), ERROR_POPUP); break; default: ShowPopup(LPGEN("Unknown error occured when attempting to connect."), ERROR_POPUP); break; } }
static void DoGetList() { if (hListThread) ShowPopup(TranslateT("Plugin Updater"), TranslateT("List loading already started!"), POPUP_TYPE_INFO); else if (hwndDialog) { ShowWindow(hwndDialog, SW_SHOW); SetForegroundWindow(hwndDialog); SetFocus(hwndDialog); } else hListThread = mir_forkthread(GetList, 0); }
void DoGetList(int iFlag) { if (hListThread) ShowPopup(0, LPGENT("Plugin Updater"), LPGENT("List loading already started!"), 2, 0); else if (hwndDialog) { ShowWindow(hwndDialog, SW_SHOW); SetForegroundWindow(hwndDialog); SetFocus(hwndDialog); } else if (iFlag) hListThread = mir_forkthread(GetList, 0); }
void CThhylDlg::OnContextMenu(CWnd* pWnd, CPoint point) { // TODO: Add your message handler code here const LPARAM lparam = (point.y << 16) | point.x; if( SendMessage(WM_NCHITTEST, 0, lparam) != HTCLIENT ) { // DefWindowProc(WM_CONTEXTMENU, (WPARAM)pWnd->GetSafeHwnd(), lparam); CDlgBaseWZ::OnContextMenu(pWnd, point); return; } ShowPopup(point); }
void DropDownBase::OnDropButton( wxCommandEvent &WXUNUSED(event)) { if (m_popupWin && m_popupWin->m_ignore_popup) { m_popupWin->m_ignore_popup = false; return; } if (IsPopupShown()) HidePopup(); else ShowPopup(); }
// Show an trace popup void ShowTracePopup(const char *text) { #ifdef _DEBUG static int num = 0; char tmp[1024]; mir_snprintf(tmp, SIZEOF(tmp), "CM TRACE %d: %s", num, text); TRACE(tmp); TRACE("\n"); num++; ShowPopup(tmp, "", POPUP_TYPE_NORMAL); #endif }
/** Signal task bar (for popups). */ void SignalTaskbar(const TimeType *now, int x, int y, Window w, void *data) { TaskBarType *bp = (TaskBarType*)data; TaskEntry *ep; if(w == bp->cp->tray->window && abs(bp->mousex - x) < settings.doubleClickDelta && abs(bp->mousey - y) < settings.doubleClickDelta) { if(GetTimeDifference(now, &bp->mouseTime) >= settings.popupDelay) { ep = GetEntry(bp, x - bp->cp->screenx, y - bp->cp->screeny); if(settings.groupTasks) { if(ep && ep->clients->client->className) { ShowPopup(x, y, ep->clients->client->className, POPUP_TASK); } } else { if(ep && ep->clients->client->name) { ShowPopup(x, y, ep->clients->client->name, POPUP_TASK); } } } } }
void CThhylDlg::OnHelphtml() { // TODO: Add your control notification handler code here // “菜单”按钮 POINT point; CWnd *pBtnHelp = GetDlgItem(IDC_HELPHTML); RECT rect; pBtnHelp->GetWindowRect(&rect); point.x = rect.left; point.y = rect.bottom; ShowPopup(point); }
// MouseDown void PopupSlider::MouseDown(BPoint where) { if (fEnabled && fSliderButtonRect.Contains(where) && !fSlider->LockLooper()) { SetPopupLocation(BPoint(fSliderButtonRect.left + 1.0 - fSlider->ButtonOffset(), -5.0)); where.x -= fSliderButtonRect.left + 1.0; fSlider->SetDragOffset(where.x); // just to be on the safe side (avoid a dead lock) fTracking = true; ShowPopup(&where); // fSlider->SetDragOffset(where.x); } }
void BackupStart(TCHAR *backup_filename) { TCHAR *tm = NULL; LONG cur_state; cur_state = InterlockedCompareExchange((volatile LONG*)&m_state, 1, 0); if (cur_state != 0) { /* Backup allready in process. */ ShowPopup(TranslateT("Database back up in process..."), TranslateT("Error"), NULL); /* Show error message :) */ return; } if (backup_filename != NULL) tm = mir_tstrdup(backup_filename); if (mir_forkthread(BackupThread, (void*)tm) == INVALID_HANDLE_VALUE) { InterlockedExchange((volatile LONG*)&m_state, 0); /* Backup done. */ mir_free(tm); } }
/** Update a clock tray component. */ void SignalClock(const TimeType *now, int x, int y, Window w, void *data) { ClockType *cp = (ClockType*)data; const char *longTime; DrawClock(cp, now); if(cp->cp->tray->window == w && abs(cp->mousex - x) < settings.doubleClickDelta && abs(cp->mousey - y) < settings.doubleClickDelta) { if(GetTimeDifference(now, &cp->mouseTime) >= settings.popupDelay) { longTime = GetTimeString("%c", cp->zone); ShowPopup(x, y, longTime, POPUP_CLOCK); } } }