当前位置: 首页>>代码示例>>C++>>正文


C++ Tk_Display函数代码示例

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


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

示例1: SetOp

static int
SetOp(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv)
{
    Tk_Window tkwin = clientData;
    int buffer;
    char *string;
    int length;

    buffer = 0;
    if (objc == 4) {
	if (GetCutNumberFromObj(interp, objv[3], &buffer) != TCL_OK) {
	    return TCL_ERROR;
	}
    }
    string = Tcl_GetStringFromObj(objv[2],  &length);
    XStoreBuffer(Tk_Display(tkwin), string, length + 1, buffer);
    return TCL_OK;
}
开发者ID:Starlink,项目名称:blt,代码行数:18,代码来源:bltCutbuffer.c

示例2: getCurrent

bool shgPhases::altPress(int x, int y) {
   // returns true if a redraw is called for (in which case a scroll
   // is done as well as an XWarpPointer)
   if (!existsCurrent())
      return false;

   if (currInstalledAltMoveHandler) {
      if (ignoreNextShgAltMove) {
         ignoreNextShgAltMove = false;
         return false;
      }

      int deltax = x - shgAltAnchorX;
      int deltay = y - shgAltAnchorY;

      // add some extra speedup juice as an incentive to use alt-mousemove scrolling
      deltax *= 4;
      deltay *= 4;

      getCurrent().adjustHorizSBOffsetFromDeltaPix(deltax);
      getCurrent().adjustVertSBOffsetFromDeltaPix(deltay);

#if !defined(i386_unknown_nt4_0)
      XWarpPointer(Tk_Display(theTkWindow),
		   Tk_WindowId(theTkWindow),
		   Tk_WindowId(theTkWindow),
		   0, 0, 0, 0,
		   shgAltAnchorX, shgAltAnchorY);
#else // !defined(i386_unknown_nt4_0)
	// TODO - implement warping support
#endif // !defined(i386_unknown_nt4_0)

      ignoreNextShgAltMove = true;
         
      return true;
   }
   else {
      shgAltAnchorX = x;
      shgAltAnchorY = y;

      currInstalledAltMoveHandler = true;
      return false;
   }
}
开发者ID:dyninst,项目名称:paradyn,代码行数:44,代码来源:shgPhases.C

示例3: BorderElementDraw

static void BorderElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    BorderElement *border = elementRecord;
    RECT rc = BoxToRect(b);
    int relief = TK_RELIEF_FLAT;
    TkWinDCState dcState;
    HDC hdc;

    Tk_GetReliefFromObj(NULL, border->reliefObj, &relief);

    if (relief != TK_RELIEF_FLAT) {
	UINT xFlags = (relief == TK_RELIEF_SOLID) ? BF_FLAT : 0;
	hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState);
	DrawEdge(hdc, &rc, ReliefToEdge(relief), BF_RECT | xFlags);
	TkWinReleaseDrawableDC(d, hdc, &dcState);
    }
}
开发者ID:aosm,项目名称:tcl,代码行数:19,代码来源:ttkWinTheme.c

示例4: TkpShowBusyWindow

void
TkpShowBusyWindow(
    TkBusy busy)
{
    Busy *busyPtr = (Busy *) busy;

    if (busyPtr->tkBusy != NULL) {
	Tk_MapWindow(busyPtr->tkBusy);

	/*
	 * Always raise the busy window just in case new sibling windows have
	 * been created in the meantime. Can't use Tk_RestackWindow because it
	 * doesn't work under Win32.
	 */

	XRaiseWindow(Tk_Display(busyPtr->tkBusy),
		Tk_WindowId(busyPtr->tkBusy));
    }
}
开发者ID:afmayer,项目名称:tcl-tk,代码行数:19,代码来源:tkUnixEmbed.c

示例5: ArrowElementDraw

