示例#1
0
void CWinMenu::UnselectMenu()
{	m_itemover = NULL;
	if ( !::IsWindow( GetSafeHwnd() ) ) return;	
	KillSubMenus();
	RedrawWindow();
}
示例#2
0
void CIconListBox::SetItemImage(int iIndex, int iImg)
{
	SetItemData(iIndex, iImg);
	RedrawWindow();
}
示例#3
0
文件: html.c 项目: GeonHun/mctrl
static LRESULT CALLBACK
html_proc(HWND win, UINT msg, WPARAM wp, LPARAM lp)
{
    html_t* html = (html_t*) GetWindowLongPtr(win, 0);

    if(html != NULL  &&  html->ie_win == NULL) {
        /* Let's try to subclass IE window. This is very dirty hack,
         * which allows us to forward keyboard messages properly to
         * IOleInPlaceActiveObject::TranslateAccelerator().
         *
         * Normally this should be done from main app. loop but we do not
         * have it under control in the DLL. */
        html->ie_win = html_find_ie_window(win);
        if(html->ie_win != NULL) {
            HTML_TRACE("html_proc: Subclassing MSIE.");
            html->ie_proc = (WNDPROC) SetWindowLongPtr(html->ie_win,
                            GWLP_WNDPROC, (LONG_PTR) html_ie_subclass_proc);
            SetProp(html->ie_win, ie_prop, (HANDLE) html);

            if(GetFocus() == win) {
                SetFocus(html->ie_win);
                MC_SEND(html->ie_win, WM_LBUTTONDOWN, 0, 0);
                MC_SEND(html->ie_win, WM_LBUTTONUP, 0, 0);
            }
        }
    }

    switch(msg) {
        case MC_HM_GOTOURLW:
        case MC_HM_GOTOURLA:
        {
            int res = html_goto_url(html, (const void*)lp, (msg == MC_HM_GOTOURLW));
            return (res == 0 ? TRUE : FALSE);
        }

        case MC_HM_SETTAGCONTENTSW:
        case MC_HM_SETTAGCONTENTSA:
        {
            int res = html_set_element_contents(html, (void*)wp, (void*)lp,
                                                (msg == MC_HM_SETTAGCONTENTSW));
            return (res == 0 ? TRUE : FALSE);
        }

        case MC_HM_GOBACK:
        {
            int res = html_goto_back(html, wp);
            return (res == 0 ? TRUE : FALSE);
        }

        case MC_HM_CANBACK:
            return ((wp ? html->can_back : html->can_forward) ? TRUE : FALSE);

        case WM_SIZE:
        {
            IWebBrowser2* browser_iface;
            HRESULT hr;

            hr = html->browser_obj->lpVtbl->QueryInterface(html->browser_obj,
                        &IID_IWebBrowser2, (void**)&browser_iface);
            if(hr == S_OK  &&  browser_iface != NULL) {
                browser_iface->lpVtbl->put_Width(browser_iface, LOWORD(lp));
                browser_iface->lpVtbl->put_Height(browser_iface, HIWORD(lp));
                browser_iface->lpVtbl->Release(browser_iface);
            }
            return 0;
        }

        case WM_STYLECHANGED:
            if(wp == GWL_STYLE) {
                STYLESTRUCT* ss = (STYLESTRUCT*) lp;
                html->style = ss->styleNew;
                RedrawWindow(win, NULL, NULL,
                             RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN);
            }
            break;

        case WM_NOTIFYFORMAT:
            if(lp == NF_REQUERY)
                html_notify_format(html);
            return (html->unicode_notifications ? NFR_UNICODE : NFR_ANSI);

        case CCM_SETUNICODEFORMAT:
        {
            BOOL tmp = html->unicode_notifications;
            html->unicode_notifications = (wp != 0);
            return tmp;
        }

        case CCM_GETUNICODEFORMAT:
            return html->unicode_notifications;

        case CCM_SETNOTIFYWINDOW:
        {
            HWND old = html->notify_win;
            html->notify_win = (wp ? (HWND) wp : GetAncestor(win, GA_PARENT));
            return (LPARAM) old;
        }

        case WM_SETFOCUS:
            if(html->ie_win) {
                SetFocus(html->ie_win);
                MC_SEND(html->ie_win, WM_LBUTTONDOWN, 0, 0);
                MC_SEND(html->ie_win, WM_LBUTTONUP, 0, 0);
            }
            return 0;

        case WM_GETDLGCODE:
            return DLGC_WANTALLKEYS;

        case WM_SETTEXT:
            return FALSE;

        case WM_GETTEXT:
            if(wp > 0)
                ((TCHAR*)lp)[0] = _T('\0');
            return 0;

        case WM_GETTEXTLENGTH:
            return 0;

        case WM_NCCREATE:
            html = html_nccreate(win, (CREATESTRUCT*)lp);
            if(MC_ERR(html == NULL))
                return FALSE;
            SetWindowLongPtr(win, 0, (LONG_PTR)html);
            return TRUE;

        case WM_CREATE:
            return (html_create(html, (CREATESTRUCT*)lp) == 0 ? 0 : -1);

        case WM_DESTROY:
            html_destroy(html);
            return 0;

        case WM_NCDESTROY:
            if(html)
                html_ncdestroy(html);
            return 0;
    }

    /* Forward keystrokes to the IE */
    if(WM_KEYFIRST <= msg  &&  msg <= WM_KEYLAST) {
        if(html->ie_win)
            MC_SEND(html->ie_win, msg, wp, lp);
        return 0;
    }

    return DefWindowProc(win, msg, wp, lp);
}
示例#4
0
void CHistoryPane::Down()
{
  m_uTopItem++;	
  m_bSendScroll = true;
  RedrawWindow();
}
示例#5
0
LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ClcContact *contact;
	ClcGroup *group;
	BOOL frameHasTitlebar = FALSE;

	if (wndFrameCLC)
		frameHasTitlebar = wndFrameCLC->TitleBar.ShowTitleBar;

	ClcData *dat = (struct ClcData *)GetWindowLongPtr(hwnd, 0);
	if (msg >= CLM_FIRST && msg < CLM_LAST)
		return ProcessExternalMessages(hwnd, dat, msg, wParam, lParam);

	switch (msg) {
	case WM_CREATE:
		dat = (struct ClcData *)mir_calloc(sizeof(struct ClcData));
		SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);

		RowHeight::Init(dat);
		dat->forceScroll = 0;
		dat->lastRepaint = 0;
		dat->hwndParent = GetParent(hwnd);
		dat->lastSort = GetTickCount();
		dat->needsResort = FALSE;
		{
			CREATESTRUCT *cs = (CREATESTRUCT *)lParam;
			if (cs->lpCreateParams == (LPVOID)0xff00ff00) {
				dat->bisEmbedded = FALSE;
				dat->bHideSubcontacts = TRUE;
				cfg::clcdat = dat;
				if (cfg::dat.bShowLocalTime)
					SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL);
			}
			else
				dat->bisEmbedded = TRUE;
		}
		break;

	case WM_SIZE:
		pcli->pfnEndRename(hwnd, dat, 1);
		KillTimer(hwnd, TIMERID_INFOTIP);
		KillTimer(hwnd, TIMERID_RENAME);
		pcli->pfnRecalcScrollBar(hwnd, dat);
