本文整理汇总了C++中GetParent函数的典型用法代码示例。如果您正苦于以下问题:C++ GetParent函数的具体用法?C++ GetParent怎么用?C++ GetParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetParent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetPageText
int wxTreebookExt::ChangeSelection(size_t n) {
int i = wxTreebook::ChangeSelection(n);
wxString Temp = GetPageText( n );
((wxDialog*)GetParent())->SetTitle( Temp );
return i;
};
开发者ID:PhilSee,项目名称:audacity,代码行数:6,代码来源:PrefsDialog.cpp
示例2: switch
INT_PTR CALLBACK
CFileDefExt::GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
LPPROPSHEETPAGEW ppsp = (LPPROPSHEETPAGEW)lParam;
if (ppsp == NULL || !ppsp->lParam)
break;
TRACE("WM_INITDIALOG hwnd %p lParam %p ppsplParam %S\n", hwndDlg, lParam, ppsp->lParam);
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(ppsp->lParam);
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pFileDefExt);
pFileDefExt->InitGeneralPage(hwndDlg);
break;
}
case WM_COMMAND:
if (LOWORD(wParam) == 14024) /* Opens With - Change */
{
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
OPENASINFO oainfo;
oainfo.pcszFile = pFileDefExt->m_wszPath;
oainfo.pcszClass = NULL;
oainfo.oaifInFlags = OAIF_REGISTER_EXT|OAIF_FORCE_REGISTRATION;
return SUCCEEDED(SHOpenWithDialog(hwndDlg, &oainfo));
}
else if (LOWORD(wParam) == 14021 || LOWORD(wParam) == 14022 || LOWORD(wParam) == 14023) /* checkboxes */
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
else if (LOWORD(wParam) == 14001) /* Name */
{
if (HIWORD(wParam) == EN_CHANGE)
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
case WM_NOTIFY:
{
LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
if (lppsn->hdr.code == PSN_APPLY)
{
CFileDefExt *pFileDefExt = reinterpret_cast<CFileDefExt *>(GetWindowLongPtr(hwndDlg, DWLP_USER));
/* Update attributes first */
DWORD dwAttr = GetFileAttributesW(pFileDefExt->m_wszPath);
if (dwAttr)
{
dwAttr &= ~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_ARCHIVE);
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14021, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_READONLY;
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14022, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_HIDDEN;
if (BST_CHECKED == SendDlgItemMessageW(hwndDlg, 14023, BM_GETCHECK, 0, 0))
dwAttr |= FILE_ATTRIBUTE_ARCHIVE;
if (!SetFileAttributesW(pFileDefExt->m_wszPath, dwAttr))
ERR("SetFileAttributesW failed\n");
}
/* Update filename now */
WCHAR wszBuf[MAX_PATH];
StringCchCopyW(wszBuf, _countof(wszBuf), pFileDefExt->m_wszPath);
LPWSTR pwszFilename = PathFindFileNameW(wszBuf);
UINT cchFilenameMax = _countof(wszBuf) - (pwszFilename - wszBuf);
if (GetDlgItemTextW(hwndDlg, 14001, pwszFilename, cchFilenameMax))
{
if (!MoveFileW(pFileDefExt->m_wszPath, wszBuf))
ERR("MoveFileW failed\n");
}
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, PSNRET_NOERROR);
return TRUE;
}
break;
}
default:
break;
}
return FALSE;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:83,代码来源:filedefext.cpp
示例3: SetPos
void CVolumeCtrl::SetPosInternal(int pos)
{
SetPos(pos);
GetParent()->PostMessage(WM_HSCROLL, MAKEWPARAM((short)pos, SB_THUMBPOSITION), (LPARAM)m_hWnd); // this will be reflected back on us
}
开发者ID:Armada651,项目名称:mpc-hc,代码行数:5,代码来源:VolumeCtrl.cpp
示例4: OnBnClickedButtonCancel
void CInitialConfigDlg::OnBnClickedButtonCancel()
{
// TODO: 在此添加控件通知处理程序代码
::SendMessage(GetParent()->GetSafeHwnd(),WM_MY_RefreshNodeInfoList,NULL,NULL);
SendMessage(WM_CLOSE);
}
开发者ID:eseawind,项目名称:LinkSoftware,代码行数:6,代码来源:InitialConfigDlg.cpp
示例5: GetWindowRect
void CTreePropSheetSplitter::GetAdjustedClientRect(CRect* pRect) const
{
GetWindowRect(pRect);
GetParent()->ScreenToClient(pRect);
}
开发者ID:professor-nishui,项目名称:olanguage,代码行数:5,代码来源:TreePropSheetSplitter.cpp
示例6: GetParent
// Moves widget in Z direction
void Widget::Dive(int dz)
{
GetParent()->Lift( -dz, this);
}
开发者ID:BackupTheBerlios,项目名称:utgs-svn,代码行数:5,代码来源:Widget.cpp
示例7: ColourPickerWndProc
static LRESULT CALLBACK ColourPickerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_CREATE:
SetWindowLongPtr(hwnd, 0, 0);
SetWindowLongPtr(hwnd, sizeof(COLORREF), 0);
break;
case CPM_SETDEFAULTCOLOUR:
SetWindowLongPtr(hwnd, sizeof(COLORREF), lParam);
break;
case CPM_GETDEFAULTCOLOUR:
return GetWindowLongPtr(hwnd, sizeof(COLORREF));
case CPM_SETCOLOUR:
SetWindowLongPtr(hwnd, 0, lParam);
InvalidateRect(hwnd, NULL, FALSE);
break;
case CPM_GETCOLOUR:
return GetWindowLongPtr(hwnd, 0);
case WM_LBUTTONUP:
{
COLORREF custColours[16] = { 0 };
custColours[0] = GetWindowLongPtr(hwnd, sizeof(COLORREF));
CHOOSECOLOR cc = { 0 };
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.hwndOwner = hwnd;
cc.hInstance = (HWND)g_hInst;
cc.rgbResult = GetWindowLongPtr(hwnd, 0);
cc.lpCustColors = custColours;
cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)) {
SetWindowLongPtr(hwnd, 0, cc.rgbResult);
SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), CPN_COLOURCHANGED), (LPARAM)hwnd);
InvalidateRect(hwnd, NULL, FALSE);
}
}
break;
case WM_ENABLE:
InvalidateRect(hwnd, NULL, FALSE);
break;
case WM_NCPAINT:
case WM_PAINT:
PAINTSTRUCT ps;
HDC hdc1 = BeginPaint(hwnd, &ps);
RECT rc;
GetClientRect(hwnd, &rc);
DrawEdge(hdc1, &rc, EDGE_ETCHED, BF_RECT);
InflateRect(&rc, -2, -2);
HBRUSH hBrush = (IsWindowEnabled(hwnd)) ? CreateSolidBrush(GetWindowLongPtr(hwnd, 0)) : CreateHatchBrush(HS_BDIAGONAL, GetSysColor(COLOR_GRAYTEXT));
SetBkColor(hdc1, GetSysColor(COLOR_BTNFACE));
FillRect(hdc1, &rc, hBrush);
DeleteObject(hBrush);
EndPaint(hwnd, &ps);
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:67,代码来源:colourpicker.cpp
示例8: dc
//
// CHistoryPane message handlers
//
void CHistoryPane::OnPaint()
{
CPaintDC dc(this);
CRect r;
CRgn rgn;
CPen pen;
uint w, i;
uint y, gap;
COLORREF colBack;
GetClientRect(&r);
colBack = GetSysColor(COLOR_3DLIGHT);
//
dc.FillSolidRect(0, 0, XBORDER, r.bottom, colBack);
dc.FillSolidRect(r.right-XBORDER, 0, XBORDER, r.bottom, colBack);
dc.FillSolidRect(XBORDER, 0, r.right-r.left-2*XBORDER, YBORDER, colBack);
dc.FillSolidRect(XBORDER, r.bottom-YBORDER, r.right-r.left-2*XBORDER, YBORDER, colBack);
dc.Draw3dRect(&r, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
//
r.DeflateRect(XBORDER, YBORDER);
rgn.CreateRectRgnIndirect(&r);
dc.SelectClipRgn(&rgn, RGN_COPY);
pen.CreatePen(PS_SOLID, 1, RGB(0xff,0x3f,0x00));
//dc.SetROP2(R2_XORPEN);
dc.SelectObject(&pen);
dc.SelectStockObject(NULL_BRUSH);
dc.SetStretchBltMode(HALFTONE);
//
w = m_uWidth;
y = YBORDER;
gap = 0;
for (i=m_uTopItem; i<m_vItems.size(); i++)
{
CItem & info = m_vItems[i];
CRect rTmp(0,0,0,0);
rTmp = CRect(XBORDER, y, XBORDER+m_uWidth, y+info.h0);
BitmapBlt(&dc, &rTmp, info.image0, 0);
if (info.sel0 != rTmp)
{
rTmp = info.sel0 + CSize(0,y);
dc.Rectangle(&rTmp);
}
dc.FillSolidRect(XBORDER, y+info.h0, m_uWidth, YSPACE, GetSysColor(COLOR_3DLIGHT));
//dc.Draw3dRect(XBORDER, y, w, info.h0, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
y += info.h0 + YSPACE;
if (y > r.bottom)
break;
}
if (y < r.bottom)
{
gap = r.bottom - y;
dc.FillSolidRect(XBORDER, y, m_uWidth, r.bottom-y, colBack);
}
if (m_bSendScroll ||
gap != m_uTrailingGap)
{
m_uTrailingGap = gap;
m_bSendScroll = false;
GetParent()->PostMessage(m_uMsgScroll);
}
}
开发者ID:apankrat,项目名称:yafe,代码行数:79,代码来源:HistoryPane.cpp
示例9: PaintWorker
//.........这里部分代码省略.........
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKTBBUTTONMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED);
//GetItemByStatus(ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKTBBUTTONSPRESSED : ID_EXTBKTBBUTTONSNPRESSED), &item);
else
item_id = ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : (ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED);
item = &StatusItems[item_id - ID_STATUS_OFFLINE];
//GetItemByStatus(ctl->stateId == PBS_PRESSED ? ID_EXTBKBUTTONSPRESSED : ID_EXTBKBUTTONSNPRESSED, &item);
SetTextColor(hdcMem, item->TEXTCOLOR);
if(item->IGNORED) {
if(pt.y < 10 || cfg::dat.bWallpaperMode)
//SkinDrawBg(ctl->hwnd, hdcMem);
BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
else
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
}
else {
if(pt.y < 10 || cfg::dat.bWallpaperMode)
//SkinDrawBg(ctl->hwnd, hdcMem);
BitBlt(hdcMem, 0, 0, rc.right, rc.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
else
FillRect(hdcMem, &rc, GetSysColorBrush(COLOR_3DFACE));
rc.top += item->MARGIN_TOP; rc.bottom -= item->MARGIN_BOTTOM;
rc.left += item->MARGIN_LEFT; rc.right -= item->MARGIN_RIGHT;
DrawAlpha(hdcMem, &rc, item->COLOR, item->ALPHA, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT,
item->CORNER, item->BORDERSTYLE, item->imageItem);
}
}
else {
if (ctl->stateId == PBS_PRESSED || ctl->stateId == PBS_HOT)
hbr = GetSysColorBrush(COLOR_3DFACE);
else {
HDC dc;
HWND hwndParent;
hwndParent = GetParent(ctl->hwnd);
dc = GetDC(hwndParent);
hbr = (HBRUSH) SendMessage(hwndParent, WM_CTLCOLORDLG, (WPARAM) dc, (LPARAM) hwndParent);
ReleaseDC(hwndParent, dc);
}
if (hbr) {
FillRect(hdcMem, &rc, hbr);
DeleteObject(hbr);
}
}
if(!ctl->bSkinned && ctl->buttonItem == 0) {
if (ctl->stateId == PBS_HOT || ctl->focus) {
if (ctl->pbState)
DrawEdge(hdcMem, &rc, EDGE_ETCHED, BF_RECT | BF_SOFT);
else
DrawEdge(hdcMem, &rc, BDR_RAISEDOUTER, BF_RECT | BF_SOFT);
} else if (ctl->stateId == PBS_PRESSED)
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT | BF_SOFT);
}
}
} else {
// Draw background/border
if (ctl->hThemeButton && ctl->bThemed) {
int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
POINT pt;
RECT rcParent;
GetWindowRect(ctl->hwnd, &rcParent);
pt.x = rcParent.left;
pt.y = rcParent.top;
ScreenToClient(pcli->hwndContactList, &pt);
BitBlt(hdcMem, 0, 0, rcClient.right, rcClient.bottom, cfg::dat.hdcBg, pt.x, pt.y, SRCCOPY);
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:66,代码来源:CLCButton.cpp
示例10: ServicesPageWndProc
//.........这里部分代码省略.........
ListView_Sort(hServicesListCtrl, 0);
Update_Btn_States(hDlg);
// Select the first item.
ListView_SetItemState(hServicesListCtrl, 0, LVIS_SELECTED, LVIS_SELECTED);
return TRUE;
}
case WM_DESTROY:
{
ClearServicesList();
userModificationsList.RemoveAll();
return 0;
}
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDC_BTN_SERVICES_ACTIVATE:
{
BOOL bAreThereModifs = FALSE;
int index = -1; // From the beginning.
while ((index = ListView_GetNextItem(hServicesListCtrl, index, LVNI_ALL)) != -1)
{
bAreThereModifs = ValidateItem(index, TRUE, FALSE) || bAreThereModifs; // The order is verrrrrry important !!!!
}
if (bAreThereModifs)
{
Update_Btn_States(hDlg);
PropSheet_Changed(GetParent(hServicesPage), hServicesPage);
}
return TRUE;
}
case IDC_BTN_SERVICES_DEACTIVATE:
{
BOOL bAreThereModifs = FALSE;
int index = -1; // From the beginning.
while ((index = ListView_GetNextItem(hServicesListCtrl, index, LVNI_ALL)) != -1)
{
bAreThereModifs = ValidateItem(index, FALSE, FALSE) || bAreThereModifs; // The order is verrrrrry important !!!!
}
if (bAreThereModifs)
{
Update_Btn_States(hDlg);
PropSheet_Changed(GetParent(hServicesPage), hServicesPage);
}
return TRUE;
}
case IDC_CBX_SERVICES_MASK_PROPRIETARY_SVCS:
{
bMaskProprietarySvcs = !bMaskProprietarySvcs;
GetServices(bMaskProprietarySvcs);
Update_Btn_States(hDlg);
return TRUE;
}
开发者ID:GYGit,项目名称:reactos,代码行数:67,代码来源:srvpage.cpp
示例11: switch
bool KX_RaySensor::Evaluate()
{
bool result = false;
bool reset = m_reset && m_level;
m_rayHit = false;
m_hitObject = NULL;
m_hitPosition[0] = 0;
m_hitPosition[1] = 0;
m_hitPosition[2] = 0;
m_hitNormal[0] = 1;
m_hitNormal[1] = 0;
m_hitNormal[2] = 0;
KX_GameObject* obj = (KX_GameObject*)GetParent();
MT_Point3 frompoint = obj->NodeGetWorldPosition();
MT_Matrix3x3 matje = obj->NodeGetWorldOrientation();
MT_Matrix3x3 invmat = matje.inverse();
MT_Vector3 todir;
m_reset = false;
switch (m_axis)
{
case SENS_RAY_X_AXIS: // X
{
todir[0] = invmat[0][0];
todir[1] = invmat[0][1];
todir[2] = invmat[0][2];
break;
}
case SENS_RAY_Y_AXIS: // Y
{
todir[0] = invmat[1][0];
todir[1] = invmat[1][1];
todir[2] = invmat[1][2];
break;
}
case SENS_RAY_Z_AXIS: // Z
{
todir[0] = invmat[2][0];
todir[1] = invmat[2][1];
todir[2] = invmat[2][2];
break;
}
case SENS_RAY_NEG_X_AXIS: // -X
{
todir[0] = -invmat[0][0];
todir[1] = -invmat[0][1];
todir[2] = -invmat[0][2];
break;
}
case SENS_RAY_NEG_Y_AXIS: // -Y
{
todir[0] = -invmat[1][0];
todir[1] = -invmat[1][1];
todir[2] = -invmat[1][2];
break;
}
case SENS_RAY_NEG_Z_AXIS: // -Z
{
todir[0] = -invmat[2][0];
todir[1] = -invmat[2][1];
todir[2] = -invmat[2][2];
break;
}
}
todir.normalize();
m_rayDirection[0] = todir[0];
m_rayDirection[1] = todir[1];
m_rayDirection[2] = todir[2];
MT_Point3 topoint = frompoint + (m_distance) * todir;
PHY_IPhysicsEnvironment* pe = m_scene->GetPhysicsEnvironment();
if (!pe)
{
std::cout << "WARNING: Ray sensor " << GetName() << ": There is no physics environment!" << std::endl;
std::cout << " Check universe for malfunction." << std::endl;
return false;
}
PHY_IPhysicsController *spc = obj->GetPhysicsController();
KX_GameObject *parent = obj->GetParent();
if (!spc && parent)
spc = parent->GetPhysicsController();
if (parent)
parent->Release();
PHY_IPhysicsEnvironment* physics_environment = this->m_scene->GetPhysicsEnvironment();
KX_RayCast::Callback<KX_RaySensor> callback(this, spc);
KX_RayCast::RayTest(physics_environment, frompoint, topoint, callback);
/* now pass this result to some controller */
if (m_rayHit)
{
//.........这里部分代码省略.........
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:101,代码来源:KX_RaySensor.cpp
示例12: EtpWsWatchDlgProc
INT_PTR CALLBACK EtpWsWatchDlgProc(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
PWS_WATCH_CONTEXT context;
if (uMsg == WM_INITDIALOG)
{
context = (PWS_WATCH_CONTEXT)lParam;
SetProp(hwndDlg, L"Context", (HANDLE)context);
}
else
{
context = (PWS_WATCH_CONTEXT)GetProp(hwndDlg, L"Context");
if (uMsg == WM_DESTROY)
RemoveProp(hwndDlg, L"Context");
}
if (!context)
return FALSE;
switch (uMsg)
{
case WM_INITDIALOG:
{
HWND lvHandle;
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
context->WindowHandle = hwndDlg;
context->ListViewHandle = lvHandle = GetDlgItem(hwndDlg, IDC_LIST);
PhSetListViewStyle(lvHandle, FALSE, TRUE);
PhSetControlTheme(lvHandle, L"explorer");
PhAddListViewColumn(lvHandle, 0, 0, 0, LVCFMT_LEFT, 340, L"Instruction");
PhAddListViewColumn(lvHandle, 1, 1, 1, LVCFMT_LEFT, 80, L"Count");
PhSetExtendedListView(lvHandle);
ExtendedListView_SetSort(lvHandle, 1, DescendingSortOrder);
context->Hashtable = PhCreateSimpleHashtable(64);
context->BufferSize = 0x2000;
context->Buffer = PhAllocate(context->BufferSize);
PhInitializeQueuedLock(&context->ResultListLock);
context->SymbolProvider = PhCreateSymbolProvider(context->ProcessItem->ProcessId);
PhLoadSymbolProviderOptions(context->SymbolProvider);
if (!context->SymbolProvider || !context->SymbolProvider->IsRealHandle)
{
PhShowError(hwndDlg, L"Unable to open the process.");
EndDialog(hwndDlg, IDCANCEL);
break;
}
context->ProcessHandle = context->SymbolProvider->ProcessHandle;
// Load symbols for both process and kernel modules.
context->LoadingSymbolsForProcessId = context->ProcessItem->ProcessId;
PhEnumGenericModules(
NULL,
context->ProcessHandle,
0,
EnumGenericModulesCallback,
context
);
context->LoadingSymbolsForProcessId = SYSTEM_PROCESS_ID;
PhEnumGenericModules(
SYSTEM_PROCESS_ID,
NULL,
0,
EnumGenericModulesCallback,
context
);
context->Enabled = EtpUpdateWsWatch(hwndDlg, context);
if (context->Enabled)
{
// WS Watch is already enabled for the process. Enable updating.
EnableWindow(GetDlgItem(hwndDlg, IDC_ENABLE), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_WSWATCHENABLED), SW_SHOW);
SetTimer(hwndDlg, 1, 1000, NULL);
}
else
{
// WS Watch has not yet been enabled for the process.
}
}
break;
case WM_DESTROY:
{
context->Destroying = TRUE;
PhDereferenceObject(context->Hashtable);
if (context->Buffer)
//.........这里部分代码省略.........
开发者ID:blaquee,项目名称:processhacker2,代码行数:101,代码来源:wswatch.c
示例13: ButOrderOpts
static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);
OrderData *dat = (OrderData*)GetWindowLongPtr(hTree, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
dat = (OrderData*)malloc( sizeof(OrderData));
SetWindowLongPtr(hTree, GWLP_USERDATA, (LONG_PTR)dat);
dat->dragging = 0;
SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE)|TVS_NOHSCROLL);
SetDlgItemInt(hwndDlg, IDC_BUTTHEIGHT, g_ctrl->nButtonHeight, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_HEIGHT, UDM_SETRANGE, 0, MAKELONG(50,10));
SendDlgItemMessage(hwndDlg, IDC_SPIN_HEIGHT, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonHeight,0));
SetDlgItemInt(hwndDlg, IDC_BUTTWIDTH, g_ctrl->nButtonWidth, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, MAKELONG(50,10));
SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonWidth,0));
SetDlgItemInt(hwndDlg, IDC_BUTTGAP, g_ctrl->nButtonSpace, FALSE);
SendDlgItemMessage(hwndDlg, IDC_SPIN_GAP, UDM_SETRANGE, 0, MAKELONG(20,0));
SendDlgItemMessage(hwndDlg, IDC_SPIN_GAP, UDM_SETPOS, 0, MAKELONG(g_ctrl->nButtonSpace,0));
CheckDlgButton(hwndDlg, IDC_USEFLAT, g_ctrl->bFlatButtons);
CheckDlgButton(hwndDlg, IDC_AUTORESIZE, g_ctrl->bAutoSize);
CheckDlgButton(hwndDlg, IDC_SINGLELINE, g_ctrl->bSingleLine);
BuildTree(hwndDlg);
EnableWindow(GetDlgItem(hwndDlg, IDC_ENAME), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELLBUTTON), FALSE);
OptionshWnd = hwndDlg;
return TRUE;
case WM_COMMAND:
if (HIWORD(wParam) == EN_CHANGE && OptionshWnd) {
switch(LOWORD(wParam)) {
case IDC_ENAME: case IDC_EPATH:
break;
default:
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
}
if ((HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DBLCLK)) {
int ctrlid = LOWORD(wParam);
//----- Launch buttons -----
if (ctrlid == IDC_BROWSE) {
TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
GetDlgItemText(hwndDlg, IDC_EPATH, str, sizeof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
ofn.nMaxFile = sizeof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("exe");
if (!GetOpenFileName(&ofn))
break;
SetDlgItemText(hwndDlg, IDC_EPATH, str);
break;
}
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
if (ctrlid == IDC_LBUTTONSET) {
TVITEM tvi ={0};
tvi.hItem = TreeView_GetSelection(hTree);
if (tvi.hItem == NULL)
break;
tvi.mask = TVIF_PARAM;
TreeView_GetItem(hTree, &tvi);
TopButtonInt* btn = (TopButtonInt*)tvi.lParam;
TCHAR buf [256];
// probably, condition not needs
if (btn->dwFlags & TTBBF_ISLBUTTON) {
if (!(btn->dwFlags & TTBBF_OPTIONAL)) {
// create button
TTBButton ttb = { 0 };
ttb.cbSize = sizeof(ttb);
ttb.hIconDn = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_RUN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_ISLBUTTON | TTBBF_INTERNAL | TTBBF_OPTIONAL;
ttb.name = NULL;
ttb.program = NULL;
int id = btn->id;
//.........这里部分代码省略.........
开发者ID:0xmono,项目名称:miranda-ng,代码行数:101,代码来源:ttbopt.cpp
示例14: InitTrayNotify
/*--------------------------------------------------
initialize
----------------------------------------------------*/
void InitTrayNotify(HWND hwndClock)
{
HWND hwnd, hwnd2;
char classname[80];
EndTrayNotify();
bFillTray = GetMyRegLong(NULL, "FillTray", FALSE);
bFlatTray = GetMyRegLong(NULL, "FlatTray", TRUE);
bSkinTray = GetMyRegLong(NULL, "SkinTray", FALSE);
// if(bSkinTray) bFillTray = FALSE; // ちょっと強引に設定の矛盾をなくす
if(!bFillTray && !bFlatTray && !bSkinTray) return ;
// get window handle of TrayNotifyWnd
hwndTrayNotify = GetParent(hwndClock); // TrayNotifyWnd
// search toolbar
if(bFillTray)
{
hwndToolbar = NULL;
hwnd = GetWindow(hwndTrayNotify, GW_CHILD);
while(hwnd)
{
GetClassName(hwnd, classname, 80);
if(lstrcmpi(classname, "ToolbarWindow32") == 0)
{
hwndToolbar = hwnd;
break;
}else if(lstrcmpi(classname, "SysPager") == 0)
{
hwnd2 = GetWindow(hwnd, GW_CHILD);
while(hwnd2)
{
GetClassName(hwnd2, classname, 80);
if(lstrcmpi(classname, "ToolbarWindow32") == 0)
{
hwndToolbar = hwnd2;
break;
}
}
hwnd2 = GetWindow(hwnd2, GW_HWNDNEXT);
}
hwnd = GetWindow(hwnd, GW_HWNDNEXT);
}
if(hwndToolbar == NULL)
{
bFillTray = FALSE;
}
}
if(bFillTray)
{
s_hwndClock = hwndClock;
oldClassStyleTrayNotify = GetClassLongPtr(hwndTrayNotify, GCL_STYLE);
SetClassLongPtr(hwndTrayNotify, GCL_STYLE,
oldClassStyleTrayNotify|CS_HREDRAW|CS_VREDRAW);
oldWndProcTrayNotify =
(WNDPROC)GetWindowLongPtr(hwndTrayNotify, GWLP_WNDPROC);
SubclassWindow(hwndTrayNotify, WndProcTrayNotify);
oldStyleTrayNotify = GetWindowLongPtr(hwndTrayNotify, GWL_STYLE);
SetWindowLongPtr(hwndTrayNotify, GWL_STYLE,
oldStyleTrayNotify & ~(WS_CLIPCHILDREN|WS_CLIPSIBLINGS));
}
if(bFlatTray)
{
oldExStyleTrayNotify = GetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE);
SetWindowLongPtr(hwndTrayNotify, GWL_EXSTYLE,
oldExStyleTrayNotify & ~WS_EX_STATICEDGE);
SetWindowPos(hwndTrayNotify, NULL, 0, 0, 0, 0,
SWP_DRAWFRAME|SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER);
}
if(bFillTray || bFlatTray)
InvalidateRect(hwndTrayNotify, NULL, TRUE);
// if(bFillTray)
// SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0);
if(bFillTray)
{
if(!bWinXP)
SendMessage(hwndToolbar, WM_SYSCOLORCHANGE, 0, 0);
else
SendMessage(GetParent(hwndToolbar), WM_SYSCOLORCHANGE, 0, 0);
}
#ifdef TEST_505
{
RECT rc;
LONG style;
style = GetWindowLongPtr(hwndTrayNotify, GWL_STYLE);
style |= WS_POPUPWINDOW | WS_CAPTION;
//.........这里部分代码省略.........
开发者ID:h16o2u9u,项目名称:rtoss,代码行数:101,代码来源:traynotify.c
示例15: switch
bool TrackBar::OnEventMouse(Event event,WPARAM wparam,LPARAM lparam)
{
if(!GetVisible() || !GetEnabled())
return false;
switch(event)
{
case EventLeftButtonDown:
if(PointInTrack(*(Point*)wparam))
{
if(!GetFocused())
Focus();
mTracking = true;
mTrackingValue = mValue;
mTrackingPosition = ((Point*)wparam)->x - GetTrackBox().GetCenter().x;
SetCapture(GetKernel()->GetWindowHandle());
return true;
}
if(PointIn(*(Point*)wparam))
{
if(!GetFocused())
Focus();
if(((Point*)wparam)->x > GetTrackBox().GetCenter().x)
{
if(GetTrackValue() < GetTrackRange())
SetTrackValue(GetTrackValue() + 1);
}
else
{
if(GetTrackValue())
SetTrackValue(GetTrackValue() - 1);
}
return true;
}
break;
case EventLeftButtonUp:
if(mTracking)
{
mTracking = false;
ReleaseCapture();
return true;
}
break;
case EventMouseMove:
if(mTracking)
{
Point delta = *(Point*)wparam;
delta.x -= GetScreenPosition().x + mTrackingPosition;
float val = (float)GetBoundingBox().GetWidth() / (float)GetTrackRange();
if((float)delta.x / val > (float)GetTrackRange())
SetTrackValue(GetTrackRange());
else if((float)delta.x / val < 0.0f)
SetTrackValue(0);
else
SetTrackValue((float)delta.x / val);
if(GetParent())
GetParent()->OnEvent(EventChildCommand,ControlEventTrackChange,(LPARAM)this);
}
break;
}
return Control::OnEventMouse(event,wparam,lparam);
}
开发者ID:m1h4,项目名称:AudioAnalyzer,代码行数:79,代码来源:TrackBar.cpp
示例16: TSButtonWndProc
static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
MButtonCtrl *bct = (MButtonCtrl *) GetWindowLongPtr(hwndDlg, 0);
switch (msg) {
case WM_NCCREATE:
{
SetWindowLong(hwndDlg, GWL_STYLE, GetWindowLong(hwndDlg, GWL_STYLE) | BS_OWNERDRAW);
bct = reinterpret_cast<MButtonCtrl *>(malloc(sizeof(MButtonCtrl)));
if (bct == NULL)
return FALSE;
bct->hwnd = hwndDlg;
bct->stateId = PBS_NORMAL;
bct->focus = 0;
bct->hFont = reinterpret_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT));
bct->arrow = NULL;
bct->defbutton = 0;
bct->hIcon = bct->hIconPrivate = 0;
bct->iIcon = 0;
bct->hIml = 0;
bct->hBitmap = NULL;
bct->pushBtn = 0;
bct->pbState = 0;
bct->hThemeButton = NULL;
bct->hThemeToolbar = NULL;
bct->cHot = 0;
bct->flatBtn = 0;
bct->bThemed = FALSE;
bct->bSkinned = bct->bSendOnDown = 0;
bct->buttonItem = NULL;
LoadTheme(bct);
SetWindowLongPtr(hwndDlg, 0, (LONG_PTR) bct);
if (((CREATESTRUCTA *) lParam)->lpszName)
SetWindowText(hwndDlg, ((CREATESTRUCT *) lParam)->lpszName);
return TRUE;
}
case WM_DESTROY:
{
if (bct) {
if (hwndToolTips) {
TOOLINFO ti;
ZeroMemory(&ti, sizeof(ti));
ti.cbSize = sizeof(ti);
ti.uFlags = TTF_IDISHWND;
ti.hwnd = bct->hwnd;
ti.uId = (UINT_PTR) bct->hwnd;
if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM) &ti)) {
SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM) &ti);
}
if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM) &ti) == 0) {
DestroyWindow(hwndToolTips);
hwndToolTips = NULL;
}
}
if (bct->hIconPrivate)
DestroyIcon(bct->hIconPrivate);
DestroyTheme(bct);
free(bct);
}
SetWindowLongPtr(hwndDlg, 0, 0);
break; // DONT! fall thru
}
case WM_SETTEXT:
{
bct->cHot = 0;
if ((char*) lParam) {
char *tmp = (char *) lParam;
while (*tmp) {
if (*tmp == '&' && *(tmp + 1)) {
bct->cHot = tolower(*(tmp + 1));
break;
}
tmp++;
}
InvalidateRect(bct->hwnd, NULL, TRUE);
lstrcpyn(bct->szText, (TCHAR *)lParam, 127);
bct->szText[127] = 0;
}
break;
}
case WM_SYSKEYUP:
if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) {
if (bct->pushBtn) {
if (bct->pbState)
bct->pbState = 0;
else
bct->pbState = 1;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
if(!bct->bSendOnDown)
SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg);
return 0;
}
break;
case WM_THEMECHANGED:
{
if (bct->bThemed)
LoadTheme(bct);
InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
break;
//.........这里部分代码省略.........
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:101,代码来源:CLCButton.cpp
示例17: paint_world
void sim_area_widget::paint_world(wxPaintEvent&)
{
const model& app_model =
(dynamic_cast<biosim_gui_impl&>(*GetParent())).app_model();
const world_map& map =
app_model.map();
wxBufferedPaintDC dc(this);
dc.SetBackground(wxBrush(wxColor(0,0,0)));
dc.Clear();
wxSize client_size(GetClientSize());
int scroll_pixel_x = scroll_x_ % tile_size_x;
int scroll_pixel_y = scroll_y_ % tile_size_y;
int tile_x_start = (scroll_x_ - scroll_pixel_x) / tile_size_x;
int tile_y_start = (scroll_y_ - scroll_pixel_y) / tile_size_y;
int tile_x_end = (scroll_x_ + client_size.GetX() - scroll_pixel_x) / tile_size_x + 1;
int tile_y_end = (scroll_y_ + client_size.GetY() - scroll_pixel_y) / tile_size_y + 1;
for (int y = tile_y_start; y <= tile_y_end; ++y)
for (int x = tile_x_start; x <= tile_x_end; ++x)
{
if (x < 0 || y < 0 || x >= map.size_x() || y >= map.size_y())
continue;
int tilepos_x = (x - tile_x_start) * tile_size_x - scroll_pixel_x;
int tilepos_y = (y - tile_y_start) * tile_size_y - scroll_pixel_y;
dc.DrawBitmap(env_bitmaps_[map.at(x, y).climate()],
tilepos_x, tilepos_y);
if (x == app_model.cursor_x() &&
y == app_model.cursor_y())
{
dc.DrawBitmap(cursor_bitmap_, tilepos_x, tilepos_y);
}
const world_tile& tile = map.at(x, y);
for (world_tile::creature_iterator it(tile.begin()); it != tile.end(); ++it)
{
if((*it)->is_alive())
{
const creature_prototype *prototype = &((*it)->prototype);
std::map<const creature_prototype*, wxBitmap>::iterator find_graphics
(creature_bitmaps_.find(prototype));
if (find_graphics == creature_bitmaps_.end())
{
find_graphics =
creature_bitmaps_.insert
(std::pair<const creature_prototype*, wxBitmap>
(prototype, convert_to_bitmap(prototype->graphics()))).first;
}
dc.DrawBitmap(find_graphics->second, tilepos_x, tilepos_y);
}
else
dc.DrawBitmap(dead_bitmap_, tilepos_x, tilepos_y);
}
}
}
开发者ID:rollingthunder,项目名称:ki2-biosim,代码行数:67,代码来源:sim_area_widget.cpp
示例18: ContactListControlWndProc
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
//.........这里部分代码省略.........
开发者ID:biddyweb,项目名称:miranda-ng,代码行数:101,代码来源:clc.cpp
示例19: TrackingUIProc
INT_PTR CALLBACK TrackingUIProc(HWND hwndTrk, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
g_hWndTrack = hwndTrk;
LVCOLUMN column;
column.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;
column.cx = 50;
column.iSubItem = 0;
column.pszText = L"ID";
ListView_InsertColumn(GetControl(IDC_MODELS), 0, &column);
column.cx = 400;
column.iSubItem = 1;
column.pszText = L"File";
ListView_InsertColumn(GetControl(IDC_MODELS), 1, &column);
HIMAGELIST imgList = ImageList_Create(16, 16, 0
|
请发表评论