static void ArrowElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    int direction = *(int *)clientData;
    ArrowElement *arrow = elementRecord;
    Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, arrow->borderObj);
    XColor *arrowColor = Tk_GetColorFromObj(tkwin, arrow->colorObj);
    int relief = TK_RELIEF_RAISED;
    int borderWidth = 1;

    Tk_GetReliefFromObj(NULL, arrow->reliefObj, &relief);

    Tk_Fill3DRectangle(
	tkwin, d, border, b.x, b.y, b.width, b.height, borderWidth, relief);

    TtkFillArrow(Tk_Display(tkwin), d, Tk_GCForColor(arrowColor, d),
	Ttk_PadBox(b, ArrowMargins), direction);
}
开发者ID:lmiadowicz,项目名称:tk,代码行数:19,代码来源:ttkElements.c

示例6: tk_start

static bool tk_start(char **result)
{
  static bool first_init = false;
  Tk_Window mainw;
  if (!first_init) {
    first_init = true;
    /* this works around a bug in some Tcl/Tk versions */
    Tcl_FindExecutable(NULL);
    /* finalize Tcl at program exit */
    atexit(Tcl_Finalize);
  }
  *result = NULL;
  if (interp) return true;
  /* start up a new interpreter */
  if (!(interp = Tcl_CreateInterp())) return false;
  if (Tcl_Init(interp) != TCL_OK) {
    if (check_result(interp))
      set_result(result, get_result(interp));
    else
      set_result(result, "error initializing Tcl");
    tk_stop();
    return false;
  }
  /* create a command to invoke Pure callbacks from Tcl */
  Tcl_CreateCommand(interp, "pure", (Tcl_CmdProc*)tk_pure,
		    (ClientData)0, NULL);
  /* oddly, there are no `env' variables passed, and this one is needed */
  Tcl_SetVar2(interp, "env", "DISPLAY", getenv("DISPLAY"), TCL_GLOBAL_ONLY);
  if (Tk_Init(interp) != TCL_OK) {
    if (check_result(interp))
      set_result(result, get_result(interp));
    else
      set_result(result, "error initializing Tk");
    tk_stop();
    return false;
  }
  /* set up an X error handler */
  mainw = Tk_MainWindow(interp);
  Tk_CreateErrorHandler(Tk_Display(mainw), -1, -1, -1,
			XErrorProc, (ClientData)mainw);
  return true;
}
开发者ID:xushiwei,项目名称:pure-lang,代码行数:42,代码来源:tk.c

示例7: Ttk_GCForColor

static GC Ttk_GCForColor(Tk_Window tkwin, Tcl_Obj* colorObj, Drawable d)
{
    GC gc = Tk_GCForColor(Tk_GetColorFromObj(tkwin, colorObj), d);

#ifdef MAC_OSX_TK
    /*
     * Workaround for Tk bug under Aqua where the default line width is 0.
     */
    Display *display = Tk_Display(tkwin);
    unsigned long mask = 0ul;
    XGCValues gcValues;

    gcValues.line_width = 1;
    mask = GCLineWidth;

    XChangeGC(display, gc, mask, &gcValues);
#endif

    return gc;
}
开发者ID:aosm,项目名称:tcl,代码行数:20,代码来源:ttkClamTheme.c

示例8: CheckIndicatorElementDraw

