wxBitmapButton::~wxBitmapButton() { SetBitmapLabel(wxNullBitmap); if (m_insensPixmap) XmDestroyPixmap (DefaultScreenOfDisplay ((Display*) GetXDisplay()), (Pixmap) m_insensPixmap); }
void iupdrvImageDestroy(void* handle, int type) { if (type == IUPIMAGE_CURSOR) XFreeCursor(iupmot_display, (Cursor)handle); else { Screen* screen = ScreenOfDisplay(iupmot_display, iupmot_screen); if (!XmDestroyPixmap(screen, (Pixmap)handle)) XFreePixmap(iupmot_display, (Pixmap)handle); } }
wxBitmapCache::~wxBitmapCache() { if( m_display ) { Screen* screen = DefaultScreenOfDisplay( (Display*)m_display ); if( m_labelPixmap ) XmDestroyPixmap( screen, (Pixmap)m_labelPixmap ); if( m_armPixmap ) XmDestroyPixmap( screen, (Pixmap)m_armPixmap ); if( m_insensPixmap ) XmDestroyPixmap( screen, (Pixmap)m_insensPixmap ); } if( m_image ) { XmUninstallImage( (XImage*)m_image ); XtFree( (char*)(XImage*)m_image ); } }
void ui_set_label_glyph( Widget widget, STRING fileName ) { Pixmap labelPixmap = NULL; Pixmap labelInsensitivePixmap = NULL; XtVaGetValues(widget, XmNlabelPixmap, &labelPixmap, XmNlabelInsensitivePixmap, &labelInsensitivePixmap, NULL); if (dtb_set_label_from_image_file(widget, fileName) < 0) return; /* sucess, destroy the old pixmaps */ if (labelPixmap) XmDestroyPixmap(XtScreen(widget), labelPixmap); if (labelInsensitivePixmap) XmDestroyPixmap(XtScreen(widget), labelInsensitivePixmap); }
WXPixmap wxBitmapCache::GetArmPixmap( WXWidget w ) { if( m_armPixmap && !m_recalcPixmaps.arm ) return m_armPixmap; CreateImageIfNeeded( w ); Screen* screen = DefaultScreenOfDisplay( (Display*)m_display ); if( m_armPixmap ) XmDestroyPixmap( screen, (Pixmap)m_armPixmap ); if( !m_image ) return (WXPixmap)NULL; m_armPixmap = GetPixmapFromCache(w); m_recalcPixmaps.arm = !m_armPixmap; return m_armPixmap; }
WXPixmap wxBitmapCache::GetInsensPixmap( WXWidget w ) { if( m_insensPixmap && !m_recalcPixmaps.insens ) return m_insensPixmap; CreateImageIfNeeded( w ); Screen* screen = DefaultScreenOfDisplay( (Display*)m_display ); if( m_insensPixmap ) XmDestroyPixmap( screen, (Pixmap)m_insensPixmap ); if( !m_image ) return (WXPixmap)NULL; m_insensPixmap = (WXPixmap)XCreateInsensitivePixmap( (Display*)m_display, (Pixmap)m_bitmap.GetDrawable() ); m_recalcPixmaps.insens = !m_insensPixmap; return m_insensPixmap; }
int main( int argc, char *argv[] ) { int n; Arg Args[MAX_ARGS]; int i; Widget Text; Widget Window; Pixmap WindPixmap; Pixmap TextPixmap; CommonTestInit(argc, argv); /* Get the pixmaps for the backgrounds */ WindPixmap = XmGetPixmap(screen, WINDOW_PIXMAP, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); TextPixmap = XmGetPixmap(screen, TEXT_PIXMAP, BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); if (!WindPixmap) { (void)printf("Can't make pixmap for file %s!\n", WINDOW_PIXMAP ); exit(1); } if (!TextPixmap) { (void)printf("Can't make pixmap for file %s!\n", TEXT_PIXMAP ); exit(1); } /* Make the ScrolledWindow and Text */ n = 0; XtSetArg( Args[n], XmNvalue, Strings ); n++; XtSetArg( Args[n], XmNeditable, False ); n++; XtSetArg( Args[n], XmNeditMode, XmMULTI_LINE_EDIT ); n++; Text = XmCreateScrolledText(Shell1, "Text", Args, n ); /* Get the Widget for the parent Scrolled Window */ Window = XtParent(Text); /* Set the Text Pixmap and color */ n = 0; XtSetArg(Args[n], XmNbackgroundPixmap, TextPixmap ); n++; XtSetValues( Text, Args, n ); SetWidgetColor( Text, "white" ); /* Set the Window Pixmap and color */ n = 0; XtSetArg(Args[n], XmNbackgroundPixmap, WindPixmap ); n++; XtSetValues( Window, Args, n ); SetWidgetColor( Window, "pink" ); XtManageChild(Text); XtManageChild(Window); /************* * Assertion 1. Now that the text and window have differing pixmaps, * lets dump the values for the child scrollbar values. */ PrintValues( Window, "Assertion 1" ); CommonPause(); /************* * Assertion 2. Now that the text and window have differing pixmaps, * lets dump the values for the child scrollbar values. */ SetWidgetColor( Text, "green" ); PrintValues( Window, "Assertion 2" ); CommonPause(); /* Cleanup Time */ XmDestroyPixmap( screen, WindPixmap ); XmDestroyPixmap( screen, TextPixmap ); XtDestroyWidget( XtParent(Text) ); CommonPause(); XtAppMainLoop(app_context); return 0; }
/********************************************************************* * Function: _DtHelpDisplayAreaDestroyCB * * _DtHelpDisplayAreaDestroyCB deallocates all information * associated with it. * *********************************************************************/ void _DtHelpDisplayAreaDestroyCB ( Widget w, XtPointer client_data, XtPointer call_data) { int i; long strIdx; XrmName xrmList[_DtHelpFontQuarkNumber]; Display *dpy; DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data; Boolean usedDef = False; /* * do the gross cleaning */ _DtHelpDisplayAreaClean(client_data); if (NULL != pDAS->canvas) _DtCanvasDestroy (pDAS->canvas); dpy = XtDisplay(pDAS->dispWid); /* * Free the gc's */ XFreeGC (dpy, pDAS->normalGC); XFreeGC (dpy, pDAS->pixmapGC); XFreeGC (dpy, pDAS->invertGC); if (pDAS->def_pix != 0 && XmDestroyPixmap(XDefaultScreenOfDisplay(dpy), pDAS->def_pix) == False) XFreePixmap(dpy, pDAS->def_pix); if (pDAS->context != NULL) { _DtGrDestroyContext(pDAS->context); XtFree((char *) pDAS->context); } /* * destroy the widgets. */ XtDestroyWidget(pDAS->dispWid); if (pDAS->horzScrollWid != NULL) XtDestroyWidget(pDAS->horzScrollWid); if (pDAS->vertScrollWid != NULL) XtDestroyWidget(pDAS->vertScrollWid); /* * free the special characters */ if (pDAS->spc_chars != NULL) free ((char *) pDAS->spc_chars); /* * free the font info. */ _DtHelpGetStringQuarks(xrmList); if (__DtHelpFontIndexGet(pDAS, xrmList, &strIdx) != 0) usedDef = True; if (pDAS->font_info.def_font_db != NULL) XrmDestroyDatabase(pDAS->font_info.def_font_db); if (pDAS->font_info.font_idx_db != NULL) XrmDestroyDatabase(pDAS->font_info.font_idx_db); if (pDAS->font_info.exact_fonts != NULL) { _DtHelpCeFreeStringArray(pDAS->font_info.exact_fonts); free(pDAS->font_info.exact_idx); } if (pDAS->font_info.font_structs != NULL) { /* * if the string index is a positive number, this * indicates that the string font is a font not * a font set and it wouldn't be freed in this * routine. */ for (i = 0; i < pDAS->font_info.struct_cnt; i++) { if (usedDef == True || i != strIdx) XFreeFont(dpy, pDAS->font_info.font_structs[i]); } free(pDAS->font_info.font_structs); } if (pDAS->font_info.font_sets != NULL) { /* * if the string index is a negative number, this turns * it to positive and the tests will succeed. * * if the string index was a font not a fontset, then * this will turn the value negative and the test * will never succeed. */ strIdx = (-strIdx) - 1; for (i = 0; i < pDAS->font_info.set_cnt; i++) { if (usedDef == True || i != strIdx) XFreeFontSet(dpy, pDAS->font_info.font_sets[i]); } free(pDAS->font_info.font_sets); free(pDAS->font_info.fs_metrics); } /* * free the locale dependant information */ if (NULL != pDAS->cant_begin_chars) free (pDAS->cant_begin_chars); if (NULL != pDAS->cant_end_chars) free (pDAS->cant_end_chars); /* * destroy the display area pointer */ XtFree ((char *) pDAS); } /* End DtHelpDisplayAreaDestroy */