LBL_Def:
		return DefWindowProc(hwnd, msg, wParam, lParam);

	case WM_NCCALCSIZE:
		return FrameNCCalcSize(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);

		/*
		* scroll bar handling
		*/
	case WM_NCPAINT:
		return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar);

	case INTM_GROUPCHANGED:
		{
			WORD iExtraImage[EXTRA_ICON_COUNT];
			BYTE flags = 0;
			if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
				memset(iExtraImage, 0xFF, sizeof(iExtraImage));
			else {
				memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage));
				flags = contact->flags;
			}
			pcli->pfnDeleteItemFromTree(hwnd, wParam);
			if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(wParam, NULL, dat)) {
				pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1);
				if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
					memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage));
					if (flags & CONTACTF_CHECKED)
						contact->flags |= CONTACTF_CHECKED;
				}

				NMCLISTCONTROL nm;
				nm.hdr.code = CLN_CONTACTMOVED;
				nm.hdr.hwndFrom = hwnd;
				nm.hdr.idFrom = GetDlgCtrlID(hwnd);
				nm.flags = 0;
				nm.hItem = (HANDLE)wParam;
				SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm);
			}
			dat->needsResort = TRUE;
			PostMessage(hwnd, INTM_SORTCLC, 0, 1);
		}
		goto LBL_Def;

	case INTM_ICONCHANGED:
		{
			int recalcScrollBar = 0;
			MCONTACT hContact = wParam;
			WORD status = ID_STATUS_OFFLINE;
			int  contactRemoved = 0;
			MCONTACT hSelItem = NULL;
			ClcContact *selcontact = NULL;

			char *szProto = GetContactProto(hContact);
			if (szProto == NULL)
				status = ID_STATUS_OFFLINE;
			else
				status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE);

			int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN ||
				!CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) ||
				pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown

			if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, &group, NULL)) {
				if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) {
					if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
						hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
					pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0);
					recalcScrollBar = 1;
					FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL);
					if (contact) {
						contact->iImage = (WORD)lParam;
						pcli->pfnNotifyNewContact(hwnd, hContact);
					}
				}
			}
			else {
				//item in list already
				DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
				if (contact->iImage == (WORD)lParam)
					break;
				if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) {        // CLVM changed
					if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1)
						hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact);
					pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0);
					contactRemoved = TRUE;
					recalcScrollBar = 1;
				}
				else {
					contact->iImage = (WORD)lParam;
					if (!pcli->pfnIsHiddenMode(dat, status))
						contact->flags |= CONTACTF_ONLINE;
					else
						contact->flags &= ~CONTACTF_ONLINE;
				}
			}
			if (hSelItem) {
				ClcGroup *selgroup;
				if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL))
					dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact));
				else
					dat->selection = -1;
			}
			dat->needsResort = TRUE;
			PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar);
			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam));
			if (recalcScrollBar)
				pcli->pfnRecalcScrollBar(hwnd, dat);
		}
		goto LBL_Def;

	case INTM_METACHANGED:
		if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
			break;

		if (contact->bIsMeta && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) {
			contact->hSubContact = db_mc_getMostOnline(contact->hContact);
			contact->metaProto = GetContactProto(contact->hSubContact);
			contact->iImage = pcli->pfnGetContactIcon(contact->hSubContact);
			if (contact->pExtra) {
				TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto);
				ClcContact *subContact;
				if (!pcli->pfnFindItem(hwnd, dat, contact->hSubContact, &subContact, NULL, NULL))
					break;

				contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto);
				if (pSub) {
					contact->pExtra->status_item = pSub->status_item;
					memcpy(contact->iExtraImage, subContact->iExtraImage, sizeof(contact->iExtraImage));
				}
			}
		}
		SendMessage(hwnd, INTM_NAMEORDERCHANGED, wParam, lParam);
		goto LBL_Def;

	case INTM_METACHANGEDEVENT:
		if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
			break;
		if (lParam == 0)
			pcli->pfnInitAutoRebuild(hwnd);
		goto LBL_Def;

	case INTM_NAMECHANGED:
		ClcContact *contact;
		if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
			break;
		mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));

		RTL_DetectAndSet(contact, 0);

		dat->needsResort = TRUE;
		PostMessage(hwnd, INTM_SORTCLC, 0, 0);
		goto LBL_Def;

	case INTM_CODEPAGECHANGED:
		if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
			break;
		contact->codePage = cfg::getDword(wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword(wParam, "UserInfo", "ANSIcodepage", CP_ACP));
		PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
		goto LBL_Def;

	case INTM_AVATARCHANGED:
		contact = NULL;
		{
			avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam;

			if (wParam == 0) {
				//RemoveFromImgCache(0, cEntry);
				cfg::dat.bForceRefetchOnPaint = TRUE;
				RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);
				cfg::dat.bForceRefetchOnPaint = FALSE;
				goto LBL_Def;
			}

			if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
				return 0;
			contact->ace = cEntry;
			if (cEntry == NULL)
				contact->cFlags &= ~ECF_AVATAR;
			else {
				DWORD dwFlags;

				if (contact->pExtra)
					dwFlags = contact->pExtra->dwDFlags;
				else
					dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0);
				if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS)
					contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR);
				else
					contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR);
			}
			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact);
		}
		goto LBL_Def;

	case INTM_STATUSMSGCHANGED:
		{
			TExtraCache *p;
			char *szProto = NULL;

			if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
				p = cfg::getCache(wParam, NULL);
			else {
				p = contact->pExtra;
				szProto = contact->proto;
			}
			GetCachedStatusMsg(p, szProto);
			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
		}
		goto LBL_Def;

	case INTM_STATUSCHANGED:
		if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
			WORD wStatus = cfg::getWord(wParam, contact->proto, "Status", ID_STATUS_OFFLINE);
			if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) {
				contact->wStatus = wStatus;
				if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL)
					LoadAvatarForContact(contact);
			}
			contact->wStatus = wStatus;
			goto LBL_Def;
		}
		break;

	case INTM_PROTOCHANGED:
		if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
			break;

		contact->proto = GetContactProto(wParam);
		CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
		mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));

		RTL_DetectAndSet(contact, 0);

		dat->needsResort = TRUE;
		PostMessage(hwnd, INTM_SORTCLC, 0, 0);
		goto LBL_Def;

	case INTM_INVALIDATE:
		if (!dat->bNeedPaint) {
			KillTimer(hwnd, TIMERID_PAINT);
			SetTimer(hwnd, TIMERID_PAINT, 100, NULL);
			dat->bNeedPaint = TRUE;
		}
		goto LBL_Def;

	case INTM_INVALIDATECONTACT:
		if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL))
			break;

		if (contact && group) {
			int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact));
			pcli->pfnInvalidateItem(hwnd, dat, iItem);
			goto LBL_Def;
		}
		break;

	case INTM_FORCESORT:
		dat->needsResort = TRUE;
		return SendMessage(hwnd, INTM_SORTCLC, wParam, lParam);

	case INTM_SORTCLC:
		if (dat->needsResort) {
			pcli->pfnSortCLC(hwnd, dat, TRUE);
			dat->needsResort = FALSE;
		}
		if (lParam)
			pcli->pfnRecalcScrollBar(hwnd, dat);
		goto LBL_Def;

	case INTM_IDLECHANGED:
		if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
			DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
			char *szProto = (char*)cws->szModule;
			if (szProto == NULL)
				break;

			contact->flags &= ~CONTACTF_IDLE;
			if (cfg::getDword(wParam, szProto, "IdleTS", 0)) {
				contact->flags |= CONTACTF_IDLE;
			}
			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact);
			goto LBL_Def;
		}
		break;

	case INTM_XSTATUSCHANGED:
		{
			DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
			char *szProto = (char *)cws->szModule;
			MCONTACT hContact = wParam;
			TExtraCache *p;

			if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) {
				p = cfg::getCache(hContact, szProto);
				if (!dat->bisEmbedded && szProto) {				// may be a subcontact, forward the xstatus
					MCONTACT hMasterContact = db_mc_tryMeta(hContact);
					if (hMasterContact != hContact)				// avoid recursive call of settings handler
						cfg::writeByte(hMasterContact, META_PROTO, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0));
					break;
				}
			}
			else {
				contact->xStatus = cfg::getByte(hContact, szProto, "XStatusId", 0);
				p = contact->pExtra;
			}

			if (szProto == NULL)
				break;

			if (contact) {
				if (ProtoServiceExists(szProto, PS_GETADVANCEDSTATUSICON)) {
					int iconId = ProtoCallService(szProto, PS_GETADVANCEDSTATUSICON, hContact, 0);
					if (iconId != -1)
						contact->xStatusIcon = iconId >> 16;
				}
			}

			GetCachedStatusMsg(p, szProto);
			PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0));
		}
		goto LBL_Def;

	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			HDC hdc = BeginPaint(hwnd, &ps);
			if (IsWindowVisible(hwnd) && !during_sizing && !cfg::shutDown) {
				PaintClc(hwnd, dat, hdc, &ps.rcPaint);
				dat->bNeedPaint = FALSE;
				dat->lastRepaint = GetTickCount();
			}
			EndPaint(hwnd, &ps);
			if (dat->selection != dat->oldSelection && !dat->bisEmbedded && g_ButtonItems != NULL) {
				SetDBButtonStates(0);
				dat->oldSelection = dat->selection;
			}
		}
		goto LBL_Def;

	case WM_MOUSEWHEEL:
		dat->forceScroll = TRUE;
		break;

	case WM_TIMER:
		if (wParam == TIMERID_PAINT) {
			KillTimer(hwnd, TIMERID_PAINT);
			InvalidateRect(hwnd, NULL, FALSE);
			goto LBL_Def;
		}

		if (wParam == TIMERID_REFRESH) {
			InvalidateRect(hwnd, NULL, FALSE);
			goto LBL_Def;
		}
		break;

	case WM_LBUTTONDBLCLK:
		ReleaseCapture();
		dat->iHotTrack = -1;
		pcli->pfnHideInfoTip(hwnd, dat);
		KillTimer(hwnd, TIMERID_RENAME);
		KillTimer(hwnd, TIMERID_INFOTIP);
		dat->szQuickSearch[0] = 0;
		{
			DWORD hitFlags;
			dat->selection = HitTest(hwnd, dat, (short) LOWORD(lParam), (short) HIWORD(lParam), &contact, NULL, &hitFlags);
			if (hitFlags & CLCHT_ONITEMEXTRA)
				break;

			InvalidateRect(hwnd, NULL, FALSE);
			if (dat->selection != -1)
				pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
			if (hitFlags & CLCHT_ONAVATAR && cfg::dat.bDblClkAvatars) {
				CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)contact->hContact, 0);
				return TRUE;
			}
			if (hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMSPACE)) {
				UpdateWindow(hwnd);
				pcli->pfnDoSelectionDefaultAction(hwnd, dat);
			}
		}
		return TRUE;

	case WM_CONTEXTMENU:
		{
			HMENU hMenu = NULL;
			POINT pt;
			DWORD hitFlags;

			pcli->pfnEndRename(hwnd, dat, 1);
			pcli->pfnHideInfoTip(hwnd, dat);
			KillTimer(hwnd, TIMERID_RENAME);
			KillTimer(hwnd, TIMERID_INFOTIP);
			if (GetFocus() != hwnd)
				SetFocus(hwnd);
			dat->iHotTrack = -1;
			dat->szQuickSearch[0] = 0;
			pt.x = (short) LOWORD(lParam);
			pt.y = (short) HIWORD(lParam);
			if (pt.x == -1 && pt.y == -1) {
				dat->selection = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL);
				if (dat->selection != -1)
					pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
				pt.x = dat->iconXSpace + 15;
				pt.y = RowHeight::getItemTopY(dat, dat->selection) - dat->yScroll + (int)(dat->row_heights[dat->selection] * .7);
				hitFlags = dat->selection == -1 ? CLCHT_NOWHERE : CLCHT_ONITEMLABEL;
			}
			else {
				ScreenToClient(hwnd, &pt);
				dat->selection = HitTest(hwnd, dat, pt.x, pt.y, &contact, NULL, &hitFlags);
			}
			InvalidateRect(hwnd, NULL, FALSE);
			if (dat->selection != -1)
				pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
			UpdateWindow(hwnd);

			if (dat->selection != -1 && hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMCHECK | CLCHT_ONITEMLABEL)) {
				if (contact->type == CLCIT_GROUP) {
					hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDSUBGROUP, (WPARAM)contact->group, 0);
					ClientToScreen(hwnd, &pt);
					TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
					CheckMenuItem(hMenu, POPUP_GROUPHIDEOFFLINE, contact->group->hideOffline ? MF_CHECKED : MF_UNCHECKED);
					DestroyMenu(hMenu);
					return 0;
				} else if (contact->type == CLCIT_CONTACT)
					hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM) contact->hContact, 0);
			} else {
				//call parent for new group/hide offline menu
				PostMessage(GetParent(hwnd), WM_CONTEXTMENU, wParam, lParam);
				return 0;
			}
			if (hMenu != NULL) {
				ClientToScreen(hwnd, &pt);
				TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
				DestroyMenu(hMenu);
			}
		}
		return 0;

	case WM_COMMAND:
		if (LOWORD(wParam) == POPUP_NEWGROUP)
			SendMessage(GetParent(hwnd), msg, wParam, lParam);
		break;

	case WM_NCHITTEST:
		{
			LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam);
			if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT
				|| lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT)
				return HTTRANSPARENT;
		}
		break;

	case WM_DESTROY:
		RowHeight::Free(dat);
		break;
	}

	return coreCli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam);
}
示例#6
0
LRESULT CALLBACK
waoWC_buttonChkProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{   static TRACKMOUSEEVENT tME;
    switch( msg )
    {
        case WM_CREATE:
        {
            tME.cbSize = sizeof( TRACKMOUSEEVENT );
            tME.dwHoverTime = 0;
            SendMessage( GetParent( hwnd ),
                         WAOM_TBBTNCREATED,
                         MAKEWPARAM( WAOM_TBBTNCREATED_LW, GetWindowLong( hwnd, GWL_ID ) ),
                         ( LPARAM ) hwnd );
        }
        case WM_MOUSELEAVE:
        if( !( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CHECKED ) )
        {
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_NORMAL );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
        }
        else
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_CHECKED | WAO_TBBS_NORMAL );
        break;
        case WM_LBUTTONUP:
        {
            // should be clicked first:
            if( !( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CLICKED ) )
                return FALSE;
            if( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CHECKED )
            {
                if( !( GetWindowLong( hwnd, GWL_STYLE ) & BS_AUTORADIOBUTTON ) )
                {
                    SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_HOVERED );
                    tME.dwFlags = TME_LEAVE;
                    tME.hwndTrack = hwnd;
                    TrackMouseEvent( &tME );
                }
            }
            else
            {
                SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_CHECKED );
                if( GetWindowLong( hwnd, GWL_STYLE ) & BS_RADIOBUTTON )
                {
                    long wStyle;
                    HWND t_hndWnd = hwnd;
                    while( t_hndWnd = GetWindow( t_hndWnd, GW_HWNDPREV ) )
                    {
                        wchar_t buffer[ 16 ];
                        GetClassName( t_hndWnd, buffer, 15 );
                        if( lstrcmp( buffer, L"wao_BUTTON_Chk" ) )
                            break;
                        wStyle = GetWindowLong( t_hndWnd, GWL_STYLE );
                        if( !( wStyle & BS_RADIOBUTTON ) )
                            break;
                        SetWindowLong( t_hndWnd, GWL_USERDATA, WAO_TBBS_NORMAL );
                        RedrawWindow( t_hndWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
                        if( wStyle & WS_GROUP )
                            break;
                    }
                    t_hndWnd = hwnd;
                    while( t_hndWnd = GetWindow( t_hndWnd, GW_HWNDNEXT ) )
                    {
                        wchar_t buffer[ 16 ];
                        GetClassName( t_hndWnd, buffer, 15 );
                        if( lstrcmp( buffer, L"wao_BUTTON_Chk" ) )
                            break;
                        wStyle = GetWindowLong( t_hndWnd, GWL_STYLE );
                        if( !( wStyle & BS_RADIOBUTTON ) )
                            break;
                        SetWindowLong( t_hndWnd, GWL_USERDATA, WAO_TBBS_NORMAL );
                        RedrawWindow( t_hndWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
                        if( wStyle & WS_GROUP )
                            break;
                    }
                }
            }
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
// RADIO BUTTON
            DLGPROC parProc = ( DLGPROC ) GetWindowLong( GetParent( hwnd ), DWL_DLGPROC );
            parProc( GetParent( hwnd ),
                     WM_COMMAND,
                     MAKEWPARAM( GetWindowLong( hwnd, GWL_ID ), WAO_TBBN_LCLCKED ),
                     ( LPARAM ) hwnd );

        }
        break;
        default:
        return( waoWC_button0Proc( hwnd, msg, wParam, lParam ) );
    }
}
示例#7
0
static BOOL CALLBACK SpectrumPopupProc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	switch(msg)
	{
	case WM_INITDIALOG:
		uSetWindowLong(wnd,DWL_USER,lp);
		{
			spec_param * ptr = reinterpret_cast<spec_param*>(lp);
			ptr->m_scope.initialize(FindOwningPopup(wnd));
			uSendDlgItemMessage(wnd, IDC_BARS, BM_SETCHECK, ptr->ptr->mode == MODE_BARS, 0);
			HWND wnd_combo = GetDlgItem(wnd, IDC_FRAME_COMBO);
			EnableWindow(wnd_combo, ptr->b_show_frame);
			if (ptr->b_show_frame)
			{
				ComboBox_AddString(wnd_combo, _T("None"));
				ComboBox_AddString(wnd_combo, _T("Sunken"));
				ComboBox_AddString(wnd_combo, _T("Grey"));
				ComboBox_SetCurSel(wnd_combo, ptr->frame);
			}
			wnd_combo = GetDlgItem(wnd, IDC_SCALE);
			ComboBox_AddString(wnd_combo, _T("Linear"));
			ComboBox_AddString(wnd_combo, _T("Logarithmic"));
			ComboBox_SetCurSel(wnd_combo, ptr->m_scale);

			wnd_combo = GetDlgItem(wnd, IDC_VERTICAL_SCALE);
			ComboBox_AddString(wnd_combo, _T("Linear"));
			ComboBox_AddString(wnd_combo, _T("Logarithmic"));
			ComboBox_SetCurSel(wnd_combo, ptr->m_vertical_scale);
		}
		return TRUE;
	case WM_ERASEBKGND:
		SetWindowLongPtr(wnd, DWL_MSGRESULT, TRUE);
		return TRUE;
	case WM_PAINT:
		ui_helpers::innerWMPaintModernBackground(wnd, GetDlgItem(wnd, IDOK));
		return TRUE;
	case WM_CTLCOLORSTATIC:
		{
			spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
			if (GetDlgItem(wnd, IDC_PATCH_FORE) == (HWND)lp) {
				HDC dc =(HDC)wp;
				if (!ptr->br_fore) 
				{
					ptr->br_fore = CreateSolidBrush(ptr->cr_fore);
				}
				return (BOOL)ptr->br_fore;
			} 
			else if (GetDlgItem(wnd, IDC_PATCH_BACK) == (HWND)lp) 
			{
				HDC dc =(HDC)wp;
				if (!ptr->br_back) 
				{
					ptr->br_back = CreateSolidBrush(ptr->cr_back);
				}
				return (BOOL)ptr->br_back;
			}
			else
			return (BOOL)GetSysColorBrush(COLOR_3DHIGHLIGHT);
		}
		break;
	case WM_COMMAND:
		switch(wp)
		{
		case IDCANCEL:
			EndDialog(wnd,0);
			return TRUE;
		case IDC_CHANGE_BACK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				COLORREF COLOR = ptr->cr_back;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_BACK),GetSysColor(COLOR_3DFACE),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_back = COLOR;
					ptr->flush_back();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_BACK), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_CHANGE_FORE:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				COLORREF COLOR = ptr->cr_fore;
				COLORREF COLORS[16] = {get_default_colour(colours::COLOUR_TEXT),GetSysColor(COLOR_3DSHADOW),0,0,0,0,0,0,0,0,0,0,0,0,0,0};
				if (uChooseColor(&COLOR, wnd, &COLORS[0]))
				{
					ptr->cr_fore = COLOR;
					ptr->flush_fore();
					RedrawWindow(GetDlgItem(wnd, IDC_PATCH_FORE), 0, 0, RDW_INVALIDATE|RDW_UPDATENOW);
				}
			}
			break;
		case IDC_BARS:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->mode = (uSendMessage((HWND)lp, BM_GETCHECK, 0, 0) != TRUE ? MODE_STANDARD : MODE_BARS);
			}
			break;
		case IDC_FRAME_COMBO|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->frame = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->m_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDC_VERTICAL_SCALE|(CBN_SELCHANGE<<16):
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				ptr->m_vertical_scale = ComboBox_GetCurSel(HWND(lp));
			}
			break;
		case IDOK:
			{
				spec_param * ptr = reinterpret_cast<spec_param*>(uGetWindowLong(wnd,DWL_USER));
				EndDialog(wnd,1);
			}
			return TRUE;
		default:
			return FALSE;
		}
	default:
		return FALSE;
	}
}
示例#8
0
void ListViewControl::RedrawHeader()
{
	HWND hHeader = (HWND)SendMessage(getHandle(), LVM_GETHEADER, 0, 0);
	RedrawWindow(hHeader, NULL, NULL, RDW_INVALIDATE);
}
void CTaskbarNotifier::SetTextColor(COLORREF crNormalTextColor,COLORREF crSelectedTextColor)
{
	m_crNormalTextColor=crNormalTextColor;
	m_crSelectedTextColor=crSelectedTextColor;
	RedrawWindow();
}
//*****************************************************************************
void CBCGPDBGridCtrl::Sort (int nColumn, BOOL bAscending, BOOL bAdd)
{
    if (m_bIsSorting || !CanSortByColumn (nColumn))
    {
        return;
    }

    if (!m_bDbSort || m_strSQL.IsEmpty ())
    {
        CBCGPGridCtrl::Sort (nColumn, bAscending, bAdd);
        return;
    }

    SetCurSel (NULL);

    m_CachedItems.CleanUpCache ();

    CString strSQLOrign = m_strSQL;

    CString strColumn = GetColumnName (nColumn);
    if (strColumn.Find (_T(' ')) >= 0)
    {
        strColumn = _T('\'') + strColumn + _T('\'');
    }

    CString strSQL;
    strSQL.Format (_T("%s ORDER BY %s %s"),
                   m_strSQL, strColumn,
                   bAscending ? _T(" ASC") : _T(" DESC"));

    if (bAdd)
    {
        for (POSITION pos = m_Columns.m_mapSortColumn.GetStartPosition (); pos != NULL; )
        {
            int nListColumn, nState;

            m_Columns.m_mapSortColumn.GetNextAssoc (pos, nListColumn, nState);

            if (nState != 0 && nListColumn != nColumn)
            {
                CString strListColumn = GetColumnName (nListColumn);
                if (strListColumn.Find (_T(' ')) >= 0)
                {
                    strListColumn = _T('\'') + strListColumn + _T('\'');
                }

                CString strOrder;
                strOrder.Format (_T(", %s %s"),
                                 strListColumn,
                                 nState > 0 ? _T(" ASC") : _T(" DESC"));

                strSQL += strOrder;
            }
        }
    }

    CWaitCursor wait;

    m_bRebuildTerminalItems = TRUE;

    m_bIsSorting = TRUE;

    if (OpenSQL (strSQL))
    {
        m_Columns.SetSortColumn (nColumn, bAscending, bAdd);
    }

    RedrawWindow (m_rectHeader);

    m_bIsSorting = FALSE;
    m_strSQL = strSQLOrign;
}
示例#11
0
LRESULT track_bar::on_message(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
	switch(msg)
	{
	case WM_NCCREATE:
		break;
	case WM_CREATE:
		{
			if (IsThemeActive() && IsAppThemed())
			{
				m_theme = OpenThemeData(wnd, L"Trackbar");
			}
		}
		break;
	case WM_THEMECHANGED:
		{
			{
				if (m_theme)
				{
					CloseThemeData(m_theme);
					m_theme=0;
				}
				if (IsThemeActive() && IsAppThemed())
					m_theme = OpenThemeData(wnd, L"Trackbar");
			}
		}
		break;
	case WM_DESTROY:
		{
			if (m_hook_registered)
			{
				message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this);
				m_hook_registered=false;
			}
			{
				if (m_theme) CloseThemeData(m_theme);
				m_theme=0;
			}
		}
		break;
	case WM_NCDESTROY:
		break;
	case WM_SIZE:
		RedrawWindow(wnd, 0, 0, RDW_INVALIDATE|RDW_ERASE);
		break;
	case WM_MOUSEMOVE:
		{

			POINT pt = {GET_X_LPARAM(lp), GET_Y_LPARAM(lp)};
			if (m_dragging)
			{
				if (!m_last_mousemove.m_valid || wp != m_last_mousemove.m_wp || lp != m_last_mousemove.m_lp)
				{
					if (get_enabled()) 
					{
						unsigned pos = calculate_position_from_point(pt);
						set_position_internal(pos);
						if (m_wnd_tooltip && m_host)
						{
							POINT pts = pt;
							ClientToScreen(wnd, &pts);
							track_bar_string temp;
							m_host->get_tooltip_text(pos, temp);
							update_tooltip(pts, temp.data());
						}
						if (m_host)
							m_host->on_position_change(pos, true);
					}
				}
				m_last_mousemove.m_valid = true;
				m_last_mousemove.m_wp = wp;
				m_last_mousemove.m_lp = lp;
			}
			else
			{
				update_hot_status(pt);
			}
		}
		break;
	case WM_ENABLE:
		{
			RECT rc;
			get_thumb_rect(&rc);
			InvalidateRect(wnd, &rc, TRUE);
		}
		break;
	case WM_MBUTTONDOWN:
	case WM_RBUTTONDOWN:
	case WM_XBUTTONDOWN:
		{
			if (get_enabled() && get_auto_focus() && GetFocus() != wnd) 
				SetFocus(wnd);

			if (m_dragging)
			{
				destroy_tooltip();
				if (GetCapture() == wnd)
					ReleaseCapture();
				message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this);
				m_hook_registered=false;
				//SetFocus(IsWindow(m_wnd_prev) ? m_wnd_prev : uFindParentPopup(wnd));
				m_dragging = false;
				set_position_internal(m_position);
			}
		}
		break;
	case WM_LBUTTONDOWN:
		{
			if (get_enabled()) 
			{
				if (get_auto_focus() && GetFocus() != wnd) 
					SetFocus(wnd);

				POINT pt; 

				pt.x = GET_X_LPARAM(lp);
				pt.y = GET_Y_LPARAM(lp);

				RECT rc_client;
				GetClientRect(wnd, &rc_client);

				if (PtInRect(&rc_client, pt))
				{
					m_dragging = true;
					SetCapture(wnd);

					//SetFocus(wnd);
					message_hook_manager::register_hook(message_hook_manager::type_keyboard, this);
					m_hook_registered=true;

					unsigned pos = calculate_position_from_point(pt);
					set_position_internal(pos);
					POINT pts = pt;
					ClientToScreen(wnd, &pts);
					if (m_show_tooltips && m_host)
					{
						track_bar_string temp;
						m_host->get_tooltip_text(pos, temp);
						create_tooltip(temp.data(), pts);
					}
				}
				m_last_mousemove.m_valid = false;
			}
		}
		return 0;
	case WM_LBUTTONUP:
		{
			if (m_dragging)
			{
				destroy_tooltip();
				if (GetCapture() == wnd)
					ReleaseCapture();
				m_dragging = false;
				if (get_enabled()) 
				{
					POINT pt; 

					pt.x = GET_X_LPARAM(lp);
					pt.y = GET_Y_LPARAM(lp);

					unsigned pos = calculate_position_from_point(pt);
					set_position(pos);
				}
				//SetFocus(IsWindow(m_wnd_prev) ? m_wnd_prev : uFindParentPopup(wnd));
				message_hook_manager::deregister_hook(message_hook_manager::type_keyboard, this);
				m_hook_registered = false;
				if (m_host)
					m_host->on_position_change(m_display_position, false);

				m_last_mousemove.m_valid = false;
			}
		}
		return 0;
	case WM_KEYDOWN:
	case WM_KEYUP:
		{
			if ((wp == VK_ESCAPE || wp == VK_RETURN) && m_host && m_host->on_key(wp, lp))
				return 0;
			if ( !(lp & (1<<31)) && (wp == VK_LEFT || wp == VK_DOWN || wp == VK_RIGHT || wp == VK_UP))
			{
				bool down = (wp == VK_LEFT || wp == VK_UP) == false;//!get_direction();
				unsigned newpos = m_position;
				if (down && m_step > m_position)
					newpos = 0;
				else if (!down && m_step + m_position > m_range)
					newpos = m_range;
				else
					newpos += down ? -(int)m_step : m_step;
				if (newpos != m_position)
				{
					set_position(newpos);
					if (m_host)
						m_host->on_position_change(m_position, false);
				}
			}
			if ( !(lp & (1<<31)) && (wp == VK_HOME || wp == VK_END))
			{
				bool down = (wp == VK_END) == false;//!get_direction();
				unsigned newpos = m_position;
				if (down) newpos = m_range;
				else newpos = 0;
				if (newpos != m_position)
				{
					set_position(newpos);
					if (m_host)
						m_host->on_position_change(m_position, false);
				}
			}
		}
		break;
	case WM_MOUSEWHEEL:
		{
			UINT ucNumLines=3;  // 3 is the default
			SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &ucNumLines, 0);
			unsigned short fwKeys = GET_KEYSTATE_WPARAM(wp);
			short zDelta = GET_WHEEL_DELTA_WPARAM(wp);
			int xPos = GET_X_LPARAM(lp); 
			int yPos = GET_Y_LPARAM(lp);
			if (ucNumLines == WHEEL_PAGESCROLL)
				ucNumLines = 3;
			int delta = MulDiv(m_step*zDelta, ucNumLines, WHEEL_DELTA);
			bool down = delta < 0;
			//if (get_direction()) down = down == false;
			if (!get_orientation()) down = down == false;
			if (m_mouse_wheel_reversed)
				 down = down == false;
			unsigned offset = abs(delta);

			unsigned newpos = m_position;
			if (down && offset > m_position)
				newpos = 0;
			else if (!down && offset + m_position > m_range)
				newpos = m_range;
			else
				newpos += down ? -(int)offset : offset;
			if (newpos != m_position)
			{
				set_position(newpos);
				if (m_host)
					m_host->on_position_change(m_position, false);
			}
		}
		return 0;