static void CheckIndicatorElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned state)
{
    Display *display = Tk_Display(tkwin);
    IndicatorElement *indicator = elementRecord;
    GC gcb=Ttk_GCForColor(tkwin,indicator->backgroundObj,d);
    GC gcf=Ttk_GCForColor(tkwin,indicator->foregroundObj,d);
    GC gcu=Ttk_GCForColor(tkwin,indicator->upperColorObj,d);
    GC gcl=Ttk_GCForColor(tkwin,indicator->lowerColorObj,d);
    Ttk_Padding padding;
    const int w = WIN32_XDRAWLINE_HACK;

    Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginObj, &padding);
    b = Ttk_PadBox(b, padding);

    XFillRectangle(display,d,gcb, b.x,b.y,b.width,b.height);
    XDrawLine(display,d,gcl,b.x,b.y+b.height,b.x+b.width+w,b.y+b.height);/*S*/
    XDrawLine(display,d,gcl,b.x+b.width,b.y,b.x+b.width,b.y+b.height+w); /*E*/
    XDrawLine(display,d,gcu,b.x,b.y, b.x,b.y+b.height+w); /*W*/
    XDrawLine(display,d,gcu,b.x,b.y, b.x+b.width+w,b.y);  /*N*/

    if (state & TTK_STATE_SELECTED) {
	int p,q,r,s;

	b = Ttk_PadBox(b,Ttk_UniformPadding(2));
	p = b.x, q = b.y, r = b.x+b.width, s = b.y+b.height;

	r+=w, s+=w;
	XDrawLine(display, d, gcf, p,   q,   r,   s);
	XDrawLine(display, d, gcf, p+1, q,   r,   s-1);
	XDrawLine(display, d, gcf, p,   q+1, r-1, s);

	s-=w, q-=w;
	XDrawLine(display, d, gcf, p,   s,   r,   q);
	XDrawLine(display, d, gcf, p+1, s,   r,   q+1);
	XDrawLine(display, d, gcf, p,   s-1, r-1, q);
    }
}
开发者ID:aosm,项目名称:tcl,代码行数:39,代码来源:ttkClamTheme.c

示例9: TkpSetKeycodeAndState

void
TkpSetKeycodeAndState(
    Tk_Window tkwin,
    KeySym keysym,
    XEvent *eventPtr)
{
    if (keysym == NoSymbol) {
        eventPtr->xkey.keycode = 0;
    } else {
        Display *display = Tk_Display(tkwin);
        int macKeycode = XKeysymToMacKeycode(display, keysym);

        /*
         * See also XKeysymToKeycode.
         */

        if ((keysym >= XK_F1) && (keysym <= XK_F35)) {
            eventPtr->xkey.keycode = 0x0010;
        } else {
            eventPtr->xkey.keycode = 0x00FF & keysym;
        }
        eventPtr->xkey.keycode |= (macKeycode & MAC_KEYCODE_MASK) << 16;

        if (shiftKey & macKeycode) {
            eventPtr->xkey.state |= ShiftMask;
        }
        if (optionKey & macKeycode) {
            eventPtr->xkey.state |= OPTION_MASK;
        }

        if (keysym <= LATIN1_MAX) {
            int done;
            done = Tcl_UniCharToUtf(keysym,eventPtr->xkey.trans_chars);
            eventPtr->xkey.trans_chars[done] = 0;
        } else {
            eventPtr->xkey.trans_chars[0] = 0;
        }
    }
}
开发者ID:Vikasdatir55,项目名称:ns2-umts,代码行数:39,代码来源:tkMacOSXKeyboard.c

示例10: expose_handler

void expose_handler (ClientData cd, XEvent *ev) {
    Display *display;
    Window window;
    Visual *visual;
    GC gc;
    int screen;
    int depth;
    Tk_Window tkwin;

    tkwin=(Tk_Window) cd;
    display=Tk_Display (tkwin);
    window=Tk_WindowId (tkwin);
    gc=Tk_GetGC (tkwin,0,NULL);
    visual=Tk_Visual (tkwin);
    if (ximage==NULL) {
        screen=DefaultScreen (display);
        depth=DisplayPlanes (display,screen);
        image_data=(char *) malloc (RESX*RESY);
        ximage=XCreateImage
               (display,visual,depth,ZPixmap,0,image_data,RESX,RESY,8,0);
        gen_image ();
    }
}
开发者ID:ricbit,项目名称:Oldies,代码行数:23,代码来源:tcltk.c

示例11: DrawCorner

static void DrawCorner(
    Tk_Window tkwin,
    Drawable d,
    Tk_3DBorder border,			/* get most GCs from here... */
    GC borderGC,			/* "window border" color GC */
    int x,int y, int width,int height,	/* where to draw */
    int corner,				/* 0 => top left; 1 => bottom right */
    enum BorderColor color)
{
    XPoint points[3];
    GC gc;

    --width; --height;
    points[0].x = x;			points[0].y = y+height;
    points[1].x = x+width*corner;	points[1].y = y+height*corner;
    points[2].x = x+width;		points[2].y = y;

    if (color == BRDR)
	gc = borderGC;
    else
	gc = Tk_3DBorderGC(tkwin, border, (int)color);

    XDrawLines(Tk_Display(tkwin), d, gc, points, 3, CoordModeOrigin);
}
开发者ID:AlexShiLucky,项目名称:bitkeeper,代码行数:24,代码来源:ttkDefaultTheme.c

示例12: freeTile

static void 
freeTile (HtmlImage2 *pImage)
{
    HtmlTree *pTree = pImage->pImageServer->pTree;
    int flags = TCL_GLOBAL_ONLY;
    Tcl_Obj *pScript;
    if (pImage->pTileName) {
        pScript = Tcl_NewStringObj("image delete", -1);
        Tcl_IncrRefCount(pScript);
        Tcl_ListObjAppendElement(0, pScript, pImage->pTileName);
        Tcl_EvalObjEx(pTree->interp, pScript, flags);
        Tcl_DecrRefCount(pScript);
    
        Tcl_DecrRefCount(pImage->pTileName);
        pImage->tile = 0;
        pImage->pTileName = 0;
    }
    if (pImage->tilepixmap) {
        assert(pImage->pixmap);
        Tk_FreePixmap(
            Tk_Display(pImage->pImageServer->pTree->tkwin), pImage->tilepixmap);
        pImage->tilepixmap = 0;
    }
}
开发者ID:cogitokat,项目名称:brlcad,代码行数:24,代码来源:htmlimage.c

示例13: TabElementDraw

static void TabElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned int state)
{
    NotebookElement *tab = elementRecord;
    Tk_3DBorder border = Tk_Get3DBorderFromObj(tkwin, tab->backgroundObj);
    Display *display = Tk_Display(tkwin);
    int borderWidth = 2, dh = 0;
    int x1,y1,x2,y2;
    GC gc;
    const int w = WIN32_XDRAWLINE_HACK;

    if (state & TTK_STATE_SELECTED) {
	dh = borderWidth;
    }

    if (state & TTK_STATE_USER2) {	/* Rightmost tab */
	--b.width;
    }

    Tk_Fill3DRectangle(tkwin, d, border,
	b.x+2, b.y+2, b.width-1, b.height-2+dh, borderWidth, TK_RELIEF_FLAT);

    x1 = b.x, x2 = b.x + b.width;
    y1 = b.y, y2 = b.y + b.height;


    gc=Ttk_GCForColor(tkwin,tab->borderColorObj,d);
    XDrawLine(display,d,gc, x1,y1+1, x1,y2+w);
    XDrawLine(display,d,gc, x2,y1+1, x2,y2+w);
    XDrawLine(display,d,gc, x1+1,y1, x2-1+w,y1);

    gc=Ttk_GCForColor(tkwin,tab->lightColorObj,d);
    XDrawLine(display,d,gc, x1+1,y1+1, x1+1,y2-1+dh+w);
    XDrawLine(display,d,gc, x1+1,y1+1, x2-1+w,y1+1);
}
开发者ID:aosm,项目名称:tcl,代码行数:36,代码来源:ttkClamTheme.c

示例14: TextDraw

/*
 * TextDraw --
 * 	Draw a text element.
 * 	Called by TextElementDraw() and LabelElementDraw().
 */
