• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ChkErr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ChkErr函数的典型用法代码示例。如果您正苦于以下问题:C++ ChkErr函数的具体用法?C++ ChkErr怎么用?C++ ChkErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ChkErr函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MenuEventHandlerProc

static OSStatus
MenuEventHandlerProc(
    EventHandlerCallRef callRef,
    EventRef event,
    void *userData)
{
    OSStatus result = eventNotHandledErr, err;
    int menuContext;

    err = ChkErr(GetEventParameter, event, kEventParamMenuContext, typeUInt32,
	    NULL, sizeof(menuContext), NULL, &menuContext);
    if (err == noErr && (menuContext & kMenuContextMenuBarTracking)) {
	if (gInterp) {
	    Tcl_Obj *path = GetWidgetDemoPath(gInterp);

	    if (path) {
		Tcl_IncrRefCount(path);
		if (Tcl_FSAccess(path, R_OK) == 0) {
		    EnableMenuItem(tkFileMenu, kDemoItem);
		}
		Tcl_DecrRefCount(path);
	    }
	}
	ChkErr(RemoveEventHandler, menuEventHandlerRef);
	menuEventHandlerRef = NULL;
	result = noErr;
    }

    return result;
}
开发者ID:das,项目名称:tcltk,代码行数:30,代码来源:tkMacOSXMenus.c


示例2: InstallStandardApplicationEventHandler

static OSStatus
InstallStandardApplicationEventHandler(void)
{
    OSStatus err = memFullErr;

    TK_IF_HI_TOOLBOX(5,
       /*
	* The approach below does not work correctly in Leopard, it leads to
	* crashes in [NSView unlockFocus] whenever HIToolbox uses Cocoa (Help
	* menu, Nav Services, Color Picker). While it is now possible to
	* install the standard app handler with InstallStandardEventHandler(),
	* to fully replicate RAEL the standard menubar event handler also needs
	* to be installed. Unfortunately there appears to be no public API to
	* obtain the menubar event target. As a workaround, for now we resort
	* to calling the HIToolbox-internal GetMenuBarEventTarget() directly
	* (symbol acquired via TkMacOSXInitNamedSymbol() from HIToolbox
	* version 343, may not exist in later versions).
	*/
	err = ChkErr(InstallStandardEventHandler, GetApplicationEventTarget());
	TkMacOSXInitNamedSymbol(HIToolbox, EventTargetRef,
		GetMenuBarEventTarget, void);
	if (GetMenuBarEventTarget) {
	    ChkErr(InstallStandardEventHandler, GetMenuBarEventTarget());
	} else {
	    TkMacOSXDbgMsg("Unable to install standard menubar event handler");
	}
    ) TK_ELSE_HI_TOOLBOX (5,
开发者ID:aosm,项目名称:tcl,代码行数:27,代码来源:tkMacOSXCarbonEvents.c


示例3: DisclosureElementSize

static void DisclosureElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    SInt32 s;

    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);
    *widthPtr = s;
    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);
    *heightPtr = s;
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:11,代码来源:ttkMacOSXTheme.c


示例4: SpinButtonElementSize

static void SpinButtonElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    SInt32 s;

    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);
    *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);
    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);
    *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:11,代码来源:ttkMacOSXTheme.c


示例5: Tk_MacOSXIsAppInFront

int
Tk_MacOSXIsAppInFront(void)
{
    OSStatus err;
    ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess};
    Boolean isFrontProcess = true;

    err = ChkErr(GetFrontProcess, &frontPsn);
    if (err == noErr) {
	ChkErr(SameProcess, &frontPsn, &ourPsn, &isFrontProcess);
    }

    return (isFrontProcess == true);
}
开发者ID:culler,项目名称:tk,代码行数:14,代码来源:tkMacOSXWindowEvent.c


示例6: TreeHeaderElementDraw