#if 0
	case WM_KEYDOWN:
		if (wp == VK_ESCAPE)
		{
			destroy_tooltip();
			if (GetCapture() == wnd)
				ReleaseCapture();
			SetFocus(IsWindow(m_wnd_prev) ? m_wnd_prev : uFindParentPopup(wnd));
			m_dragging = false;
			set_position_internal(m_position);
			return 0;
		}
		break;
	case WM_SETFOCUS:
		m_wnd_prev = (HWND)wp;
		break;
#endif
	case WM_MOVE:
		RedrawWindow(wnd, NULL, NULL, RDW_ERASE|RDW_INVALIDATE);
		break;
	case WM_ERASEBKGND:
		return FALSE;
	case WM_PAINT:
		{
			RECT rc_client;
			GetClientRect(wnd, &rc_client);

			PAINTSTRUCT ps;

			HDC dc = BeginPaint(wnd, &ps);

			RECT rc_thumb;

			get_thumb_rect(&rc_thumb);

			RECT rc_track; //channel
			get_channel_rect(&rc_track);

			//Offscreen rendering to eliminate flicker
			HDC dc_mem = CreateCompatibleDC(dc);

			//Create a rect same size of update rect
			HBITMAP bm_mem = CreateCompatibleBitmap(dc, rc_client.right, rc_client.bottom);

			HBITMAP bm_old = (HBITMAP)SelectObject(dc_mem, bm_mem);

			//we should always be erasing first, so shouldn't be needed
			BitBlt(dc_mem, 0, 0, rc_client.right, rc_client.bottom, dc, 0, 0, SRCCOPY);
			if (ps.fErase)
			{
				draw_background(dc_mem, &rc_client);
			}

			draw_channel(dc_mem, &rc_track);
			draw_thumb(dc_mem, &rc_thumb);

			BitBlt(dc, 0, 0, rc_client.right, rc_client.bottom, dc_mem, 0, 0, SRCCOPY);
			SelectObject(dc_mem, bm_old);
			DeleteObject(bm_mem);
			DeleteDC(dc_mem);
			EndPaint(wnd, &ps);
		}
		return 0;

	}
	return DefWindowProc(wnd, msg, wp, lp);
}
示例#12
0
static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	TRichUtil *ru = NULL, tru;
	int idx;
	LRESULT ret;

	tru.hwnd = hwnd;

	EnterCriticalSection(&csRich);
	if (List_GetIndex(&sListInt, &tru, &idx))
		ru = (TRichUtil *)sListInt.items[idx];
	LeaveCriticalSection(&csRich);

	switch (msg) {
	case WM_THEMECHANGED:
	case WM_STYLECHANGED:
		RichUtil_ClearUglyBorder(ru);
		break;

	case WM_NCPAINT:
		ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
		if (ru->hasUglyBorder && IsThemeActive())
		{
			HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT");

			if (hTheme) {
				RECT rcBorder;
				RECT rcClient;
				int nState;
				HDC hdc = GetWindowDC(ru->hwnd);

				GetWindowRect(hwnd, &rcBorder);
				rcBorder.right -= rcBorder.left; rcBorder.bottom -= rcBorder.top;
				rcBorder.left = rcBorder.top = 0;
				CopyRect(&rcClient, &rcBorder);
				rcClient.left += ru->rect.left;
				rcClient.top += ru->rect.top;
				rcClient.right -= ru->rect.right;
				rcClient.bottom -= ru->rect.bottom;
				ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);

				if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
					DrawThemeParentBackground(hwnd, hdc, &rcBorder);

				if (!IsWindowEnabled(hwnd))
					nState = ETS_DISABLED;
				else if (SendMessage(hwnd, EM_GETOPTIONS, 0, 0) & ECO_READONLY)
					nState = ETS_READONLY;
				else nState = ETS_NORMAL;

				DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
				CloseThemeData(hTheme);
				ReleaseDC(hwnd, hdc);
				return 0;
			}
		}
		return ret;

	case WM_NCCALCSIZE:
		{
			ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
			NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS *)lParam;

			if (ru->hasUglyBorder && IsThemeActive()) {
				HANDLE hTheme = OpenThemeData(hwnd, L"EDIT");
				if (hTheme) {
					RECT rcClient = {0};
					HDC hdc = GetDC(GetParent(hwnd));

					if (GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
						ru->rect.left = rcClient.left - ncsParam->rgrc[0].left;
						ru->rect.top = rcClient.top - ncsParam->rgrc[0].top;
						ru->rect.right = ncsParam->rgrc[0].right - rcClient.right;
						ru->rect.bottom = ncsParam->rgrc[0].bottom - rcClient.bottom;
						ncsParam->rgrc[0] = rcClient;

						CloseThemeData(hTheme);
						ReleaseDC(GetParent(hwnd), hdc);
						return WVR_REDRAW;
					}
					ReleaseDC(GetParent(hwnd), hdc);
					CloseThemeData(hTheme);
				}
			}
		}
		return ret;

	case WM_ENABLE:
		RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME);
		break;

	case WM_GETDLGCODE:
		return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam) & ~DLGC_HASSETSEL;

	case WM_NCDESTROY:
		ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);

		EnterCriticalSection(&csRich);
		List_Remove(&sListInt, idx);
		LeaveCriticalSection(&csRich);

		mir_free(ru);
		return ret;
	}
	return mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
}
示例#13
0
static UINT CALLBACK 	MyFindDialogProcedure (HWND pmWindow, UINT pmMessage, 
    					       WPARAM pmWParam,
    					       LPARAM pmLParam)
{
    static int	stLastX = UNINIT_VAL, stLastY = UNINIT_VAL;
    
    if (pmMessage == WM_INITDIALOG)
    {
	EdSearch_FindReplaceDialog = pmWindow;
	
    	if ((stLastX == UNINIT_VAL) && (stLastY == UNINIT_VAL))
    	{
	    EdGUI_CentreDialogBox (pmWindow);
	}
	else
	{
	    SetWindowPos (pmWindow, HWND_TOP, stLastX, stLastY, 
	        0, 0, SWP_NOSIZE);
	}
	
	return 1;
    }
    else if (pmMessage == WM_DESTROY)
    {
    	RECT	myDialogRect;
    	
    	GetWindowRect (pmWindow, &myDialogRect);
    	
    	stLastX = myDialogRect.left;
    	stLastY = myDialogRect.top;
    }
    else if (pmMessage == WM_ACTIVATE)
    {
        if (LOWORD (pmWParam) == WA_INACTIVE)
        {
            Ed_SetActiveWindow (NULL, NO_WINDOW);
            GetDlgItemText (pmWindow, edt1, stFindWhat, FIND_STRING_LEN);
            GetDlgItemText (pmWindow, edt2, stReplaceWith, FIND_STRING_LEN);
        }
        else
        {
            Ed_SetActiveWindow (pmWindow, FIND_REPLACE_DIALOG);
        }
        if (IsWindow (stFindReplace.hwndOwner))
        {
            RedrawWindow (stFindReplace.hwndOwner, NULL, NULL, 
            	RDW_INVALIDATE);
        }
    }
    else if (pmMessage == WM_COMMAND)
    {
    	if (HIWORD (pmWParam) == 1)
    	{
    	    if (LOWORD (pmWParam) == COMMAND_CLOSE_DIALOG)
    	    {
    	    	SendMessage (pmWindow, WM_CLOSE, 0, 0);
    	    }
    	    else
    	    {
    	    	SendMessage (stFindReplace.hwndOwner, WM_COMMAND, pmWParam, 0);
    	    }
    	    return 1;
    	}
/*    	
    	if (!stIsFindDialog && (LOWORD (pmWParam) == COMMAND_FIND))
    	{
    	    EdSearch_ShowFindDialog (stFindReplace.hwndOwner);
    	}
    	else if (stIsFindDialog && (LOWORD (pmWParam) == COMMAND_REPLACE))
    	{
    	    EdSearch_ShowReplaceDialog (stFindReplace.hwndOwner);
    	}
*/    	
    }

    return 0;
} // MyFindDialogProcedure
示例#14
0
void CWinMenu::OnMouseMove(UINT nFlags, CPoint point) 
{
	LPMITEMINFO	item = GetMenuItem( &point );

	BOOL bRedraw = FALSE;

	// Redraw window if needed by toolbar
	if (	item != NULL && item->toolbar != NULL && 
			item->toolbar->OnMouseMove( nFlags, &point ) )
		bRedraw = TRUE;

	if ( ( nFlags & MK_LBUTTON ) == 0 )
	{	

		if ( item != m_itemover )
		{
			// Clear mouse over
			if ( m_itemover != NULL && m_itemover->toolbar != NULL )
				m_itemover->toolbar->ClearMouseOver();

			// Save new item
			m_itemover = item;

			// Popup sub menu if needed
			NewSubMenu( item );

			// Redraw our window
			bRedraw = TRUE;

		} // end if

	} // end if

	else
	{
		RECT c;
		GetWindowRect( &c );

		if ( !PtInRect( &c, point ) )
		{
			HWND last = m_hDropWnd;

			POINT pt;
			pt.x = point.x;
			pt.y = point.y;
			ClientToScreen( &pt );

			// Which window was choosen
			HWND hParent = ::WindowFromPoint( pt );
			if ( m_bAllowChildren )
			{
				if ( hParent != NULL )
				{
					// Check for child windows
					::ScreenToClient( hParent, &pt );
					HWND hChild = ::ChildWindowFromPoint( hParent, pt );
					
					// Which window to use
					if ( hChild != NULL ) m_hDropWnd = hChild;
					else m_hDropWnd = hParent;
						
				} // end if
			} // end if
			else
			{
				// Get topmost window
				while ( hParent != NULL )
				{
					m_hDropWnd = hParent;
					hParent = ::GetParent( hParent );
				} // end while

			} // end else

			// Border window
			if ( last != m_hDropWnd ) 
			{
				// Undo our mess
				RedrawLastWindow();

				if ( m_hDropWnd != GetSafeHwnd() && ::IsWindow( m_hDropWnd ) )
				{
					HDC hDC = ::GetWindowDC( m_hDropWnd );

					if ( hDC != NULL )
					{
						// Save last window we screwed up
						m_hLastWnd = m_hDropWnd;

						RECT rect;
						::GetWindowRect( m_hDropWnd, &rect );
						OffsetRect( &rect, -rect.left, -rect.top );

						HBRUSH oldbrush = (HBRUSH)SelectObject( hDC, GetStockObject( NULL_BRUSH ) );
						HPEN red = CreatePen( PS_DASH, 2, RGB( 255, 0, 0 ) );
						HPEN white = CreatePen( PS_DASH, 2, RGB( 80, 80, 80 ) );
						HPEN blue = CreatePen( PS_DASH, 2, RGB( 0, 0, 255 ) );
						HPEN oldpen = (HPEN)SelectObject( hDC, red );

						// Draw the rectangle
//						Rectangle( hDC, rect.left, rect.top, rect.right, rect.bottom );

						InflateRect( &rect, -2, -2 );
						SelectObject( hDC, red );
						Rectangle( hDC, rect.left, rect.top, rect.right, rect.bottom );

						InflateRect( &rect, -2, -2 );
						SelectObject( hDC, blue );
						Rectangle( hDC, rect.left, rect.top, rect.right, rect.bottom );

						// Restore the DC
						SelectObject( hDC, oldpen );
						SelectObject( hDC, oldbrush );
						DeleteObject( red );
						DeleteObject( white );
						DeleteObject( blue );
						::ReleaseDC( m_hDropWnd, hDC );
					} // end if
				} // end if
			} // end if

		} // end if

	} // end else if
	
	// Redraw window if needed
	if ( bRedraw ) RedrawWindow();

	CWnd::OnMouseMove(nFlags, point);
}
示例#15
0
LRESULT CALLBACK ArchiveFileChooser(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	RECT r, r2;
	int dx1, dy1, dx2, dy2;
	static std::map<int,int> s_listToItemsMap;

	switch(uMsg)
	{
		case WM_INITDIALOG:
		{
//			DialogsOpen++;
//			Clear_Sound_Buffer();
			
//			if(Full_Screen)
//			{
//				while (ShowCursor(false) >= 0);
//				while (ShowCursor(true) < 0);
//			}

			GetWindowRect(MainWindow->getHWnd(), &r);
			dx1 = (r.right - r.left) / 2;
			dy1 = (r.bottom - r.top) / 2;

			GetWindowRect(hDlg, &r2);
			dx2 = (r2.right - r2.left) / 2;
			dy2 = (r2.bottom - r2.top) / 2;

			//SetWindowPos(hDlg, NULL, max(0, r.left + (dx1 - dx2)), max(0, r.top + (dy1 - dy2)), NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);
			SetWindowPos(hDlg, NULL, r.left, r.top, NULL, NULL, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);

			ArchiveFileChooserInfo& info = *(ArchiveFileChooserInfo*)lParam;
			std::vector<ArchiveFileChooserInfo::FileInfo>& files = info.files;
			ArchiveFile& archive = info.archive;

			std::string title = "Choose File in ";
			title += archive.GetArchiveTypeName();
			title += " Archive";
			SetWindowText(hDlg, title.c_str());

			// populate list
			for(size_t i = 0; i < files.size(); i++)
			{
				int listIndex = SendDlgItemMessage(hDlg, IDC_LIST1, LB_ADDSTRING, (WPARAM) 0, (LONG) (LPTSTR) files[i].name.c_str());
				s_listToItemsMap[listIndex] = files[i].itemIndex;
			}

			SendDlgItemMessage(hDlg, IDC_LIST1, LB_SETCURSEL, (WPARAM) 0, (LPARAM) 0);

			{
				RECT r3;
				GetClientRect(hDlg, &r3);
				s_windowWidth = r3.right - r3.left;
				s_windowHeight = r3.bottom - r3.top;
			}

			return true;
		}	break;

		case WM_SIZING:
		{
			// enforce a minimum window size

			LPRECT r = (LPRECT) lParam;
			int minimumWidth = 281;
			int minimumHeight = 117;
			if(r->right - r->left < minimumWidth)
				if(wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT || wParam == WMSZ_BOTTOMLEFT)
					r->left = r->right - minimumWidth;
				else
					r->right = r->left + minimumWidth;
			if(r->bottom - r->top < minimumHeight)
				if(wParam == WMSZ_TOP || wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOPRIGHT)
					r->top = r->bottom - minimumHeight;
				else
					r->bottom = r->top + minimumHeight;
			return TRUE;
		}

		case WM_SIZE:
		{
			// resize or move controls in the window as necessary when the window is resized

			int prevDlgWidth = s_windowWidth;
			int prevDlgHeight = s_windowHeight;

			int dlgWidth = LOWORD(lParam);
			int dlgHeight = HIWORD(lParam);

			int deltaWidth = dlgWidth - prevDlgWidth;
			int deltaHeight = dlgHeight - prevDlgHeight;

			for(int i = 0; i < numControlLayoutInfos; i++)
			{
				ControlLayoutInfo layoutInfo = controlLayoutInfos[i];
				ControlLayoutState& layoutState = s_layoutState[i];

				HWND hCtrl = GetDlgItem(hDlg,layoutInfo.controlID);

				int x,y,width,height;
				if(layoutState.valid)
				{
					x = layoutState.x;
					y = layoutState.y;
					width = layoutState.width;
					height = layoutState.height;
				}
				else
				{
					RECT r;
					GetWindowRect(hCtrl, &r);
					POINT p = {r.left, r.top};
					ScreenToClient(hDlg, &p);
					x = p.x;
					y = p.y;
					width = r.right - r.left;
					height = r.bottom - r.top;
				}

				switch(layoutInfo.horizontalLayout)
				{
					case ControlLayoutInfo::RESIZE_END: width += deltaWidth; break;
					case ControlLayoutInfo::MOVE_START: x += deltaWidth; break;
					default: break;
				}
				switch(layoutInfo.verticalLayout)
				{
					case ControlLayoutInfo::RESIZE_END: height += deltaHeight; break;
					case ControlLayoutInfo::MOVE_START: y += deltaHeight; break;
					default: break;
				}

				SetWindowPos(hCtrl, 0, x,y, width,height, 0);

				layoutState.x = x;
				layoutState.y = y;
				layoutState.width = width;
				layoutState.height = height;
				layoutState.valid = true;
			}

			s_windowWidth = dlgWidth;
			s_windowHeight = dlgHeight;

			RedrawWindow(hDlg, NULL, NULL, RDW_INVALIDATE);
		}
		break;

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case IDC_LIST1:
					if(HIWORD(wParam) == LBN_DBLCLK)
						SendMessage(hDlg, WM_COMMAND, IDOK, 0);
					return TRUE;

				case IDOK:
				{	
					int listIndex = SendDlgItemMessage(hDlg, IDC_LIST1, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0);
					s_archiveFileChooserResult = s_listToItemsMap[listIndex];
					s_listToItemsMap.clear();
//					if(Full_Screen)
//					{
//						while (ShowCursor(true) < 0);
//						while (ShowCursor(false) >= 0);
//					}
//					DialogsOpen--;
					EndDialog(hDlg, false);
				}	return TRUE;

				case IDCANCEL:
					s_archiveFileChooserResult = -1;
					s_listToItemsMap.clear();
//					if(Full_Screen)
//					{
//						while (ShowCursor(true) < 0);
//						while (ShowCursor(false) >= 0);
//					}
//					DialogsOpen--;
					EndDialog(hDlg, false);
					return TRUE;
			}

		case WM_CLOSE:
			s_archiveFileChooserResult = -1;
			s_listToItemsMap.clear();
//			if(Full_Screen)
//			{
//				while (ShowCursor(true) < 0);
//				while (ShowCursor(false) >= 0);
//			}
//			DialogsOpen--;
			EndDialog(hDlg, false);
			return TRUE;
	}

	return false;
}
void CTaskbarNotifier::Show(LPCTSTR szCaption,DWORD dwTimeToShow,DWORD dwTimeToLive,DWORD dwTimeToHide,int nIncrement)
{
	unsigned int nDesktopHeight;
	unsigned int nDesktopWidth;
	unsigned int nScreenWidth;
	unsigned int nScreenHeight;
	CRect rcDesktop;

	m_strCaption=szCaption;
	m_dwTimeToShow=dwTimeToShow;
	m_dwTimeToLive=dwTimeToLive;
	m_dwTimeToHide=dwTimeToHide;

	::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0);
	nDesktopWidth=rcDesktop.right-rcDesktop.left;
	nDesktopHeight=rcDesktop.bottom-rcDesktop.top;
	nScreenWidth=::GetSystemMetrics(SM_CXSCREEN);
	nScreenHeight=::GetSystemMetrics(SM_CYSCREEN);

	BOOL bTaskbarOnRight=nDesktopWidth<nScreenWidth && rcDesktop.left==0;
	BOOL bTaskbarOnLeft=nDesktopWidth<nScreenWidth && rcDesktop.left!=0;
	BOOL bTaskBarOnTop=nDesktopHeight<nScreenHeight && rcDesktop.top!=0;
	BOOL bTaskbarOnBottom=nDesktopHeight<nScreenHeight && rcDesktop.top==0;
	
	switch (m_nAnimStatus)
	{
		case IDT_HIDDEN:
			ShowWindow(SW_SHOW);
			if (bTaskbarOnRight)
			{
				m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinWidth/m_nIncrement);
				m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinWidth/m_nIncrement);
				m_nStartPosX=rcDesktop.right;
				m_nStartPosY=rcDesktop.bottom-m_nSkinHeight;
				m_nTaskbarPlacement=TASKBAR_ON_RIGHT;
			}
			else if (bTaskbarOnLeft)
			{
				m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinWidth/m_nIncrement);
				m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinWidth/m_nIncrement);
				m_nStartPosX=rcDesktop.left-m_nSkinWidth;
				m_nStartPosY=rcDesktop.bottom-m_nSkinHeight;
				m_nTaskbarPlacement=TASKBAR_ON_LEFT;
			}
			else if (bTaskBarOnTop)
			{
				m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinHeight/m_nIncrement);
				m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinHeight/m_nIncrement);
				m_nStartPosX=rcDesktop.right-m_nSkinWidth;
				m_nStartPosY=rcDesktop.top-m_nSkinHeight;
				m_nTaskbarPlacement=TASKBAR_ON_TOP;
			}
			else //if (bTaskbarOnBottom)
			{
				// Taskbar is on the bottom or Invisible
				m_dwDelayBetweenShowEvents=m_dwTimeToShow/(m_nSkinHeight/m_nIncrement);
				m_dwDelayBetweenHideEvents=m_dwTimeToHide/(m_nSkinHeight/m_nIncrement);
				m_nStartPosX=rcDesktop.right-m_nSkinWidth;
				m_nStartPosY=rcDesktop.bottom;
				m_nTaskbarPlacement=TASKBAR_ON_BOTTOM;
			}

			m_nCurrentPosX=m_nStartPosX;
			m_nCurrentPosY=m_nStartPosY;
	
			SetTimer(IDT_APPEARING,m_dwDelayBetweenShowEvents,NULL);
			break;

		case IDT_WAITING:
			RedrawWindow();
			KillTimer(IDT_WAITING);
			SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
			break;

		case IDT_APPEARING:
			RedrawWindow();
			break;

		case IDT_DISAPPEARING:
			KillTimer(IDT_DISAPPEARING);
			SetTimer(IDT_WAITING,m_dwTimeToLive,NULL);
			if (bTaskbarOnRight)
				m_nCurrentPosX=rcDesktop.right-m_nSkinWidth;
			else if (bTaskbarOnLeft)
				m_nCurrentPosX=rcDesktop.left;
			else if (bTaskBarOnTop)
				m_nCurrentPosY=rcDesktop.top;
			else //if (bTaskbarOnBottom)
				m_nCurrentPosY=rcDesktop.bottom-m_nSkinHeight;
			
			SetWindowPos(NULL,m_nCurrentPosX,m_nCurrentPosY,m_nSkinWidth,m_nSkinHeight,SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE);
			RedrawWindow();
			break;
	}
}
示例#17
0
int main(int argc, char *argv[])
{
    int b;

    extern int d_depth;
    extern Window iconwin, win;
    Visual *visual;
    XEvent event;
    Pixmap xpm;
    Time lastTime=0;

    Imlib_Image image;

    ParseCMDLine(argc, argv);
    openXwindow(argc, argv, xpm_master, xpm_mask_bits, xpm_mask_width, xpm_mask_height);

    xpm = XCreatePixmap(display, win, 64, 64, d_depth);
    XFillRectangle(display, xpm, NormalGC, 0, 0, 64, 64);

    if (fname) {
	visual = DefaultVisual(display, DefaultScreen(display));

	imlib_context_set_dither(1);
	imlib_context_set_display(display);
	imlib_context_set_visual(visual);

	image = imlib_load_image(fname);
	imlib_context_set_image(image);
	imlib_context_set_drawable(xpm);
	imlib_render_image_on_drawable_at_size(0, 0, isize, isize);
    }
    b = (64-isize)/2;
    /* Loop Forever */
    while (1) {
	/* Process any pending X events. */
	while (XPending(display)) {
	    XNextEvent(display, &event);
	    switch (event.type) {
		case Expose:
		    RedrawWindow();
		    XCopyArea(display, xpm, iconwin, NormalGC, 0, 0, isize, isize, b, b);
		    break;
		case MotionNotify:
		    break;
		case ButtonPress:
		    /*printf("ButtonPress\n");*/
		    break;
		case ButtonRelease:
		    if (event.xbutton.button == Button1) {
			if (event.xbutton.time - lastTime < 250) {
			    if (system(cmd) == -1) {
				fprintf(stdout, "Failed to run command:%s\n", cmd);
				exit(0);
			    }
			} else {
			    lastTime = event.xbutton.time;
			}
		    } else if (event.xbutton.button == Button3) {
			exit(0);
		    }
		    /*printf("ButtonRelease\n");*/
		    break;
	    }
	}
	usleep(10000);
    }
    /* we should never get here */
    return (0);
}
//***************************************************************************************
void CBCGPHeaderCtrl::RemoveSortColumn (int iColumn)
{
    ASSERT_VALID (this);
    m_mapColumnsStatus.RemoveKey (iColumn);
    RedrawWindow ();
}
示例#19
0
LRESULT CALLBACK
waoWC_button0Proc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    static TRACKMOUSEEVENT tME;
    switch( msg )
    {
        case WM_CREATE:
        {
            tME.cbSize = sizeof( TRACKMOUSEEVENT );
            //tME.dwFlags = TME_HOVER;
            tME.dwHoverTime = 0;
            SendMessage( GetParent (hwnd), WAOM_TBBTNCREATED,
                    MAKEWPARAM( WAOM_TBBTNCREATED_LW,
                            GetWindowLong( hwnd, GWL_ID ) ), ( LPARAM ) hwnd );
            return FALSE;
        }
        case WM_ENABLE:
            if( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CHECKED )
                SetWindowLong( hwnd, GWL_USERDATA,
                        wParam ? ( WAO_TBBS_NORMAL | WAO_TBBS_CHECKED ) :
                        ( WAO_TBBS_DISABLED | WAO_TBBS_CHECKED ) );
            else
                SetWindowLong( hwnd, GWL_USERDATA, wParam ? WAO_TBBS_NORMAL : WAO_TBBS_DISABLED );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
            return FALSE;
        case WM_MOUSEMOVE:
            if( GetWindowLong( hwnd, GWL_USERDATA ) != WAO_TBBS_NORMAL )
                return FALSE;
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_HOVERED );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
            tME.dwFlags = TME_LEAVE;
            tME.hwndTrack = hwnd;
            TrackMouseEvent( &tME );
            return FALSE;
        case WM_MOUSELEAVE:
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_NORMAL );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
            return FALSE;
        case WM_RBUTTONDOWN:
            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_RIGHTBUTTON )
            {
                long btnStt = GetWindowLong( hwnd, GWL_USERDATA );
                SetWindowLong( hwnd, GWL_USERDATA,
                               WAO_TBBS_CLICKED | ( btnStt & WAO_TBBS_CHECKED ) );
            }
            return FALSE;
        case WM_LBUTTONDOWN:
        {
            long btnStt = GetWindowLong( hwnd, GWL_USERDATA );
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_CLICKED | ( btnStt & WAO_TBBS_CHECKED ) );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_NOTIFY )
                SetTimer( hwnd, WAO_TMR_TBRPW, WAO_TBBN_RPWTIME, NULL );
            return FALSE;
        }
        case WM_LBUTTONUP:
            // should be clicked first:
            if( !( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CLICKED ) )
                return FALSE;
        case WM_CLEAR: // tweak to check with one internal message
        {
            SetWindowLong( hwnd, GWL_USERDATA, WAO_TBBS_NORMAL );
            RedrawWindow( hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE );
            DLGPROC parProc = ( DLGPROC ) GetWindowLong ( GetParent( hwnd ), DWL_DLGPROC );
            if( msg != WM_CLEAR ) // what about making this a seperate thread?
                parProc( GetParent ( hwnd ), WM_COMMAND,
                         MAKEWPARAM( GetWindowLong( hwnd, GWL_ID ),
                         WAO_TBBN_LCLCKED ),
                         ( LPARAM ) hwnd );
            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_NOTIFY )
            {
                KillTimer( hwnd, WAO_TMR_TBRPW );
                KillTimer( hwnd, WAO_TMR_TBRPT );
            }
            return FALSE;
        }
        case WM_RBUTTONUP:
            // should be clicked first:
            if( !( GetWindowLong( hwnd, GWL_USERDATA ) & WAO_TBBS_CLICKED ) )
                return FALSE;
            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_RIGHTBUTTON )
            {
                DLGPROC parProc = ( DLGPROC ) GetWindowLong( GetParent( hwnd ), DWL_DLGPROC );
                parProc( GetParent( hwnd ),
                         WM_COMMAND,
                         MAKEWPARAM( GetWindowLong ( hwnd, GWL_ID ), WAO_TBBN_RCLCKED ),
                         ( LPARAM ) hwnd );
            }
            return FALSE;
        case WM_TIMER:
        {
            if( wParam == WAO_TMR_TBRPW ) // repeat wait
            {
                KillTimer( hwnd, WAO_TMR_TBRPW );
                SetTimer( hwnd, WAO_TMR_TBRPT, WAO_TBBN_RPTTIME, NULL );
            }
            DLGPROC parProc = ( DLGPROC ) GetWindowLong( GetParent( hwnd ), DWL_DLGPROC );
            parProc( GetParent( hwnd ),
                     WM_COMMAND,
                     MAKEWPARAM( GetWindowLong( hwnd, GWL_ID ), WAO_TBBN_LCLCKED ),
                     ( LPARAM ) hwnd );
            return FALSE;
        }
        case WM_PAINT:
        {
            PAINTSTRUCT paintStruct;
            BeginPaint( hwnd, &paintStruct );
            RECT rcWnd;
            GetClientRect( hwnd, &rcWnd ); // should this be calculated every time?
            int btnStt = GetWindowLong( hwnd, GWL_USERDATA );

            if( btnStt & WAO_TBBS_CHECKED )
            {
                FillRect( paintStruct.hdc, &rcWnd, CreateSolidBrush( 0x99ffff ) );
                DrawEdge( paintStruct.hdc, &rcWnd, BDR_SUNKENOUTER, BF_RECT );
            }
            else if( btnStt == WAO_TBBS_CLICKED )
            {
                DrawEdge( paintStruct.hdc, &rcWnd, BDR_SUNKENOUTER, BF_RECT );
            }
            else if( btnStt == WAO_TBBS_HOVERED )
            {
                DrawEdge( paintStruct.hdc, &rcWnd, BDR_RAISEDINNER, BF_RECT );
            }
            // drawing icon
            if( GetWindowLong( hwnd, GWL_STYLE ) & BS_ICON ) // maybe later bitmap too
            {
                HICON hIco = LoadIcon( GetModuleHandle( NULL ),
                                       MAKEINTRESOURCE( GetWindowLong( hwnd, GWL_ID ) ) );

                DrawIconEx( paintStruct.hdc,
                            ( rcWnd.right - rcWnd.left - 16 ) / 2,
                            ( rcWnd.bottom - rcWnd.top - 16 ) / 2,
                            hIco, 16, 16, 0, NULL, DI_NORMAL );
            }
            // drawing text
            else
            {
                int tmpLen = GetWindowTextLength( hwnd );
                wchar_t buffer[ tmpLen + 1 ];
                SIZE tmpSze;
                GetWindowText( hwnd, buffer, tmpLen + 1 );
                SetBkMode( paintStruct.hdc, TRANSPARENT );
                SelectObject( paintStruct.hdc, GetStockObject( DEFAULT_GUI_FONT ) );

                GetTextExtentPoint32( paintStruct.hdc, buffer, tmpLen, &tmpSze );
                DrawState( paintStruct.hdc, NULL, NULL,
                         ( LPARAM ) buffer, tmpLen,
                         ( rcWnd.right-rcWnd.left-tmpSze.cx ) / 2,
                         ( rcWnd.bottom-rcWnd.top-tmpSze.cy ) / 2,
                         tmpSze.cx, tmpSze.cy, DST_TEXT|(
                                ( btnStt & WAO_TBBS_DISABLED ) ? DSS_DISABLED : 0 ) );
            }
            EndPaint( hwnd, &paintStruct );
            return FALSE;
        }
        default:
            return DefWindowProc( hwnd, msg, wParam, lParam );
    }
}
/**********************************************************************
 * The button control subclass window proc.
 */
LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg,
                                            WPARAM wParam, LPARAM lParam,
                                            ULONG_PTR dwRefData)
{
    const WCHAR* themeClass = WC_BUTTONW;
    HTHEME theme;
    LRESULT result;

    switch (msg)
    {
    case WM_CREATE:
        result = THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
        OpenThemeData(hwnd, themeClass);
        return result;

    case WM_DESTROY:
        theme = GetWindowTheme(hwnd);
        CloseThemeData (theme);
        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);

    case WM_THEMECHANGED:
        theme = GetWindowTheme(hwnd);
        CloseThemeData (theme);
        OpenThemeData(hwnd, themeClass);
        break;

    case WM_SYSCOLORCHANGE:
        theme = GetWindowTheme(hwnd);
	if (!theme) return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
        /* Do nothing. When themed, a WM_THEMECHANGED will be received, too,
	 * which will do the repaint. */
        break;

    case WM_PAINT:
        theme = GetWindowTheme(hwnd);
        if (theme && BUTTON_Paint(theme, hwnd, (HDC)wParam))
            return 0;
        else
            return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);

    case WM_ENABLE:
        theme = GetWindowTheme(hwnd);
        if (theme) {
            RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW);
            return 0;
        } else
            return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);

    case WM_MOUSEMOVE:
    {
        TRACKMOUSEEVENT mouse_event;
        mouse_event.cbSize = sizeof(TRACKMOUSEEVENT);
        mouse_event.dwFlags = TME_QUERY;
        if(!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags&(TME_HOVER|TME_LEAVE)))
        {
            mouse_event.dwFlags = TME_HOVER|TME_LEAVE;
            mouse_event.hwndTrack = hwnd;
            mouse_event.dwHoverTime = 1;
            TrackMouseEvent(&mouse_event);
        }
        break;
    }

    case WM_MOUSEHOVER:
    {
        int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
        SetWindowLongW(hwnd, 0, state|BST_HOT);
        InvalidateRect(hwnd, NULL, FALSE);
        break;
    }

    case WM_MOUSELEAVE:
    {
        int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0);
        SetWindowLongW(hwnd, 0, state&(~BST_HOT));
        InvalidateRect(hwnd, NULL, FALSE);
        break;
    }

    case BM_SETCHECK:
    case BM_SETSTATE:
        theme = GetWindowTheme(hwnd);
        if (theme) {
            InvalidateRect(hwnd, NULL, FALSE);
        }
        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);

    default:
	/* Call old proc */
	return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
    }
    return 0;
}
示例#21
0
void CHistoryPane::Up()
{
  m_uTopItem--;	
  m_bSendScroll = true;
  RedrawWindow();
}
示例#22
0
void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
{
    SetCapture();

    // make sure no updates are pending
    if (!m_bDragShowContent)
        RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);

    m_htEdge = nHitTest;
    m_bTracking = TRUE;

    BOOL bHorz = IsHorzDocked();
    BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;

    m_nTrackPosOld = bHorzTracking ? point.x : point.y;

    CRect rcBar, rcEdge;
    GetWindowRect(rcBar);
    GetEdgeRect(rcBar, m_htEdge, rcEdge);
    m_nTrackEdgeOfs = m_nTrackPosOld -
        (bHorzTracking ? rcEdge.CenterPoint().x : rcEdge.CenterPoint().y);
    
    CSCBArray arrSCBars;
    int nThis;
    GetRowSizingBars(arrSCBars, nThis);

    m_nTrackPosMin = m_nTrackPosMax = m_nTrackPosOld;
    if (!IsSideTracking())
    {
        // calc minwidth as the max minwidth of the sizing bars on row
        int nMinWidth = bHorz ? m_szMinHorz.cy : m_szMinVert.cx;
        for (int i = 0; i < arrSCBars.GetSize(); i++)
            nMinWidth = max(nMinWidth, bHorz ? 
                arrSCBars[i]->m_szMinHorz.cy :
                arrSCBars[i]->m_szMinVert.cx);
        int nExcessWidth = (bHorz ? m_szHorz.cy : m_szVert.cx) - nMinWidth;

        // the control bar cannot grow with more than the width of
        // remaining client area of the mainframe
        CRect rcT;
        m_pDockSite->RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST,
            reposQuery, &rcT, NULL, TRUE);
        int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;

        BOOL bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;

        m_nTrackPosMin -= bTopOrLeft ? nMaxWidth : nExcessWidth;
        m_nTrackPosMax += bTopOrLeft ? nExcessWidth : nMaxWidth;
    }
    else
    {
        // side tracking:
        // max size is the actual size plus the amount the other
        // sizing bars can be decreased until they reach their minsize
        if (m_htEdge == HTBOTTOM || m_htEdge == HTRIGHT)
            nThis++;

        for (int i = 0; i < arrSCBars.GetSize(); i++)
        {
            CSizingControlBar* pBar = arrSCBars[i];

            int nExcessWidth = bHorz ? 
                pBar->m_szHorz.cx - pBar->m_szMinHorz.cx :
                pBar->m_szVert.cy - pBar->m_szMinVert.cy;

            if (i < nThis)
                m_nTrackPosMin -= nExcessWidth;
            else
                m_nTrackPosMax += nExcessWidth;
        }
    }

    OnTrackInvertTracker(); // draw tracker
}
示例#23
0
void CHistoryPane::OnSize(UINT nType, int cx, int cy) 
{
	CStatic::OnSize(nType, cx, cy);
  Update();
  RedrawWindow();
}
int PASCAL
WinMain (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine,
	int nCmdShow)
{
	static char szAppName [] = "winfflow" ;
	HWND hwnd ;
	MSG  msg;
	WNDCLASS wndclass ;
	HANDLE hAccel;

	/* Register exit function */
	atexit(CloseSetup);

	if (!hPrevInstance)
	{
		wndclass.style		= CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
		wndclass.lpfnWndProc	= WndProc ;
		wndclass.cbClsExtra	= 0 ;
		wndclass.cbWndExtra	= DLGWINDOWEXTRA ;
		wndclass.hInstance	= hInstance ;
		wndclass.hIcon		= LoadIcon (hInstance,
					MAKEINTRESOURCE(WINFFLOW_ICON_1));
		wndclass.hCursor	= LoadCursor (NULL, IDC_ARROW) ;
		wndclass.hbrBackground  = NULL;
		wndclass.lpszMenuName	= NULL;
		wndclass.lpszClassName  = szAppName ;
		RegisterClass(&wndclass);
	}

	/* save instance handle for use by other functions */
	hInst = hInstance;

	/*
	* Accelerators needed to provide a keyboard interface to the
	* main window
	*/
	hAccel = LoadAccelerators(hInstance, szAppName);

	/* load settings from ini file */
	load_settings();

	/* initialise ctl3d */
	init3d(hInst);

	/*
	* block resize. Otherwise CreateDialog will call DoResize with
	* an empty window.
	*/
	block_resize = TRUE;
	/* Create our main window. */
	hwnd = CreateDialog (hInstance, szAppName, 0, NULL) ;

	/* Show it */
	ShowWindow (hwnd, nCmdShow) ;

	/*
	* add ctl3d effects to the main window. This will subclass the
	* childs controls only. Setting the background color is done below.
	*/
	subclass_main_app_window(hwnd, hInstance);

	/*
	* Now for some background color initialisation.
	* Since the hbrBackground field of our wndclass is zero, we need to
	* respond to any WM_ERASEBKGND messages. But when the window comes up
	* we do not have a background brush yet so our window will be 
	* transparant!
	* So, in order to get the correct background color (which should be 
	* the one * provided by ctl3d, we send a RedrawWindow twice.
	* The first one will trigger a WM_CTLCOLOR message for each child 
	* control in the window. The background brush used is stored in 
	* background_brush.
	* The WM_ERASEBKGND message does nothing in response to the first 
	* message. When we sent the second message, we have a background brush 
	* available so the background will be painted with the correct color.
	* We need the RDW_ALLCHILDREN flag again since we invalidate the entire
	* window region. Not doing this will cause all child controls not to be
	* repainted. 
	*/
	RedrawWindow(hwnd, NULL, NULL,
		RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | 
		RDW_INTERNALPAINT);
	RedrawWindow(hwnd, NULL, NULL,
		RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | 
		RDW_INTERNALPAINT);

	/* save window handle for later use */
	hWndMain = hwnd;

	/* make list of child windows needed for keyboard interface */
	get_child_windows(hwnd, hInst);

	/* Release resize blocking flag */
	block_resize = FALSE;
	/* Register with resize and force a display */
	RegisterResize(hwnd, hInst);
	DoResize(hwnd, TRUE);

	/* load any saved files */
	load_ini_file_data(hwnd);

	SetFocus(window_list[0].hwnd);	/* set initial focus */

	/* GetMessage returns 0 ONLY when WM_QUIT is passed */
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if((output_dialog == 0 ||
			!IsDialogMessage(output_dialog, &msg)) &&
			(progress_dialog == 0 ||
			!IsDialogMessage(progress_dialog, &msg)))
		{
			if(!TranslateAccelerator(hwnd, hAccel, &msg))
			{
					TranslateMessage(&msg);
					DispatchMessage(&msg);
			}
		}
	}
	return msg.wParam ;
}
示例#25
0
文件: MainFrm.cpp 项目: yeehlin/PMP
void CMainFrame::OnApplicationLook(UINT id)
{
	CWaitCursor wait;

	theApp.m_nAppLook = id;

	switch (theApp.m_nAppLook)
	{
	case ID_VIEW_APPLOOK_WIN_2000:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
		break;

	case ID_VIEW_APPLOOK_OFF_XP:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP));
		break;

	case ID_VIEW_APPLOOK_WIN_XP:
		CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
		break;

	case ID_VIEW_APPLOOK_OFF_2003:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003));
		CDockingManager::SetDockingMode(DT_SMART);
		break;

	case ID_VIEW_APPLOOK_VS_2005:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005));
		CDockingManager::SetDockingMode(DT_SMART);
		break;

	case ID_VIEW_APPLOOK_VS_2008:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008));
		CDockingManager::SetDockingMode(DT_SMART);
		break;

	case ID_VIEW_APPLOOK_WINDOWS_7:
		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7));
		CDockingManager::SetDockingMode(DT_SMART);
		break;

	default:
		switch (theApp.m_nAppLook)
		{
		case ID_VIEW_APPLOOK_OFF_2007_BLUE:
			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
			break;

		case ID_VIEW_APPLOOK_OFF_2007_BLACK:
			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
			break;

		case ID_VIEW_APPLOOK_OFF_2007_SILVER:
			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
			break;

		case ID_VIEW_APPLOOK_OFF_2007_AQUA:
			CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
			break;
		}

		CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
		CDockingManager::SetDockingMode(DT_SMART);
	}

	RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);

	theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook);
}
示例#26
0
// MW-2006-03-20: Bug 3316 - There seems absolutely no way of preventing flicker
//   when transitioning from no alpha to alpha. Therefore, we need to create a new
//   window opened *behind* the current window; show it; redraw it; then delete
//   the existing window.
void MCStack::setopacity(uint1 p_level)
{
	// If the stack is not ours to open, then we do nothing ('runtime' mode/remoteable
	// window).
	if (!MCModeMakeLocalWindows())
		return;

	// Do nothing if not NT
	if (MCmajorosversion < 0x0500)
		return;

	if (m_window_shape != NULL && !m_window_shape -> is_sharp)
		composite();
	else if (window != NULL)
	{
		HWND t_old_window;
		t_old_window = NULL;

		DWORD t_old_long, t_new_long;
		t_old_long = GetWindowLong((HWND)window -> handle . window, GWL_EXSTYLE);

		if (p_level == 255)
			t_new_long = t_old_long & ~WS_EX_LAYERED;
		else
			t_new_long = t_old_long | WS_EX_LAYERED;

		if (t_new_long != t_old_long)
		{
			if (IsWindowVisible((HWND)window -> handle . window) && (t_new_long & WS_EX_LAYERED) != 0)
				t_old_window = (HWND)window -> handle . window;
			else
				SetWindowLong((HWND)window -> handle . window, GWL_EXSTYLE, t_new_long);
		}

		if (t_old_window != NULL)
		{
			uint32_t t_style, t_ex_style;
			getstyle(t_style, t_ex_style);

			// MW-2006-07-27: [[ Bug 3690 ]] - Make sure layered attribute is set if we need it
			t_ex_style = (t_ex_style & ~WS_EX_LAYERED) | (t_new_long & WS_EX_LAYERED);

			RECT t_rect;
			t_rect = getwrect(rect, t_style, t_ex_style);

			Bool t_is_xp_menu;
			t_is_xp_menu = (mode == WM_PULLDOWN || mode == WM_POPUP || mode == WM_CASCADE) && (MCcurtheme && MCcurtheme->getthemeid() == LF_NATIVEWIN);

			if (!t_is_xp_menu && mode < WM_PULLDOWN)
				window -> handle . window = (MCSysWindowHandle)CreateWindowExW(t_ex_style, MC_WIN_CLASS_NAME_W, WideCString(getname_cstring()), t_style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, t_rect . left, t_rect . top, t_rect . right - t_rect . left, t_rect . bottom - t_rect . top, NULL, NULL, MChInst, NULL);
			else
				window -> handle . window = (MCSysWindowHandle)CreateWindowExA(t_ex_style, t_is_xp_menu ? MC_MENU_WIN_CLASS_NAME : mode >= WM_PULLDOWN ? MC_POPUP_WIN_CLASS_NAME : MC_WIN_CLASS_NAME, getname_cstring(), t_style | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, t_rect . left, t_rect . top, t_rect . right - t_rect . left, t_rect . bottom - t_rect . top, NULL, NULL, MChInst, NULL);
			
			// MW-2010-10-22: [[ Bug 8151 ]] Make sure we update the title string.
			if (titlestring != nil)
				MCscreen -> setname(window, titlestring);

			SetWindowLongA((HWND)window->handle.window, GWL_USERDATA, mode);
			
			if (flags & F_DECORATIONS && !(decorations & WD_SHAPE) && !(decorations & WD_CLOSE))
				EnableMenuItem(GetSystemMenu((HWND)window->handle.window, False), SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
		
			if (m_window_shape != nil && m_window_shape -> is_sharp)
			{
				MCRegionRef t_region;
				t_region = (MCRegionRef)m_window_shape -> handle;
				MCRegionOffset(t_region, rect . x - t_rect . left, rect . y - t_rect . top);
				MCRegionSetAsWindowShape(t_region, window->handle.window);

				// The window now owns the region.
				m_window_shape -> handle = nil;
			}

			RevokeDragDrop(t_old_window);
			CoLockObjectExternal(droptarget, FALSE, TRUE);
			droptarget -> setstack(NULL);

			droptarget -> setstack(this);
			CoLockObjectExternal(droptarget, TRUE, TRUE);
			RegisterDragDrop((HWND)window -> handle . window, droptarget);

			SetWindowPos((HWND)window -> handle . window, t_old_window, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOREDRAW | SWP_NOSENDCHANGING | SWP_NOSIZE | SWP_SHOWWINDOW);

			MCPlayer *t_player;
			for(t_player = MCplayers; t_player != NULL; t_player = t_player -> getnextplayer())
				if (t_player -> getstack() == this)
					t_player -> changewindow((MCSysWindowHandle)t_old_window);
		}

		if (p_level < 255)
			SetLayeredWindowAttributes((HWND)window -> handle . window, 0, p_level, LWA_ALPHA);

		if (t_old_window != NULL)
		{
			RedrawWindow((HWND)window -> handle . window, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW);
			DestroyWindow(t_old_window);
		}
	}
}
示例#27
0
void CSizeEditor::SetValue(int Value)
{
	m_iValue = Value;
	RedrawWindow(NULL);
}
示例#28
0
static void CloseDialogCombo(HWND hwnd, int result){
	RedrawWindow(GetParent(GetParent(m_cbr.hButton)), NULL, NULL, RDW_INVALIDATE);
	ShowNoteMarks(GetParent(GetParent(m_cbr.hButton)));
	EndDialog(hwnd, result);
}
示例#29
0
static LRESULT CALLBACK MDescButtonWndProc(HWND hwndDlg, UINT  msg, WPARAM wParam, LPARAM lParam)
{
	MDescButtonCtrl *dat = (MDescButtonCtrl *)GetWindowLongPtr(hwndDlg, 0);
	switch (msg) {
	case WM_NCCREATE:
		dat = (MDescButtonCtrl*)mir_alloc(sizeof(MDescButtonCtrl));
		if (dat == NULL)
			return FALSE;

		memset(dat, 0, sizeof(MDescButtonCtrl));
		SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)dat);
		MDescButton_SetupColors(dat);
		return TRUE;

	case WM_SETFONT:
		dat->hFont = (HFONT)wParam;
		break;

	case WM_SIZE:
		GetClientRect(hwndDlg, &dat->rc);
		dat->width = dat->rc.right - dat->rc.left;
		dat->height = dat->rc.bottom - dat->rc.top;
		return TRUE;

	case WM_THEMECHANGED:
	case WM_STYLECHANGED:
		MDescButton_SetupColors(dat);
		return TRUE;

	case WM_MOUSEMOVE:
		if (!dat->bMouseInside) {
			TRACKMOUSEEVENT tme = { 0 };
			tme.cbSize = sizeof(tme);
			tme.dwFlags = TME_LEAVE;
			tme.hwndTrack = hwndDlg;
			_TrackMouseEvent(&tme);
			dat->bMouseInside = TRUE;
			RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
		}
		return 0;

	case WM_MOUSELEAVE:
		dat->bMouseInside = FALSE;
		RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
		return 0;

	case WM_LBUTTONUP:
		SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), 0), 0);
		return 0;

	case WM_ERASEBKGND:
		return 1;

	case WM_NCPAINT:
		InvalidateRect(hwndDlg, NULL, FALSE);
		break;

	case WM_PAINT:
		MDescButton_OnPaint(hwndDlg, dat);
		break;

	case DBCM_SETTITLE:
		if (dat->lpzTitle)
			mir_free(dat->lpzTitle);
		if (wParam & MDBCF_UNICODE)
			dat->lpzTitle = mir_u2t((WCHAR *)lParam);
		else
			dat->lpzTitle = mir_a2t((char *)lParam);
		RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
		return TRUE;

	case DBCM_SETDESCRIPTION:
		if (dat->lpzDescription)
			mir_free(dat->lpzDescription);
		if (wParam & MDBCF_UNICODE)
			dat->lpzDescription = mir_u2t((WCHAR *)lParam);
		else
			dat->lpzDescription = mir_a2t((char *)lParam);
		RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
		return TRUE;

	case DBCM_SETICON:
		if (dat->hIcon && !dat->bSharedIcon)
			DestroyIcon(dat->hIcon);

		if (wParam & MDBCF_SHAREDICON) {
			dat->bSharedIcon = TRUE;
			dat->hIcon = (HICON)lParam;
		}
		else {
			dat->bSharedIcon = FALSE;
			dat->hIcon = CopyIcon((HICON)lParam);
		}
		RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
		return TRUE;

	case WM_DESTROY:
		if (dat->lpzTitle)
			mir_free(dat->lpzTitle);
		if (dat->lpzDescription)
			mir_free(dat->lpzDescription);
		if (dat->hIcon && !dat->bSharedIcon)
			DestroyIcon(dat->hIcon);
		mir_free(dat);
		return TRUE;
	}

	return DefWindowProc(hwndDlg, msg, wParam, lParam);
}
示例#30
0
void CWinMenu::OnLButtonUp(UINT nFlags, CPoint point) 
{
	BOOL bCmdArea = FALSE;
	LPMITEMINFO	pmi = GetMenuItem( &point, &bCmdArea );
	if ( pmi == NULL ) return;

	// Call up on toolbar
	if ( m_tbclick != NULL ) 
	{
		if ( m_tbclick->toolbar->OnLButtonUp( nFlags, &point ) )
			RedrawWindow(); 
	} // end if

	// Punt if not in command area
	if ( !bCmdArea ) return;

	// Release capture
	ReleaseCapture();
	
	RedrawLastWindow();
	
	// Send message if needed
	if ( m_menuitem != NULL )
	{
		POINT pt;
		pt.x = point.x;
		pt.y = point.y;
		ClientToScreen( &pt );

		// Which window was choosen
		HWND hParent = ::WindowFromPoint( pt );
		if ( m_bAllowChildren )
		{
			if ( hParent != NULL )
			{
				// Check for child windows
				::ScreenToClient( hParent, &pt );
				HWND hChild = ::ChildWindowFromPoint( hParent, pt );
				
				// Which window to use
				if ( hChild != NULL ) m_hDropWnd = hChild;
				else m_hDropWnd = hParent;
					
			} // end if
		} // end if
		else
		{
			// Get topmost window
			while ( hParent != NULL )
			{
				m_hDropWnd = hParent;
				hParent = ::GetParent( hParent );
			} // end while

		} // end else

		// Send message if there is a target
		if ( m_menuitem->cmd != 0 && m_hWndMsgTarget != NULL )
		{
			::PostMessage( m_hWndMsgTarget, WM_COMMAND, m_menuitem->cmd, 0L );
		} // end if

		m_menuitem = NULL;

		// Kill our window if needed
		if ( !m_bAutoDestroy ) UnselectMenu();
		else DestroyWindow();

	} // end if

	CWnd::OnLButtonUp(nFlags, point);
}