static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b)
{
    XColor *color = Tk_GetColorFromObj(tkwin, text->foregroundObj);
    int underline = -1;
    XGCValues gcValues;
    GC gc1, gc2;
    Tk_Anchor anchor = TK_ANCHOR_CENTER;
    TkRegion clipRegion = NULL;

    gcValues.font = Tk_FontId(text->tkfont);
    gcValues.foreground = color->pixel;
    gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues);
    gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin));
    gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues);

    /* 
     * Place text according to -anchor:
     */
    Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor);
    b = Ttk_AnchorBox(b, text->width, text->height, anchor);

    /*
     * Clip text if it's too wide:
     */
    if (b.width < text->width) {
	XRectangle rect;

	clipRegion = TkCreateRegion();
	rect.x = b.x;
	rect.y = b.y;
	rect.width = b.width + (text->embossed ? 1 : 0);
	rect.height = b.height + (text->embossed ? 1 : 0);
	TkUnionRectWithRegion(&rect, clipRegion, clipRegion);
	TkSetRegion(Tk_Display(tkwin), gc1, clipRegion);
	TkSetRegion(Tk_Display(tkwin), gc2, clipRegion);
#ifdef HAVE_XFT
	TkUnixSetXftClipRegion(clipRegion);
#endif
    }

    if (text->embossed) {
	Tk_DrawTextLayout(Tk_Display(tkwin), d, gc2,
	    text->textLayout, b.x+1, b.y+1, 0/*firstChar*/, -1/*lastChar*/);
    }
    Tk_DrawTextLayout(Tk_Display(tkwin), d, gc1,
	    text->textLayout, b.x, b.y, 0/*firstChar*/, -1/*lastChar*/);

    Tcl_GetIntFromObj(NULL, text->underlineObj, &underline);
    if (underline >= 0) {
	if (text->embossed) {
	    Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc2,
		text->textLayout, b.x+1, b.y+1, underline);
	}
	Tk_UnderlineTextLayout(Tk_Display(tkwin), d, gc1,
	    text->textLayout, b.x, b.y, underline);
    }

    if (clipRegion != NULL) {
#ifdef HAVE_XFT
	TkUnixSetXftClipRegion(None);
#endif
	XSetClipMask(Tk_Display(tkwin), gc1, None);
	XSetClipMask(Tk_Display(tkwin), gc2, None);
	TkDestroyRegion(clipRegion);
    }
    Tk_FreeGC(Tk_Display(tkwin), gc1);
    Tk_FreeGC(Tk_Display(tkwin), gc2);
}
开发者ID:disenone,项目名称:wpython-2.7.11,代码行数:73,代码来源:ttkLabel.c

示例15: CreateBLine

static int
CreateBLine(Tcl_Interp* interp, Tk_Canvas canvas, Tk_Item *itemPtr, 
            int argc, CONST84 char** argv)
{
  BLineItem *linePtr = (BLineItem *) itemPtr;
  int i;

  tagsOption.parseProc = Tk_CanvasTagsParseProc;
  tagsOption.printProc = Tk_CanvasTagsPrintProc;

  if (argc < 4) 
  {
    Tcl_AppendResult(interp, "wrong # args:  should be \"",
      Tk_PathName(Tk_CanvasTkwin(canvas)), "\" create ",
      itemPtr->typePtr->name, " x1 y1 x2 y2 ?x3 y3 ...? ?options?",
      (char *) NULL);
    return TCL_ERROR;
  }

  /*
   * Carry out initialization that is needed to set defaults and to
   * allow proper cleanup after errors during the the remainder of
   * this procedure.
   */

  linePtr->numPoints = 0;
  linePtr->coordPtr = NULL;
  linePtr->width = 1;
  linePtr->capStyle = CapButt;
  linePtr->joinStyle = JoinRound;
  linePtr->borderWidth = 2;
  linePtr->relief = TK_RELIEF_RAISED;
  linePtr->border = NULL;

  /*
   * Count the number of points and then parse them into a point
   * array.  Leading arguments are assumed to be points if they
   * start with a digit or a minus sign followed by a digit.
   */

  for (i = 4; i < (argc-1); i+=2) 
  {
    if ((!isdigit(UCHAR(argv[i][0]))) &&
        ((argv[i][0] != '-') || (!isdigit(UCHAR(argv[i][1]))))) 
    {
      break;
    }
  }
  if (BLineCoords(interp, canvas, itemPtr, i, argv) != TCL_OK) 
  {
    goto error;
  }
  if (ConfigureBLine(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) 
  {
    return TCL_OK;
  }

  error:
  DeleteBLine(canvas, itemPtr, Tk_Display(Tk_CanvasTkwin(canvas)));
  return TCL_ERROR;
}
开发者ID:pip010,项目名称:scirun4plus,代码行数:61,代码来源:tkCanvBLine.c


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