static void TreeHeaderElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    ThemeButtonParams *params = clientData;
    CGRect bounds = BoxToRect(d, b);
    const HIThemeButtonDrawInfo info = {
        .version = 0,
        .state = Ttk_StateTableLookup(ThemeStateTable, state),
        .kind = params->kind,
        .value = Ttk_StateTableLookup(TreeHeaderValueTable, state),
        .adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state),
    };

    BEGIN_DRAWING(d)
    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
    END_DRAWING
}

static Ttk_ElementSpec TreeHeaderElementSpec = {
    TK_STYLE_VERSION_2,
    sizeof(NullElement),
    TtkNullElementOptions,
    ButtonElementSizeNoPadding,
    TreeHeaderElementDraw
};

/*
 * Disclosure triangle:
 */
#define TTK_TREEVIEW_STATE_OPEN 	TTK_STATE_USER1
#define TTK_TREEVIEW_STATE_LEAF 	TTK_STATE_USER2
static Ttk_StateTable DisclosureValueTable[] = {
    { kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0 },
    { kThemeDisclosureRight, 0, 0 },
};

static void DisclosureElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    SInt32 s;

    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s);
    *widthPtr = s;
    ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s);
    *heightPtr = s;
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:48,代码来源:ttkMacOSXTheme.c


示例7: TkMacOSXSetWithNativeRegion

void
TkMacOSXSetWithNativeRegion(
    TkRegion r,
    HIShapeRef rgn)
{
    ChkErr(TkMacOSXHIShapeSetWithShape, (HIMutableShapeRef) r, rgn);
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:7,代码来源:tkMacOSXRegion.c


示例8: ButtonElementSize

static void ButtonElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    ThemeButtonParams *params = clientData;
    const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, 0);
    static const CGRect scratchBounds = {{0, 0}, {100, 100}};
    CGRect contentBounds;

    ButtonElementSizeNoPadding(
        clientData, elementRecord, tkwin,
        widthPtr, heightPtr, paddingPtr);

    /*
     * To compute internal padding, query the appearance manager
     * for the content bounds of a dummy rectangle, then use
     * the difference as the padding.
     */
    ChkErr(HIThemeGetButtonContentBounds,
           &scratchBounds, &info, &contentBounds);

    paddingPtr->left = CGRectGetMinX(contentBounds);
    paddingPtr->top = CGRectGetMinY(contentBounds);
    paddingPtr->right = CGRectGetMaxX(scratchBounds) - CGRectGetMaxX(contentBounds) + 1;
    paddingPtr->bottom = CGRectGetMaxY(scratchBounds) - CGRectGetMaxY(contentBounds);

    /*
     * Now add a little extra padding to account for drop shadows.
     * @@@ SHOULD: call GetThemeButtonBackgroundBounds() instead.
     */

    *paddingPtr = Ttk_AddPadding(*paddingPtr, ButtonMargins);
    *widthPtr += Ttk_PaddingWidth(ButtonMargins);
    *heightPtr += Ttk_PaddingHeight(ButtonMargins);
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:35,代码来源:ttkMacOSXTheme.c


示例9: computeButtonDrawInfo

/*
 * computeButtonDrawInfo --
 *	Fill in an appearance manager HIThemeButtonDrawInfo record.
 */
static inline HIThemeButtonDrawInfo computeButtonDrawInfo(
    ThemeButtonParams *params, Ttk_State state)
{
    const HIThemeButtonDrawInfo info = {
        .version = 0,
        .state = Ttk_StateTableLookup(ThemeStateTable, state),
        .kind = params ? params->kind : 0,
        .value = Ttk_StateTableLookup(ButtonValueTable, state),
        .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state),
    };
    return info;
}

