本文整理汇总了C++中GetHwndOf函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHwndOf函数的具体用法?C++ GetHwndOf怎么用?C++ GetHwndOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetHwndOf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Remove
void wxToolTip::SetWindow(wxWindow *win)
{
Remove();
m_window = win;
// add the window itself
if ( m_window )
{
DoAddHWND(m_window->GetHWND());
}
#if !defined(__WXUNIVERSAL__)
// and all of its subcontrols (e.g. radio buttons in a radiobox) as well
wxControl *control = wxDynamicCast(m_window, wxControl);
if ( control )
{
const wxArrayLong& subcontrols = control->GetSubcontrols();
size_t count = subcontrols.GetCount();
for ( size_t n = 0; n < count; n++ )
{
int id = subcontrols[n];
HWND hwnd = GetDlgItem(GetHwndOf(m_window), id);
if ( !hwnd )
{
// maybe it's a child of parent of the control, in fact?
// (radiobuttons are subcontrols, i.e. children of the radiobox
// for wxWidgets but are its siblings at Windows level)
hwnd = GetDlgItem(GetHwndOf(m_window->GetParent()), id);
}
// must have it by now!
wxASSERT_MSG( hwnd, wxT("no hwnd for subcontrol?") );
AddOtherWindow((WXHWND)hwnd);
}
}
#endif // !defined(__WXUNIVERSAL__)
}
示例2: GetHwndOf
bool wxRadioBox::Reparent(wxWindowBase *newParent)
{
if ( !wxStaticBox::Reparent(newParent) )
{
return false;
}
HWND hwndParent = GetHwndOf(GetParent());
for ( size_t item = 0; item < m_radioButtons->GetCount(); item++ )
{
::SetParent((*m_radioButtons)[item], hwndParent);
}
return true;
}
示例3: LaunchTortoiseAct
void ConflictListDialog::OnMenuDiff(wxCommandEvent&)
{
int nItems = myFiles->GetItemCount();
for (int i = 0; i < nItems; ++i)
{
if (myFiles->IsSelected(i))
{
std::string file = ((ConflictListDialog::ItemData*) myFiles->GetItemData(i))->m_Filename;
LaunchTortoiseAct(false, CvsDiffVerb, file, "", GetHwndOf(this));
return;
}
}
}
示例4: ImageList_Destroy
// Create a drag image for the given tree control item
bool wxDragImage::Create(const wxTreeCtrl& treeCtrl, wxTreeItemId& id)
{
if ( m_hImageList )
ImageList_Destroy(GetHimageList());
m_hImageList = (WXHIMAGELIST)
TreeView_CreateDragImage(GetHwndOf(&treeCtrl), (HTREEITEM) id.m_pItem);
if ( !m_hImageList )
{
// fall back on just the item text if there is no image
return Create(treeCtrl.GetItemText(id));
}
return true;
}
示例5: EndMeasuring
void wxTextMeasure::EndMeasuring()
{
if ( m_hfontOld )
{
::SelectObject(m_hdc, m_hfontOld);
m_hfontOld = NULL;
}
if ( m_win )
::ReleaseDC(GetHwndOf(m_win), m_hdc);
//else: our HDC belongs to m_dc, don't touch it
m_hdc = NULL;
}
示例6: Free
void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
{
Free();
m_isIcon = image->IsKindOf( CLASSINFO(wxIcon) );
// the image has already been copied
m_image = image;
int x, y;
int w, h;
GetPosition(&x, &y);
GetSize(&w, &h);
#ifdef __WIN32__
HANDLE handle = (HANDLE)m_image->GetHandle();
LONG style = ::GetWindowLong( (HWND)GetHWND(), GWL_STYLE ) ;
::SetWindowLong( (HWND)GetHWND(), GWL_STYLE, ( style & ~( SS_BITMAP|SS_ICON ) ) |
( m_isIcon ? SS_ICON : SS_BITMAP ) );
HGDIOBJ oldHandle = (HGDIOBJ)::SendMessage(GetHwnd(), STM_SETIMAGE,
m_isIcon ? IMAGE_ICON : IMAGE_BITMAP, (LPARAM)handle);
// detect if this is still the handle we passed before or
// if the static-control made a copy of the bitmap!
if (m_currentHandle != 0 && oldHandle != (HGDIOBJ) m_currentHandle)
{
// the static control made a copy and we are responsible for deleting it
DeleteObject((HGDIOBJ) oldHandle);
}
m_currentHandle = (WXHANDLE)handle;
#endif // Win32
if ( ImageIsOk() )
{
int width = image->GetWidth(),
height = image->GetHeight();
if ( width && height )
{
w = width;
h = height;
::MoveWindow(GetHwnd(), x, y, width, height, FALSE);
}
}
RECT rect;
rect.left = x;
rect.top = y;
rect.right = x + w;
rect.bottom = y + h;
::InvalidateRect(GetHwndOf(GetParent()), &rect, TRUE);
}
示例7: CanPaste
bool wxTextCtrl::CanPaste() const
{
if ( !IsEditable() )
return false;
// Standard edit control: check for straight text on clipboard
if ( !::OpenClipboard(GetHwndOf(wxTheApp->GetTopWindow())) )
return false;
bool isTextAvailable = ::IsClipboardFormatAvailable(CF_TEXT) != 0;
::CloseClipboard();
return isTextAvailable;
}
示例8: memset
int wxColourDialog::ShowModal()
{
CHOOSECOLOR chooseColorStruct;
COLORREF custColours[16];
memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR));
int i;
for (i = 0; i < 16; i++)
{
if (m_colourData.m_custColours[i].Ok())
custColours[i] = wxColourToRGB(m_colourData.m_custColours[i]);
else
custColours[i] = RGB(255,255,255);
}
chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR);
if ( m_parent )
chooseColorStruct.hwndOwner = GetHwndOf(m_parent);
chooseColorStruct.rgbResult = wxColourToRGB(m_colourData.m_dataColour);
chooseColorStruct.lpCustColors = custColours;
chooseColorStruct.Flags = CC_RGBINIT | CC_ENABLEHOOK;
chooseColorStruct.lCustData = (LPARAM)this;
chooseColorStruct.lpfnHook = wxColourDialogHookProc;
if (m_colourData.GetChooseFull())
chooseColorStruct.Flags |= CC_FULLOPEN;
// Do the modal dialog
bool success = ::ChooseColor(&(chooseColorStruct)) != 0;
// Try to highlight the correct window (the parent)
if (GetParent())
{
HWND hWndParent = (HWND) GetParent()->GetHWND();
if (hWndParent)
::BringWindowToTop(hWndParent);
}
// Restore values
for (i = 0; i < 16; i++)
{
wxRGBToColour(m_colourData.m_custColours[i], custColours[i]);
}
wxRGBToColour(m_colourData.m_dataColour, chooseColorStruct.rgbResult);
return success ? wxID_OK : wxID_CANCEL;
}
示例9: ti
void wxToolTip::SetTip( const wxString &tip )
{
m_text = tip;
if ( m_window )
{
#if 0
// update it immediately
wxToolInfo ti(GetHwndOf(m_window));
ti.lpszText = (wxChar *)m_text.c_str();
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
#endif
}
}
示例10: MSWShouldPreProcessMessage
bool wxChoice::MSWShouldPreProcessMessage(WXMSG *pMsg)
{
MSG *msg = (MSG *) pMsg;
// if the dropdown list is visible, don't preprocess certain keys
if ( msg->message == WM_KEYDOWN
&& (msg->wParam == VK_ESCAPE || msg->wParam == VK_RETURN) )
{
if (::SendMessage(GetHwndOf(this), CB_GETDROPPEDSTATE, 0, 0))
{
return false;
}
}
return wxControl::MSWShouldPreProcessMessage(pMsg);
}
示例11: notifyData
bool wxTaskBarIcon::RemoveIcon()
{
if (!m_iconAdded)
return false;
m_iconAdded = false;
NotifyIconData notifyData(GetHwndOf(m_win));
bool ok = Shell_NotifyIcon(NIM_DELETE, ¬ifyData) != 0;
if ( !ok )
{
wxLogLastError(wxT("Shell_NotifyIcon(NIM_DELETE)"));
}
return ok;
}
示例12: GetPosition
WXLRESULT
wxStatusBar95::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
#ifndef __WXWINCE__
if ( nMsg == WM_WINDOWPOSCHANGING )
{
WINDOWPOS *lpPos = (WINDOWPOS *)lParam;
int x, y, w, h;
GetPosition(&x, &y);
GetSize(&w, &h);
// we need real window coords and not wx client coords
AdjustForParentClientOrigin(x, y);
lpPos->x = x;
lpPos->y = y;
lpPos->cx = w;
lpPos->cy = h;
return 0;
}
if ( nMsg == WM_NCLBUTTONDOWN )
{
// if hit-test is on gripper then send message to TLW to begin
// resizing. It is possible to send this message to any window.
if ( wParam == HTBOTTOMRIGHT )
{
wxWindow *win;
for ( win = GetParent(); win; win = win->GetParent() )
{
if ( win->IsTopLevel() )
{
SendMessage(GetHwndOf(win), WM_NCLBUTTONDOWN,
wParam, lParam);
return 0;
}
}
}
}
#endif
return wxStatusBarBase::MSWWindowProc(nMsg, wParam, lParam);
}
示例13: GetHwndOf
int CocoaDialogApp::OnExit() {
#ifdef __WXMSW__
if (m_parentWnd) {
// Activate the parent frame
HWND hwnd = GetHwndOf(m_parentWnd);
::SetForegroundWindow(hwnd);
::SetFocus(hwnd);
m_parentWnd->DissociateHandle();
delete m_parentWnd;
}
#endif //__WXMSW__
wxLogDebug(wxT("wxCD exit done"));
return wxApp::OnExit();
}
示例14: GetRect
bool wxSpinCtrl::Reparent(wxWindowBase *newParent)
{
// Reparenting both the updown control and its buddy does not seem to work:
// they continue to be connected somehow, but visually there is no feedback
// on the buddy edit control. To avoid this problem, we reparent the buddy
// window normally, but we recreate the updown control and reassign its
// buddy.
// Get the position before changing the parent as it would be offset after
// changing it.
const wxRect rect = GetRect();
if ( !wxWindowBase::Reparent(newParent) )
return false;
newParent->GetChildren().DeleteObject(this);
// destroy the old spin button after detaching it from this wxWindow object
// (notice that m_hWnd will be reset by UnsubclassWin() so save it first)
const HWND hwndOld = GetHwnd();
UnsubclassWin();
if ( !::DestroyWindow(hwndOld) )
{
wxLogLastError(wxT("DestroyWindow"));
}
// create and initialize the new one
if ( !wxSpinButton::Create(GetParent(), GetId(),
rect.GetPosition(), rect.GetSize(),
GetWindowStyle(), GetName()) )
return false;
// reapply our values to wxSpinButton
wxSpinButton::SetValue(GetValue());
SetRange(m_min, m_max);
// also set the size again with wxSIZE_ALLOW_MINUS_ONE flag: this is
// necessary if our original position used -1 for either x or y
SetSize(rect, wxSIZE_ALLOW_MINUS_ONE);
// associate it with the buddy control again
::SetParent(GetBuddyHwnd(), GetHwndOf(GetParent()));
(void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)GetBuddyHwnd(), 0);
return true;
}
示例15: wxCHECK_MSG
bool
wxTaskBarIcon::ShowBalloon(const wxString& title,
const wxString& text,
unsigned msec,
int flags)
{
wxCHECK_MSG( m_iconAdded, false,
wxT("can't be used before the icon is created") );
const HWND hwnd = GetHwndOf(m_win);
// we need to enable version 5.0 behaviour to receive notifications about
// the balloon disappearance
NotifyIconData notifyData(hwnd);
notifyData.uFlags = 0;
notifyData.uVersion = 3 /* NOTIFYICON_VERSION for Windows 2000/XP */;
if ( !Shell_NotifyIcon(NIM_SETVERSION, ¬ifyData) )
{
wxLogLastError(wxT("Shell_NotifyIcon(NIM_SETVERSION)"));
}
// do show the balloon now
notifyData = NotifyIconData(hwnd);
notifyData.uFlags |= NIF_INFO;
notifyData.uTimeout = msec;
wxStrlcpy(notifyData.szInfo, text.t_str(), WXSIZEOF(notifyData.szInfo));
wxStrlcpy(notifyData.szInfoTitle, title.t_str(),
WXSIZEOF(notifyData.szInfoTitle));
if ( flags & wxICON_INFORMATION )
notifyData.dwInfoFlags |= NIIF_INFO;
else if ( flags & wxICON_WARNING )
notifyData.dwInfoFlags |= NIIF_WARNING;
else if ( flags & wxICON_ERROR )
notifyData.dwInfoFlags |= NIIF_ERROR;
bool ok = Shell_NotifyIcon(NIM_MODIFY, ¬ifyData) != 0;
if ( !ok )
{
wxLogLastError(wxT("Shell_NotifyIcon(NIM_MODIFY)"));
}
return ok;
}