本文整理汇总了C++中GetHWND函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHWND函数的具体用法?C++ GetHWND怎么用?C++ GetHWND使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetHWND函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sizeof
NS_IMETHODIMP
otSystrayWin::SetTooltip(const nsAString &tooltip)
{
otSystrayBase::SetTooltip(tooltip);
if (mNid) {
NOTIFYICONDATA nid;
nid.cbSize = sizeof(nid);
nid.hWnd = GetHWND();
nid.uFlags = NIF_TIP;
nid.uID = mNid;
StringCchCopy(nid.szTip, 64, NS_ConvertUTF16toUTF8(mTooltip).get());
Shell_NotifyIcon(NIM_MODIFY, &nid);
}
return NS_OK;
}
开发者ID:GYGit,项目名称:oneteam,代码行数:20,代码来源:otSystrayWin.cpp
示例2: wxGetCharSize
wxSize wxSpinCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
{
wxSize sizeBtn = wxSpinButton::DoGetBestSize();
int y;
wxGetCharSize(GetHWND(), NULL, &y, GetFont());
// JACS: we should always use the height calculated
// from above, because otherwise we'll get a spin control
// that's too big. So never use the height calculated
// from wxSpinButton::DoGetBestSize().
wxSize tsize(xlen + sizeBtn.x + MARGIN_BETWEEN + 3*y/10 + 10,
EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));
// Check if the user requested a non-standard height.
if ( ylen > 0 )
tsize.IncBy(0, ylen - y);
return tsize;
}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:20,代码来源:spinctrl.cpp
示例3: GetHWND
LRESULT TopWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
GuiLock __;
HWND hwnd = GetHWND();
#ifndef PLATFORM_WINCE
bool inloop;
#endif
switch(message) {
#ifndef PLATFORM_WINCE
case WM_QUERYENDSESSION:
inloop = InLoop();
WhenClose();
return inloop ? !InLoop() : !IsOpen();
#endif
case WM_CLOSE:
if(IsEnabled()) {
IgnoreMouseUp();
WhenClose();
}
return 0;
case WM_WINDOWPOSCHANGED:
if(!isopen)
break;
#ifndef PLATFORM_WINCE
if(IsIconic(hwnd))
state = MINIMIZED;
else
if(IsZoomed(hwnd))
state = MAXIMIZED;
else
#endif
{
state = OVERLAPPED;
if(IsWindowVisible(hwnd)) overlapped = GetScreenClient(hwnd); // 12-05-23 Tom added 'if(IsWindowVisible(hwnd))' to get only proper rectangles
}
LLOG("TopWindow::WindowProc::WM_WINDOWPOSCHANGED: overlapped = " << overlapped);
Layout();
break;
}
return Ctrl::WindowProc(message, wParam, lParam);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:41,代码来源:TopWin32.cpp
示例4: UpdateMenus
void UpdateMenus()
{
HMENU menu = GetMenu(GetHWND());
#define CHECKITEM(item,value) CheckMenuItem(menu,item,MF_BYCOMMAND | ((value) ? MF_CHECKED : MF_UNCHECKED));
CHECKITEM(ID_EMULATION_SPEEDLIMIT,g_Config.bSpeedLimit);
// CHECK(ID_OPTIONS_ENABLEFRAMEBUFFER,g_Config.bEnableFrameBuffer);
// CHECK(ID_OPTIONS_EMULATESYSCALL,g_bEmulateSyscall);
CHECKITEM(ID_OPTIONS_DISPLAYRAWFRAMEBUFFER, g_Config.bDisplayFramebuffer);
CHECKITEM(ID_OPTIONS_IGNOREILLEGALREADS,g_Config.bIgnoreBadMemAccess);
CHECKITEM(ID_CPU_INTERPRETER,g_Config.iCpuCore == CPU_INTERPRETER);
CHECKITEM(ID_CPU_FASTINTERPRETER,g_Config.iCpuCore == CPU_FASTINTERPRETER);
CHECKITEM(ID_CPU_DYNAREC,g_Config.iCpuCore == CPU_JIT);
CHECKITEM(ID_OPTIONS_BUFFEREDRENDERING, g_Config.bBufferedRendering);
CHECKITEM(ID_OPTIONS_SHOWDEBUGSTATISTICS, g_Config.bShowDebugStats);
BOOL enable = !Core_IsStepping();
EnableMenuItem(menu,ID_EMULATION_RUN,enable);
EnableMenuItem(menu,ID_EMULATION_PAUSE,!enable);
enable = g_State.bEmuThreadStarted;
EnableMenuItem(menu,ID_FILE_LOAD,enable);
EnableMenuItem(menu,ID_CPU_DYNAREC,enable);
EnableMenuItem(menu,ID_CPU_INTERPRETER,enable);
EnableMenuItem(menu,ID_CPU_FASTINTERPRETER,enable);
EnableMenuItem(menu,ID_DVD_INSERTISO,enable);
EnableMenuItem(menu,ID_FILE_BOOTBIOS,enable);
EnableMenuItem(menu,ID_EMULATION_STOP,!enable);
EnableMenuItem(menu,ID_OPTIONS_SETTINGS,enable);
EnableMenuItem(menu,ID_PLUGINS_CHOOSEPLUGINS,enable);
const int zoomitems[4] = {
ID_OPTIONS_SCREEN1X,
ID_OPTIONS_SCREEN2X,
ID_OPTIONS_SCREEN3X,
ID_OPTIONS_SCREEN4X,
};
for (int i = 0; i < 4; i++) {
CheckMenuItem(menu, zoomitems[i], MF_BYCOMMAND | ((i == g_Config.iWindowZoom - 1) ? MF_CHECKED : MF_UNCHECKED));
}
}
开发者ID:jacky400,项目名称:ppsspp,代码行数:41,代码来源:WndMainWindow.cpp
示例5: wxStrcpy
// Insert an item
bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data)
{
wxChar buf[256];
TC_ITEM tcItem;
tcItem.mask = TCIF_PARAM;
tcItem.lParam = (long) data;
if (!text.empty())
{
tcItem.mask |= TCIF_TEXT;
wxStrcpy(buf, (const wxChar*) text);
tcItem.pszText = buf;
tcItem.cchTextMax = 256;
}
if (imageId != -1)
{
tcItem.mask |= TCIF_IMAGE;
tcItem.iImage = imageId;
}
return (TabCtrl_InsertItem( (HWND) GetHWND(), item, & tcItem) != -1);
}
开发者ID:EdgarTx,项目名称:wx,代码行数:22,代码来源:tabctrl.cpp
示例6: RevokeDragDrop
void Ctrl::WndFree()
{
GuiLock __;
if(!top) return;
RevokeDragDrop(GetHWND());
ReleaseUDropTarget(top->dndtgt);
isopen = false;
if(!top) return;
HWND owner = GetWindow(top->hwnd, GW_OWNER);// CXL 31.10.2003 z DoRemove
bool focus = ::GetFocus() == top->hwnd;
LLOG("Ctrl::WndDestroy owner " << (void *)owner
<< " focus " << focus
<< " ::GetFocus() " << (void *)::GetFocus());
if(owner && focus) { // CXL 7.11.2003 presun - melo by to fungovat take a neblikat...
LLOG("Ctrl::WndFree->SetFocus " << UPP::Name(Ctrl::CtrlFromHWND(owner)));
::SetFocus(owner);
}
LLOG(LOG_END << "//Ctrl::WndFree() in " <<UPP::Name(this));
delete top;
top = NULL;
}
开发者ID:koz4k,项目名称:soccer,代码行数:21,代码来源:Win32Wnd.cpp
示例7: wxGetCharSize
wxSize wxSpinCtrl::DoGetBestSize() const
{
wxSize sizeBtn = wxSpinButton::DoGetBestSize();
sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
int y;
wxGetCharSize(GetHWND(), NULL, &y, GetFont());
y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y);
// JACS: we should always use the height calculated
// from above, because otherwise we'll get a spin control
// that's too big. So never use the height calculated
// from wxSpinButton::DoGetBestSize().
// if ( sizeBtn.y < y )
{
// make the text tall enough
sizeBtn.y = y;
}
return sizeBtn;
}
开发者ID:georgemoralis,项目名称:jpcsp2c,代码行数:22,代码来源:spinctrl.cpp
示例8: DropHelper
HRESULT DropTarget::DragEnter(IDataObject* data_object,
DWORD key_state,
POINTL cursor_position,
DWORD* effect) {
// Tell the helper that we entered so it can update the drag image.
IDropTargetHelper* drop_helper = DropHelper();
if (drop_helper) {
drop_helper->DragEnter(GetHWND(), data_object,
reinterpret_cast<POINT*>(&cursor_position), *effect);
}
// You can't drag and drop within the same HWND.
if (suspended_) {
*effect = DROPEFFECT_NONE;
return S_OK;
}
current_data_object_ = data_object;
POINT screen_pt = { cursor_position.x, cursor_position.y };
*effect = OnDragEnter(current_data_object_, key_state, screen_pt, *effect);
return S_OK;
}
开发者ID:baogechen,项目名称:foundit,代码行数:22,代码来源:DropTarget.cpp
示例9: wxGetWindowText
wxSize wxCheckBox::DoGetBestSize() const
{
static int s_checkSize = 0;
if ( !s_checkSize )
{
wxScreenDC dc;
dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
s_checkSize = dc.GetCharHeight();
}
wxString str = wxGetWindowText(GetHWND());
int wCheckbox, hCheckbox;
if ( !str.empty() )
{
wxClientDC dc(const_cast<wxCheckBox *>(this));
dc.SetFont(GetFont());
dc.GetMultiLineTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox);
wCheckbox += s_checkSize + GetCharWidth();
if ( hCheckbox < s_checkSize )
hCheckbox = s_checkSize;
}
else
{
wCheckbox = s_checkSize;
hCheckbox = s_checkSize;
}
#ifdef __WXWINCE__
hCheckbox += 1;
#endif
wxSize best(wCheckbox, hCheckbox);
CacheBestSize(best);
return best;
}
开发者ID:mark711,项目名称:Cafu,代码行数:38,代码来源:checkbox.cpp
示例10: CalPos
/* void CEditWnd::Init(CEditUI* pOwner)
{
m_pOwner = pOwner;
RECT rcPos = CalPos();
UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
if( m_pOwner->IsPasswordMode() ) uStyle |= ES_PASSWORD;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
HFONT hFont=NULL;
int iFontIndex=m_pOwner->GetFont();
if (iFontIndex!=-1)
hFont=m_pOwner->GetManager()->GetFont(iFontIndex);
if (hFont==NULL)
hFont=m_pOwner->GetManager()->GetDefaultFontInfo()->hFont;
SetWindowFont(m_hWnd, hFont, TRUE);
Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar());
if( m_pOwner->IsPasswordMode() ) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar());
Edit_SetText(m_hWnd, m_pOwner->GetText());
Edit_SetModify(m_hWnd, FALSE);
SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0));
Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true);
Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true);
//Styls
LONG styleValue = ::GetWindowLong(m_hWnd, GWL_STYLE);
styleValue |= pOwner->GetWindowStyls();
::SetWindowLong(GetHWND(), GWL_STYLE, styleValue);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
m_bInit = true;
}
*/
void CEditWnd::Init(CEditUI* pOwner)
{
m_pOwner = pOwner;
RECT rcPos = CalPos();
//UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
UINT uStyle = WS_POPUP | ES_AUTOHSCROLL | WS_VISIBLE;
RECT rcWnd={0};
::GetWindowRect(m_pOwner->GetManager()->GetPaintWindow(), &rcWnd);
rcPos.left += rcWnd.left;
rcPos.right += rcWnd.left;
rcPos.top += rcWnd.top;
rcPos.bottom += rcWnd.top;
if( m_pOwner->IsPasswordMode() ) uStyle |= ES_PASSWORD;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
HFONT hFont=NULL;
int iFontIndex=m_pOwner->GetFont();
if (iFontIndex!=-1)
hFont=m_pOwner->GetManager()->GetFont(iFontIndex);
if (hFont==NULL)
hFont=m_pOwner->GetManager()->GetDefaultFontInfo()->hFont;
SetWindowFont(m_hWnd, hFont, TRUE);
Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar());
if( m_pOwner->IsPasswordMode() ) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar());
Edit_SetText(m_hWnd, m_pOwner->GetText());
Edit_SetModify(m_hWnd, FALSE);
SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0));
Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true);
Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true);
//Styls
LONG styleValue = ::GetWindowLong(m_hWnd, GWL_STYLE);
styleValue |= pOwner->GetWindowStyls();
::SetWindowLong(GetHWND(), GWL_STYLE, styleValue);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
m_bInit = true;
}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:69,代码来源:UIEdit.cpp
示例11: CalPos
void CEditWnd::Init(CEditUI* pOwner)
{
m_pOwner = pOwner;
RECT rcPos = CalPos();
UINT uStyle = WS_CHILD | ES_AUTOHSCROLL;
if( m_pOwner->IsPasswordMode() ) uStyle |= ES_PASSWORD;
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
Edit_LimitText(m_hWnd, m_pOwner->GetMaxChar());
if( m_pOwner->IsPasswordMode() ) Edit_SetPasswordChar(m_hWnd, m_pOwner->GetPasswordChar());
Edit_SetText(m_hWnd, m_pOwner->GetText());
Edit_SetModify(m_hWnd, FALSE);
SendMessage(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELPARAM(0, 0));
Edit_Enable(m_hWnd, m_pOwner->IsEnabled() == true);
Edit_SetReadOnly(m_hWnd, m_pOwner->IsReadOnly() == true);
//Styls
LONG styleValue = ::GetWindowLong(m_hWnd, GWL_STYLE);
styleValue |= pOwner->GetWindowStyls();
::SetWindowLong(GetHWND(), GWL_STYLE, styleValue);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
m_bInit = true;
}
开发者ID:fftyjw,项目名称:cdui,代码行数:23,代码来源:UIEdit.cpp
示例12: GetMDIParent
void wxMDIChildFrame::MSWDestroyWindow()
{
wxMDIParentFrame * const parent = GetMDIParent();
// Must make sure this handle is invalidated (set to NULL) since all sorts
// of things could happen after the child client is destroyed, but before
// the wxFrame is destroyed.
HWND oldHandle = (HWND)GetHWND();
SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY,
(WPARAM)oldHandle, 0);
if (parent->GetActiveChild() == NULL)
ResetWindowStyle(NULL);
if (m_hMenu)
{
::DestroyMenu((HMENU) m_hMenu);
m_hMenu = 0;
}
wxRemoveHandleAssociation(this);
m_hWnd = 0;
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:23,代码来源:mdi.cpp
示例13: getWindowsBorderRect
void LoginForm::setFrameRegion()
{
#ifdef WIN32
wxRect wbr = getWindowsBorderRect();
wxPoint br = wbr.GetBottomRight();
br.x += 2;
br.y += 2;
wxRegion region = CreateRoundRectRgn(wbr.x, wbr.y, br.x, br.y, 5, 5);
// Windows takes ownership of the region, so
// we'll have to make a copy of the region to give to it.
DWORD noBytes = ::GetRegionData(GetHrgnOf(region), 0, nullptr);
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
::GetRegionData(GetHrgnOf(region), noBytes, rgnData);
HRGN hrgn = ::ExtCreateRegion(nullptr, noBytes, rgnData);
delete[] (char*) rgnData;
// Now call the shape API with the new region.
::SetWindowRgn((HWND)GetHWND(), hrgn, FALSE);
#endif // LINUX TODO
}
开发者ID:EasyCoding,项目名称:desura-app,代码行数:23,代码来源:LoginForm.cpp
示例14: UpdateCommands
void UpdateCommands() {
static GlobalUIState lastGlobalUIState = UISTATE_PAUSEMENU;
static CoreState lastCoreState = CORE_ERROR;
if (lastGlobalUIState == globalUIState && lastCoreState == coreState)
return;
lastCoreState = coreState;
lastGlobalUIState = globalUIState;
HMENU menu = GetMenu(GetHWND());
const char* pauseMenuText = (Core_IsStepping() || globalUIState != UISTATE_INGAME) ? "Run\tF8" : "Pause\tF8";
ModifyMenu(menu, ID_TOGGLE_PAUSE, MF_BYCOMMAND | MF_STRING, ID_TOGGLE_PAUSE, pauseMenuText);
UINT ingameEnable = globalUIState == UISTATE_INGAME ? MF_ENABLED : MF_GRAYED;
EnableMenuItem(menu, ID_TOGGLE_PAUSE, ingameEnable);
EnableMenuItem(menu, ID_EMULATION_STOP, ingameEnable);
EnableMenuItem(menu, ID_EMULATION_RESET, ingameEnable);
UINT menuEnable = globalUIState == UISTATE_MENU ? MF_ENABLED : MF_GRAYED;
EnableMenuItem(menu, ID_FILE_SAVESTATEFILE, !menuEnable);
EnableMenuItem(menu, ID_FILE_LOADSTATEFILE, !menuEnable);
EnableMenuItem(menu, ID_FILE_QUICKSAVESTATE, !menuEnable);
EnableMenuItem(menu, ID_FILE_QUICKLOADSTATE, !menuEnable);
EnableMenuItem(menu, ID_CPU_DYNAREC, menuEnable);
EnableMenuItem(menu, ID_CPU_INTERPRETER, menuEnable);
EnableMenuItem(menu, ID_CPU_MULTITHREADED, menuEnable);
EnableMenuItem(menu, ID_IO_MULTITHREADED, menuEnable);
EnableMenuItem(menu, ID_TOGGLE_PAUSE, !menuEnable);
EnableMenuItem(menu, ID_EMULATION_STOP, !menuEnable);
EnableMenuItem(menu, ID_EMULATION_RESET, !menuEnable);
EnableMenuItem(menu, ID_DEBUG_LOG, !g_Config.bEnableLogging);
EnableMenuItem(menu, ID_EMULATION_RENDER_MODE_OGL, menuEnable);
EnableMenuItem(menu, ID_EMULATION_RENDER_MODE_SOFT, menuEnable);
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, !Atrac3plus_Decoder::IsInstalled());
}
开发者ID:jimmyw,项目名称:ppsspp,代码行数:37,代码来源:WndMainWindow.cpp
示例15: SetName
bool wxWindow::LoadNativeDialog(wxWindow* parent, const wxString& name)
{
SetName(name);
wxWindowCreationHook hook(this);
m_hWnd = (WXHWND)::CreateDialog((HINSTANCE) wxGetInstance(),
name.c_str(),
parent ? (HWND)parent->GetHWND() : 0,
(DLGPROC)wxDlgProc);
if ( !m_hWnd )
return false;
SubclassWin(GetHWND());
if ( parent )
parent->AddChild(this);
else
wxTopLevelWindows.Append(this);
// Enumerate all children
HWND hWndNext;
hWndNext = ::GetWindow((HWND) m_hWnd, GW_CHILD);
if (hWndNext)
CreateWindowFromHWND(this, (WXHWND) hWndNext);
while (hWndNext != (HWND) NULL)
{
hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT);
if (hWndNext)
CreateWindowFromHWND(this, (WXHWND) hWndNext);
}
return true;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:36,代码来源:nativdlg.cpp
示例16: wxGetCharSize
wxSize wxSpinCtrl::DoGetBestSize() const
{
wxSize vSizeBtn = wxSpinButton::DoGetBestSize();
int nHeight;
wxFont vFont = (wxFont)GetFont();
vSizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN;
wxGetCharSize( GetHWND()
,NULL
,&nHeight
,&vFont
);
nHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nHeight)+4;
if (vSizeBtn.y < nHeight)
{
//
// Make the text tall enough
//
vSizeBtn.y = nHeight;
}
return vSizeBtn;
} // end of wxSpinCtrl::DoGetBestSize
开发者ID:jonntd,项目名称:dynamica,代码行数:24,代码来源:spinctrl.cpp
示例17: OnKeyDown
void wxBaseModalDialog::OnKeyDown(const wxKeyEvent &event)
{
#ifdef __WIN32__
if (!GetHWND())
return;
#endif
wxASSERT(TRUE == IsModal());
if(true == IsActive())
{
// "Esc" works as an accelerator for the "Cancel" button, but it
// shouldn't close the dialog which doesn't have any cancel button
if(WXK_ESCAPE == event.m_keyCode)
{
wxWindow *window = FindWindow(wxID_CANCEL);
if( (NULL != window) &&
(true == window->IsEnabled()))
{
Cancel();
}
}
// Same thing for Return keys.
else if( (WXK_RETURN == event.m_keyCode) ||
(WXK_NUMPAD_ENTER == event.m_keyCode))
{
wxWindow *window = FindWindow(wxID_OK);
if( (NULL != window) &&
(true == window->IsEnabled()))
{
Ok();
}
}
}
}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:36,代码来源:BaseModalDialog.cpp
示例18: str
wxSize wxListBox::DoGetBestSize() const
{
// find the widest string
int wLine;
int wListbox = 0;
for (unsigned int i = 0; i < m_noItems; i++)
{
wxString str(GetString(i));
GetTextExtent(str, &wLine, NULL);
if ( wLine > wListbox )
wListbox = wLine;
}
// give it some reasonable default value if there are no strings in the
// list
if ( wListbox == 0 )
wListbox = 100;
// the listbox should be slightly larger than the widest string
int cx, cy;
wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
wListbox += 3*cx;
// Add room for the scrollbar
wListbox += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
// don't make the listbox too tall (limit height to 10 items) but don't
// make it too small neither
int hListbox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*
wxMin(wxMax(m_noItems, 3), 10);
wxSize best(wListbox, hListbox);
CacheBestSize(best);
return best;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:36,代码来源:listbox.cpp
示例19: GetParent
// helper for OnPaint(): really erase the background, i.e. do it even if we
// don't have any non default brush for doing it (DoEraseBackground() doesn't
// do anything in such case)
void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
{
// note that we do not use the box background colour here, it shouldn't
// apply to its interior for several reasons:
// 1. wxGTK doesn't do it
// 2. controls inside the box don't get correct bg colour because they
// are not our children so we'd have some really ugly colour mix if
// we did it
// 3. this is backwards compatible behaviour and some people rely on it,
// see http://groups.google.com/groups?selm=4252E932.3080801%40able.es
wxWindow *parent = GetParent();
HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(dc.GetHDC(), GetHWND());
// if there is no special brush for painting this control, just use the
// solid background colour
wxBrush brush;
if ( !hbr )
{
brush = wxBrush(parent->GetBackgroundColour());
hbr = GetHbrushOf(brush);
}
::FillRect(GetHdcOf(dc), &rc, hbr);
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:27,代码来源:statbox.cpp
示例20: GetHWND
void wxSpinCtrl::DoGetPosition(int *x, int *y) const
{
// Because both subcontrols are mirrored manually
// (for layout direction purposes, see note)
// and leftmost control can be either spin or buddy text
// we need to get positions for both controls
// and return this with lower horizonal value.
// Note:
// Logical positions in manual mirroring:
// our layout == parent layout => x(Text) < x(Button)
// our layout != parent layout => x(Button) < x(Text)
// hack: pretend that our HWND is the text control just for a moment
int xBuddy;
WXHWND hWnd = GetHWND();
wxConstCast(this, wxSpinCtrl)->m_hWnd = m_hwndBuddy;
wxSpinButton::DoGetPosition(&xBuddy, y);
int xText;
wxConstCast(this, wxSpinCtrl)->m_hWnd = hWnd;
wxSpinButton::DoGetPosition(&xText, y);
*x = wxMin(xBuddy, xText);
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:24,代码来源:spinctrl.cpp
注:本文中的GetHWND函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论