static void ButtonElementSizeNoPadding(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    ThemeButtonParams *params = clientData;

    if (params->heightMetric != NoThemeMetric) {
        SInt32 height;

        ChkErr(GetThemeMetric, params->heightMetric, &height);
        *heightPtr = height;
    }
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:30,代码来源:ttkMacOSXTheme.c


示例10: ComboboxElementDraw

static void ComboboxElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    CGRect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins));
    const HIThemeButtonDrawInfo info = {
        .version = 0,
        .state = Ttk_StateTableLookup(ThemeStateTable, state),
        .kind = kThemeComboBox,
        .value = Ttk_StateTableLookup(ButtonValueTable, state),
        .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state),
    };

    BEGIN_DRAWING(d)
    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
    END_DRAWING
}

static Ttk_ElementSpec ComboboxElementSpec = {
    TK_STYLE_VERSION_2,
    sizeof(NullElement),
    TtkNullElementOptions,
    ComboboxElementSize,
    ComboboxElementDraw
};

/*----------------------------------------------------------------------
 * +++ Spinbuttons.
 *
 * From Apple HIG, part III, section "Controls", "The Stepper Control":
 * there should be 2 pixels of space between the stepper control
 * (AKA IncDecButton, AKA "little arrows") and the text field it modifies.
 */

static Ttk_Padding SpinbuttonMargins = {2,0,2,0};
static void SpinButtonElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    SInt32 s;

    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s);
    *widthPtr = s + Ttk_PaddingWidth(SpinbuttonMargins);
    ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s);
    *heightPtr = s + Ttk_PaddingHeight(SpinbuttonMargins);
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:46,代码来源:ttkMacOSXTheme.c


示例11: TkMacOSXOffsetRegion

void
TkMacOSXOffsetRegion(
    TkRegion r,
    short dx,
    short dy)
{
    ChkErr(HIShapeOffset, (HIMutableShapeRef) r, dx, dy);
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:8,代码来源:tkMacOSXRegion.c


示例12: EntryElementDraw

static void EntryElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    EntryElement *e = elementRecord;
    Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj);
    Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3));
    CGRect bounds = BoxToRect(d, inner);
    const HIThemeFrameDrawInfo info = {
        .version = 0,
        .kind = kHIThemeFrameTextFieldSquare,
        .state = Ttk_StateTableLookup(ThemeStateTable, state),
        .isFocused = state & TTK_STATE_FOCUS,
    };

    /*
     * Erase w/background color:
     */
    XFillRectangle(Tk_Display(tkwin), d,
                   Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC),
                   inner.x,inner.y, inner.width, inner.height);

    BEGIN_DRAWING(d)
    ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation);
    /*if (state & TTK_STATE_FOCUS) {
    ChkErr(DrawThemeFocusRect, &bounds, 1);
    }*/
    END_DRAWING
}

static Ttk_ElementSpec EntryElementSpec = {
    TK_STYLE_VERSION_2,
    sizeof(EntryElement),
    EntryElementOptions,
    EntryElementSize,
    EntryElementDraw
};

/*----------------------------------------------------------------------
 * +++ Combobox:
 *
 * NOTES:
 *	kThemeMetricComboBoxLargeDisclosureWidth -> 17
 *	Padding and margins guesstimated by trial-and-error.
 */

static Ttk_Padding ComboboxPadding = { 2, 3, 17, 1 };
static Ttk_Padding ComboboxMargins = { 3, 3, 4, 4 };

