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


C++ Tk_WindowId函数代码示例

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


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

示例1: C_StretchBoxProc

int C_StretchBoxProc(ClientData cl, Tcl_Interp *interp, int argc, char **argv)
{
  double x2,y2,xtemp2,ytemp2;
  Pixmap pm;
  XRectangle theClientArea;
  Tk_Window tkwin;
  WindowType theWindow = theWindowArray[atoi(argv[1])];

  tkwin = theWindow->tkwin;

  theClientArea.x = 0;
  theClientArea.y = 0;
  theClientArea.width = Tk_Width(tkwin);
  theClientArea.height = Tk_Height(tkwin);
  XSetClipRectangles(theDisplay, theWindow->xwingc, 0, 0, &theClientArea, 
		     1, Unsorted);

  pm = XCreatePixmap(theDisplay, Tk_WindowId(tkwin), Tk_Width(tkwin),
		     Tk_Height(tkwin), Tk_Depth(tkwin));
  XCopyArea(theDisplay, theWindow->pixmap_buffer, pm, theWindow->xwingc, 0,
	    0, Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);

  x2 = atof(argv[2]);
  y2 = atof(argv[3]);

  if (Is_X_Log(theWindow)) {
    xtemp2 = theWindow->c1 * log10(max(x2, DBL_MIN)) + theWindow->d1;
  } else {
    xtemp2 = theWindow->c1 * x2 + theWindow->d1;
  }
    
  if (Is_Y_Log(theWindow)) {
    ytemp2 = theWindow->c2 * log10(max(y2, DBL_MIN)) + theWindow->d2;
  } else {
    ytemp2 = theWindow->c2 * y2 + theWindow->d2;
  }

  XSetForeground(theDisplay, theWindow->xwingc, theWhitePixel);
  XDrawRectangle(theDisplay, pm, theWindow->xwingc, min(xtemp1,xtemp2), 
		 min(ytemp1,ytemp2), fabs(xtemp2 - xtemp1), 
		 fabs(ytemp2 - ytemp1));
  XCopyArea(theDisplay, pm, Tk_WindowId(tkwin), theWindow->xwingc, 0, 0,
	    Tk_Width(tkwin), Tk_Height(tkwin), 0, 0);
  XFlush(theDisplay);
  XFreePixmap(theDisplay, pm);
  
  return TCL_OK;
}
开发者ID:jblumenk,项目名称:Dusty-XOOPIC,代码行数:48,代码来源:xgcommands.c

示例2: Tk_MainWindow

bool
ParadynTkGUI::TryFirstWhereAxisWindow( void )
{
   if (haveSeenFirstWhereAxisWindow)
      return true;

   Tk_Window topLevelTkWindow = Tk_MainWindow( interp );
   Tk_Window theTkWindow = Tk_NameToWindow(interp, ".whereAxis.nontop.main.all",
                                           topLevelTkWindow);
   assert(theTkWindow);

   if (Tk_WindowId(theTkWindow) == 0)
      return false; // sigh...still invalid (that's why this routine is needed)

   haveSeenFirstWhereAxisWindow = true;

   theAbstractions = new abstractions("",
                      ".whereAxis.top.mbar.nav.m",
                      ".whereAxis.nontop.main.bottsb",
                      ".whereAxis.nontop.main.leftsb",
                      ".whereAxis.nontop.find.entry",
                      interp, theTkWindow);
   assert(theAbstractions);
   
   return true;   
}
开发者ID:dyninst,项目名称:paradyn,代码行数:26,代码来源:ParadynTkGUI.C

示例3: TreeMarquee_Display

void
TreeMarquee_Display(
    TreeMarquee marquee		/* Marquee token. */
    )
{
    TreeCtrl *tree = marquee->tree;

    if (!marquee->onScreen && marquee->visible) {
	if (TreeMarquee_IsXOR(marquee)) {
	    marquee->sx = 0 - tree->xOrigin;
	    marquee->sy = 0 - tree->yOrigin;
	    TreeMarquee_DrawXOR(marquee, Tk_WindowId(tree->tkwin),
		marquee->sx, marquee->sy);
	} else {
	    marquee->sx = MIN(marquee->x1, marquee->x2) - tree->xOrigin;
	    marquee->sy = MIN(marquee->y1, marquee->y2) - tree->yOrigin;
	    marquee->sw = abs(marquee->x2 - marquee->x1) + 1;
	    marquee->sh = abs(marquee->y2 - marquee->y1) + 1;
/*	    Tree_InvalidateItemArea(tree, marquee->sx, marquee->sy,
		marquee->sx + marquee->sw, marquee->sy + marquee->sh);*/
	    Tree_EventuallyRedraw(tree);
	}
	marquee->onScreen = TRUE;
    }
}
开发者ID:aosm,项目名称:tcl,代码行数:25,代码来源:tkTreeMarquee.c

示例4: WindowToHandle

/*
 *---------------------------------------------------------------------------
 *
 * WindowToHandle --
 *
 *---------------------------------------------------------------------------
 */
static HWND
WindowToHandle(Tk_Window tkwin)
{
    HWND hWnd;
    Window window;
    
    window = Tk_WindowId(tkwin);
    if (window == None) {
	Tk_MakeWindowExist(tkwin);
    }
    hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
    if (Tk_IsTopLevel(tkwin)) {
	hWnd = GetParent(hWnd);
    }
    return hWnd;
}
开发者ID:Starlink,项目名称:blt,代码行数:23,代码来源:bltWinWindow.c

示例5: ScrollbarThumbElementDraw

static void ScrollbarThumbElementDraw(
    void *clientData, void *elementRecord, Tk_Window tkwin,
    Drawable d, Ttk_Box b, unsigned state)
{
    if (qApp == NULL) NULL_Q_APP;
    if (state & TTK_STATE_DISABLED) return;
    NULL_PROXY_ORIENTED_WIDGET(TileQt_QScrollBar_Widget);
    Tcl_MutexLock(&tileqtMutex);
    //QPixmap      pixmap(b.width, b.height);
    QPixmap      pixmap = QPixmap::grabWindow(Tk_WindowId(tkwin));
    QPainter     painter(&pixmap);
#ifdef TILEQT_QT_VERSION_4
    wc->TileQt_QScrollBar_Widget->resize(b.width, b.height);
    wc->TileQt_QScrollBar_Widget->setValue(0);
    if (orient == TTK_ORIENT_HORIZONTAL) {
      wc->TileQt_QScrollBar_Widget->setOrientation(Qt::Horizontal);
    } else {
      wc->TileQt_QScrollBar_Widget->setOrientation(Qt::Vertical);
    }
    QStyleOptionSlider option;
    option.initFrom(wc->TileQt_QScrollBar_Widget); option.state |= 
      (QStyle::StateFlag) TileQt_StateTableLookup(scrollbar_statemap, state);
    option.subControls = QStyle::SC_ScrollBarGroove;
    wc->TileQt_Style->drawComplexControl(QStyle::CC_ScrollBar, &option,
                                  &painter, wc->TileQt_QScrollBar_Widget);
#endif /* TILEQT_QT_VERSION_4 */
    // printf("x=%d, y=%d, w=%d, h=%d\n", b.x, b.y, b.width, b.height);
    TileQt_CopyQtPixmapOnToDrawable(pixmap, d, tkwin,
                                    0, 0, b.width, b.height, b.x, b.y);
    Tcl_MutexUnlock(&tileqtMutex);
}
开发者ID:aweelka,项目名称:uTileQt,代码行数:31,代码来源:tileQt_Scrollbar.cpp

示例6: tkwin_GetGC

static PyObject *
tkwin_GetGC(TkWinObject * self, PyObject* args, PyObject * kwargs)
{
    Display * display;
    GC gc;
    unsigned long mask = 0;
    XGCValues values;
    PyObject * dict;

    if (PySequence_Length(args) > 0)
    {
	if (!PyArg_ParseTuple(args, "O", &dict))
	    return NULL;
    }
    else
	dict = kwargs;

    display = Tk_Display(self->tkwin);

    if (dict)
    {
	if (!PaxGC_MakeValues(dict, &mask, &values))
	    return NULL;
    }
    gc = Tk_GetGC(self->tkwin, mask, &values);
    return PaxGC_FromGC(display, Tk_WindowId(self->tkwin), gc, PAXGC_SHARED,
		       NULL);
}
开发者ID:kindlychung,项目名称:sk1,代码行数:28,代码来源:tkwinobject.c

示例7: TkWin_AsWindowID

Window
TkWin_AsWindowID(PyObject * self)
{
    if (self && TkWin_Check(self))
	return Tk_WindowId(((TkWinObject*)self)->tkwin);
    PyErr_BadInternalCall();
    return None;
}
开发者ID:kindlychung,项目名称:sk1,代码行数:8,代码来源:tkwinobject.c

示例8: tkwin_CopyArea

static PyObject *
tkwin_CopyArea(TkWinObject * self, PyObject * args)
{
    PyObject *destobj, *gcobj;
    Drawable dest;
    GC gc;
    int src_x, src_y, dest_x, dest_y;
    unsigned int width, height;

    if (!PyArg_ParseTuple(args, "OOiiiiii", &destobj, &gcobj, &src_x,
			  &src_y, &width, &height, &dest_x, &dest_y))
	return NULL;
    if (TkWin_Check(destobj))
    {
	if (Tk_IsMapped(self->tkwin))
	    dest = Tk_WindowId(((TkWinObject*) destobj)->tkwin);
	else
	{
	    Py_INCREF(Py_None);
	    return Py_None;
	}
    }
    else if (PaxPixmap_Check(destobj))
    {
	dest = PaxPixmap_AsPixmap(destobj);
    }
    else
    {
	PyErr_SetString(PyExc_RuntimeError, "bad arguments");
	return NULL;
    }
    if (gcobj == Py_None)
	gc = DefaultGCOfScreen(Tk_Screen(self->tkwin));
    else
    {
	gc = PaxGC_AsGC(gcobj);
	if (PyErr_Occurred())
	    return NULL;
    }

    XCopyArea(Tk_Display(self->tkwin), Tk_WindowId(self->tkwin),
	      dest, gc, src_x, src_y, width, height, dest_x, dest_y);

    Py_INCREF(Py_None);
    return Py_None;
}
开发者ID:kindlychung,项目名称:sk1,代码行数:46,代码来源:tkwinobject.c

示例9: Blt_PictureMask

Pixmap
Blt_PictureMask(Tk_Window tkwin, Picture *srcPtr)
{
    Blt_Pixel *srcRowPtr;
    Pixmap bitmap;
    int bytesPerLine;
    int count;
    int x, y;
    unsigned char *bits;
    unsigned char *destRowPtr;

    bytesPerLine = (srcPtr->width + 7) / 8;
    bits = Blt_AssertMalloc(sizeof(unsigned char)*srcPtr->height*bytesPerLine);
    count = 0;
    srcRowPtr = srcPtr->bits;
    destRowPtr = bits;
    for (y = 0; y < srcPtr->height; y++) {
	int value, bitMask;
	Blt_Pixel *sp;
	unsigned char *dp;

	sp = srcRowPtr, dp = destRowPtr;
	value = 0, bitMask = 1;
	for (x = 0; x < srcPtr->width; /*empty*/ ) {
	    unsigned long pixel;

	    pixel = (sp->Alpha != ALPHA_TRANSPARENT);
	    if (pixel) {
		value |= bitMask;
	    } else {
		count++;	/* Count the number of transparent pixels. */
	    }
	    bitMask <<= 1;
	    x++;
	    if (!(x & 7)) {
		*dp++ = (unsigned char)value;
		value = 0, bitMask = 1;
	    }
	    sp++;
	}
	if (x & 7) {
	    *dp++ = (unsigned char)value;
	}
	srcRowPtr += srcPtr->pixelsPerRow;
	destRowPtr += bytesPerLine;
    }
    if (count > 0) {
	Tk_MakeWindowExist(tkwin);
	bitmap = XCreateBitmapFromData(Tk_Display(tkwin), Tk_WindowId(tkwin),
		(char *)bits, (unsigned int)srcPtr->width, 
		(unsigned int)srcPtr->height);
    } else {
	bitmap = None;		/* Image is opaque. */
    }
    Blt_Free(bits);
    return bitmap;
}
开发者ID:Starlink,项目名称:blt,代码行数:57,代码来源:bltMacBitmap.c

示例10: Tk_MakeWindowExist

void XvWindow::setsize(int w, int h)
{
	CaptureWindow::setsize(w, h);
	/* Start the video display */
	Tk_MakeWindowExist(tk_);
	XvPutVideo(dpy_, grabID_, Tk_WindowId(tk_), gc_,
		   0, 0, base_width_, base_height_,
		   0, 0, width_, height_);
}
开发者ID:pierz,项目名称:vic,代码行数:9,代码来源:grabber-xv.cpp

示例11: GetWindowHandle

/*
 *----------------------------------------------------------------------
 *
 * GetWindowHandle --
 *
 *      Returns the XID for the Tk_Window given.  Starting in Tk 8.0,
 *      the toplevel widgets are wrapped by another window.
 *      Currently there's no way to get at that window, other than
 *      what is done here: query the X window hierarchy and grab the
 *      parent.
 *
 * Results:
 *      Returns the X Window ID of the widget.  If it's a toplevel, then
 *	the XID of the wrapper is returned.
 *
 *----------------------------------------------------------------------
 */
static HWND
GetWindowHandle(Tk_Window tkwin)
{
    HWND hWnd;
    Window window;
    
    window = Tk_WindowId(tkwin);
    if (window == None) {
	Tk_MakeWindowExist(tkwin);
    }
    hWnd = Tk_GetHWND(Tk_WindowId(tkwin));
#if (TK_MAJOR_VERSION > 4)
    if (Tk_IsTopLevel(tkwin)) {
	hWnd = GetParent(hWnd);
    }
#endif /* TK_MAJOR_VERSION > 4 */
    return hWnd;
}
开发者ID:PA7T,项目名称:red-pitaya-notes,代码行数:35,代码来源:bltWindow.c

示例12: 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

示例13: Blt_PhotoImageMask

Pixmap
Blt_PhotoImageMask(Tk_Window tkwin, Tk_PhotoImageBlock src)
{
    Pixmap bitmap;
    int arraySize, bytes_per_line;
    int offset, count;
    int y;
    unsigned char *bits;
    unsigned char *dp;

#ifdef notdef
    bytes_per_line = (src.width + 7) / 8;
    arraySize = src.height * bytes_per_line;
    bits = Blt_AssertMalloc(sizeof(unsigned char) * arraySize);
    dp = bits;
    offset = count = 0;
    for (y = 0; y < src.height; y++) {
	int value, bitMask;
	int x;
	unsigned char *sp;

	value = 0, bitMask = 1;
	sp = src.pixelPtr + offset;
	for (x = 0; x < src.width; /*empty*/ ) {
	    unsigned long pixel;

	    pixel = (sp[src.offset[3]] != 0x00);
	    if (pixel) {
		value |= bitMask;
	    } else {
		count++;	/* Count the number of transparent pixels. */
	    }
	    bitMask <<= 1;
	    x++;
	    if (!(x & 7)) {
		*dp++ = (unsigned char)value;
		value = 0, bitMask = 1;
	    }
	    sp += src.pixelSize;
	}
	if (x & 7) {
	    *dp++ = (unsigned char)value;
	}
	offset += src.pitch;
    }
    if (count > 0) {
	Tk_MakeWindowExist(tkwin);
	bitmap = XCreateBitmapFromData(Tk_Display(tkwin), Tk_WindowId(tkwin),
	    (char *)bits, (unsigned int)src.width, (unsigned int)src.height);
    } else {
	bitmap = None;		/* Image is opaque. */
    }
    Blt_Free(bits);
#endif
    return bitmap;
}
开发者ID:Starlink,项目名称:blt,代码行数:56,代码来源:bltMacBitmap.c

示例14: TkScrollWindow

int
TkScrollWindow(
    Tk_Window tkwin,		/* The window to be scrolled. */
    GC gc,			/* GC for window to be scrolled. */
    int x, int y, int width, int height,
				/* Position rectangle to be scrolled. */
    int dx, int dy,		/* Distance rectangle should be moved. */
    TkRegion damageRgn)		/* Region to accumulate damage in. */
{
    Tk_RestrictProc *oldProc;
    ClientData oldArg, dummy;
    ScrollInfo info;

    XCopyArea(Tk_Display(tkwin), Tk_WindowId(tkwin), Tk_WindowId(tkwin), gc,
	    x, y, (unsigned) width, (unsigned) height, x+dx, y+dy);

    info.done = 0;
    info.window = Tk_WindowId(tkwin);
    info.display = Tk_Display(tkwin);
    info.region = damageRgn;
    info.dx = dx;
    info.dy = dy;

    /*
     * Sync the event stream so all of the expose events will be on the Tk
     * event queue before we start filtering. This avoids busy waiting while
     * we filter events.
     */

    TkpSync(info.display);
    oldProc = Tk_RestrictEvents(ScrollRestrictProc, (ClientData) &info,
	    &oldArg);
    while (!info.done) {
	Tcl_ServiceEvent(TCL_WINDOW_EVENTS);
    }
    Tk_RestrictEvents(oldProc, oldArg, &dummy);

    if (XEmptyRegion((Region) damageRgn)) {
	return 0;
    } else {
	return 1;
    }
}
开发者ID:AbaqusPowerUsers,项目名称:AbaqusPythonScripts,代码行数:43,代码来源:tkUnixDraw.c

示例15: TkpScaleElement

int
TkpScaleElement(
    TkScale *scalePtr,		/* Widget record for scale. */
    int x, int y)		/* Coordinates within scalePtr's window. */
{
    MacScale *macScalePtr = (MacScale *) scalePtr;
    ControlPartCode part;
    Point where;
    Rect bounds;
    CGrafPtr destPort, savePort;
    Boolean portChanged;

#ifdef TK_MAC_DEBUG_SCALE
    TkMacOSXDbgMsg("TkpScaleElement");
#endif
    destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scalePtr->tkwin));
    portChanged = QDSwapPort(destPort, &savePort);

    /*
     * All of the calculations in this procedure mirror those in
     * DisplayScrollbar. Be sure to keep the two consistent.
     */

    TkMacOSXWinBounds((TkWindow *) scalePtr->tkwin, &bounds);
    where.h = x + bounds.left;
    where.v = y + bounds.top;
    part = TestControl(macScalePtr->scaleHandle, where);

    if (portChanged) {
	QDSwapPort(savePort, NULL);
    }

#ifdef TK_MAC_DEBUG_SCALE
    fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v );
#endif

    switch (part) {
	case inSlider:
	    return SLIDER;
	case inInc:
	    if (scalePtr->orient == ORIENT_VERTICAL) {
		return TROUGH1;
	    } else {
		return TROUGH2;
	    }
	case inDecr:
	    if (scalePtr->orient == ORIENT_VERTICAL) {
		return TROUGH2;
	    } else {
		return TROUGH1;
	    }
	default:
	    return OTHER;
    }
}
开发者ID:swkarlekar,项目名称:STIDER_work,代码行数:55,代码来源:tkMacOSXScale.c


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