static void ComboboxElementSize(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
    *widthPtr = 0;
    *heightPtr = 0;
    *paddingPtr = Ttk_AddPadding(ComboboxMargins, ComboboxPadding);
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:57,代码来源:ttkMacOSXTheme.c


示例13: TkSubtractRegion

void
TkSubtractRegion(
    TkRegion sra,
    TkRegion srb,
    TkRegion dr_return)
{
    ChkErr(HIShapeDifference, (HIShapeRef) sra, (HIShapeRef) srb,
	   (HIMutableShapeRef) dr_return);
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:9,代码来源:tkMacOSXRegion.c


示例14: TkIntersectRegion

void
TkIntersectRegion(
    TkRegion sra,
    TkRegion srb,
    TkRegion dr_return)
{
    ChkErr(HIShapeIntersect, (HIShapeRef) sra, (HIShapeRef) srb,
	   (HIMutableShapeRef) dr_return);
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:9,代码来源:tkMacOSXRegion.c


示例15: TkUnionRectWithRegion

void
TkUnionRectWithRegion(
    XRectangle* rectangle,
    TkRegion src_region,
    TkRegion dest_region_return)
{
    const CGRect r = CGRectMake(rectangle->x, rectangle->y,
	    rectangle->width, rectangle->height);

    if (src_region == dest_region_return) {
	ChkErr(TkMacOSHIShapeUnionWithRect,
		(HIMutableShapeRef) dest_region_return, &r);
    } else {
	HIShapeRef rectRgn = HIShapeCreateWithRect(&r);

	ChkErr(TkMacOSHIShapeUnion, rectRgn, (HIShapeRef) src_region,
		(HIMutableShapeRef) dest_region_return);
	CFRelease(rectRgn);
    }
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:20,代码来源:tkMacOSXRegion.c


示例16: ButtonElementDraw

static void ButtonElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    ThemeButtonParams *params = clientData;
    CGRect bounds = BoxToRect(d, Ttk_PadBox(b, ButtonMargins));
    const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, state);

    BEGIN_DRAWING(d)
    ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL);
    END_DRAWING
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:12,代码来源:ttkMacOSXTheme.c


示例17: ToolbarBackgroundElementDraw

/*----------------------------------------------------------------------
 * +++ ToolbarBackground element -- toolbar style for frames.
 *
 *	This is very similar to the normal background element, but uses a
 *	different ThemeBrush in order to get the lighter pinstripe effect
 *	used in toolbars. We use SetThemeBackground() rather than
 *	ApplyThemeBackground() in order to get the right style.
 *
 * <URL: http://developer.apple.com/documentation/Carbon/Reference/
 *	Appearance_Manager/appearance_manager/constant_7.html#/
 *	/apple_ref/doc/uid/TP30000243/C005321>
 *
 */
static void ToolbarBackgroundElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, Ttk_State state)
{
    ThemeBrush brush = kThemeBrushToolbarBackground;
    CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin));

    BEGIN_DRAWING(d)
    ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation);
    //QDSetPatternOrigin(PatternOrigin(tkwin, d));
    CGContextFillRect(dc.context, bounds);
    END_DRAWING
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:26,代码来源:ttkMacOSXTheme.c


示例18: doExport

int doExport()
{
	IOcadWriter *writer = OcadWriterFactory(10000, 10000, 10000);

	int color = writer->addcolor("one");
	ChkErr(writer->addareasymbol("areasymbol", 4100, color));
	ChkErr(writer->addareasymbol("areasymbol", 4010, color));
	vector<point> cords_to_export;
	cords_to_export.push_back(point(1000, 1000));
	cords_to_export.push_back(point(2000, 1000));
	cords_to_export.push_back(point(1000, 2000)); // coordinate is 100
	ChkErr(writer->exportArea(cords_to_export, 4100));
	vector<point> cords_to_export2;
	cords_to_export2.push_back(point(500, 1000));
	cords_to_export2.push_back(point(1500, 1000));
	cords_to_export2.push_back(point(500, 1500)); // coordinate is 100
	ChkErr(writer->exportArea(cords_to_export2, 4010));

	ChkErr(writer->writeFile("c:\\projekti\\write_ocad\\second.ocd"));
	delete writer;
	return 0;
}
开发者ID:ledusledus,项目名称:WriteODLL,代码行数:22,代码来源:WriteODLL.cpp



注:本文中的ChkErr函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ChooseColor函数代码示例发布时间:2022-05-30
下一篇:
C++ ChkComOutPtr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap