コード例 #1
0
 static int loadAlternativeIconTable(SKINDATA *wnd)
 {
    SIZEL              sizl            = { 0, 0 };  /* use same page size as device */
    DEVOPENSTRUC       dop             = { 0, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
    HAB                hab             = icqQueryAnchorBlock(wnd->icq);
    HDC                hdc;
    HPS                hps;

    CHKPoint();

    icqskin_deleteImage( wnd->iconImage );
    icqskin_deleteImage( wnd->iconMasc  );

    hdc  = DevOpenDC(hab, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
    hps  = GpiCreatePS(hab, hdc, &sizl, PU_PELS | GPIT_MICRO | GPIA_ASSOC);

    if(hps)
    {
       wnd->iconImage = GpiLoadBitmap(hps, module, 101, ICONBAR_ROWS * PWICQICONBARSIZE, ICONBAR_ROWS);
       wnd->iconMasc  = GpiLoadBitmap(hps, module, 102, ICONBAR_ROWS * PWICQICONBARSIZE, ICONBAR_ROWS);
       GpiDestroyPS(hps);
    }

    DevCloseDC(hdc);

    return ICONBAR_ROWS;
 }
コード例 #2
0
                                        /* Initialize data for our drawing thread */
int             Draw_Initialize(void)
{
int             i;                      /* Temporary variables */

                                        /* For each symbol, open a memory devicecontext,
                                           create a presentation space and load the bitmap
                                           from the EXE file */
for(i=1;i<RB_BORDER;i++)
   {
   if(!(hdcRB[i]=DevOpenDC(hab,         /* Open device context with anchor block handle of
                                           our application */
        OD_MEMORY,                      /* Type of device context (memory) */
        (PSZ)"*",                       /* Device information token (no initialization) */
        8L,                             /* Number of items (of deviceopendata) */
        (PDEVOPENDATA)&dcRB[i],         /* Open device context data */
        (HDC)NULL)))                    /* Compatible device context (compatibilty with screen) */
        GEN_ERR(hab,hwndFrame,hwndClient);
   if(!(hpsRB[i]=GpiCreatePS(hab,       /* Create a presentation space with our anchor block
                                           handle */
        hdcRB[i],                       /* Device context handle (of our symbols) */
        &sizelRB,                       /* Presentation space size (or our symbols) */
        GPIA_ASSOC|PU_PELS)))           /* Options (assoziate to screen, pels as unit) */
        GEN_ERR(hab,hwndFrame,hwndClient);
                                        /* Load bitmap from EXE file */
   if(!(hbmRB[i]=GpiLoadBitmap(hpsRB[i],
        (HMODULE)0,                     /* Ressource (EXE file) */
        RB_RESSOURCE_ID[i],             /* ID of bitmap within ressource */
        0L,                             /* Width of bitmap in pels (no streching) */
        0L)))                           /* Height of bitmap in pels (no streching) */
        GEN_ERR(hab,hwndFrame,hwndClient);
   }
return(0);
}
コード例 #3
0
void ValueSample::init()
{
 COLOR color[] = { CLR_RED, CLR_GREEN, CLR_BLUE, CLR_YELLOW };

 logo.showLogo(1500);

 createDlg();
 if (!hwnd)
   OThrowPM("Dialog creation failed.", 0, OException::unrecoverable);

 VSet.inherit(hwnd);
 VSet.setItemAttr(1, 0, VIA_ICON);
 VSet.setItemAttr(2, 0, VIA_BITMAP);
 VSet.setItemAttr(3, 0, VIA_COLORINDEX);

 if ((VSet.selected.icon = WinLoadPointer(HWND_DESKTOP, NULLHANDLE, VALUE_ICON)) == NULLHANDLE)
   OThrowPM("Loading icon failed.", 0, OException::unrecoverable);
 
 if (!VSet.setItem(1, 0, (ULONG)VSet.selected.icon))
   OThrowPM("Could not set icons.", 0, OException::unrecoverable);

 if ((VSet.selected.bitmap = GpiLoadBitmap(WinGetPS(hwnd), NULLHANDLE, VALUE_BMP, 0, 0)) == NULLHANDLE)
   OThrowPM("Loading bitmap failed.", 0, OException::unrecoverable);

 if (!VSet.setItem(2, 0, (ULONG)VSet.selected.bitmap))
   OThrowPM("Could not set bitmaps.", 0, OException::unrecoverable);

 for (ULONG count = 1; count <= 4; count++)
   if (!VSet.setItem(3, count, color[count-1]))
     OThrowPM("Could not set color.", 0, OException::unrecoverable);
 
 centerDlg();
 showDlg();
}
コード例 #4
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static HBITMAP hbm ;
     HPS            hps ;
     RECTL          rcl ;

     switch (msg)
          {
          case WM_CREATE:
               hps = WinGetPS (hwnd) ;
               hbm = GpiLoadBitmap (hps, 0, IDB_HELLO, 0L, 0L) ;
               WinReleasePS (hps) ;
               return 0 ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULLHANDLE, NULL) ;
               GpiErase (hps) ;

               WinQueryWindowRect (hwnd, &rcl) ;

               if (hbm)
                    WinDrawBitmap (hps, hbm, NULL, (PPOINTL) &rcl,
                                   CLR_BACKGROUND, CLR_NEUTRAL, DBM_STRETCH) ;

               WinEndPaint (hps) ;
               return 0 ;

          case WM_DESTROY:
               if (hbm)
                    GpiDeleteBitmap (hbm) ;               
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
コード例 #5
0
void        InitSort( HWND hwnd)

{
    HPS         hps;

    // load the sort menu's custom checkmarks
    hps = WinGetPS( hwnd);
    if (hps)
    {
        hUpBmp = GpiLoadBitmap( hps, 0, IDB_UPBMP, 0, 0);
        hDownBmp = GpiLoadBitmap( hps, 0, IDB_DOWNBMP, 0, 0);
        WinReleasePS( hps);
    }
    // if that failed, use the standard checkmark
    if (hUpBmp == 0)
        hUpBmp = WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK);
    if (hDownBmp == 0)
        hDownBmp = WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK);

    RestoreSort();
    InitSortMenu( hwnd);

    return;
}
コード例 #6
0
/*------------------------------------------------------------------------*/
MRESULT EXPENTRY SplashWndProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
{
   static HBITMAP hbm;
   static SWP     swp;
   HPS    hps;
   RECTL  rcl;

   switch(msg)
   {
      case WM_CREATE:
         hps = WinGetPS (hwnd);
         hbm = GpiLoadBitmap(hps,
                             (HMODULE)0L,
                             IDB_LOGO,
                             (ULONG)0,
                             (ULONG)0);
         WinReleasePS (hps);

         WinQueryWindowPos(hwnd, (PSWP)&swp);
         return (MRESULT)0;

      case WM_PAINT:
         hps = WinBeginPaint (hwnd, 
                              NULLHANDLE,  /* Get a cached PS */
                              (RECTL *)0);
         GpiErase (hps);
         
         GpiCreateLogColorTable (hps, LCOL_RESET, LCOLF_RGB,
                                 0L, 0L, NULL) ;
         rcl.xLeft   = 0;
         rcl.yBottom = 0;
         rcl.xRight  = swp.cx;
         rcl.yTop    = swp.cy;

         if ( hbm )
            WinDrawBitmap(hps,hbm, NULL, (PPOINTL) &rcl,
                          CLR_NEUTRAL, CLR_BACKGROUND, DBM_STRETCH );

         WinDrawBorder(hps, &rcl,2L,2L,0L, 0L, DB_DEPRESSED);
         WinEndPaint(hps);
         return (MRESULT)0;


   }
   return( WinDefWindowProc(hwnd, msg, mp1, mp2) );
}
コード例 #7
0
void XBitmap::Load( const ULONG id, const XResourceLibrary * lib)
{
   if (hbm)
      GpiDeleteBitmap(hbm);
   if (owner && hps == 0)
      hps = WinGetPS(owner->GetHandle());
   hbm = GpiLoadBitmap(hps, lib->GetModuleHandle(), id, 0, 0);

   if (hbm == GPI_ERROR)
   {
       ULONG error = WinGetLastError(XApplication::GetApplication()->GetAnchorBlock());
      OOLThrow("couldnït load bitmap", error);
   }

   XSize s;
   GetDimensions(&s);
   width = cx = s.GetWidth();
   height = cy = s.GetHeight();
}
コード例 #8
0
ファイル: pmgame.cpp プロジェクト: kidaa/BermudaTriangle
VOID GRAPHBOARD::DrawPMMark( const HPS hps, const char Row, const char Col )
{
    POINTL Point;
    ULONG Bitmap;
    HBITMAP hbm;

    if( GetDiscovered( Row, Col ) != -1 ) return;
    if( GetMarked( Row, Col ) ) Bitmap = BMP_UNMARK;
    else Bitmap = BMP_MARK;
    Point.x = LowerLeftPlace.x + (Col - 1)*dist - dist/6;
    Point.y = LowerLeftPlace.y + (Row - 1)*dist - dist/6;
    hbm = GpiLoadBitmap( hps, (HMODULE)NULL, Bitmap, dist/3, dist/3);
//	if( hbm == NULLHANDLE ) DosBeep( 500, 150 );
//	if( !(WinDrawBitmap( hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL ) ))
//		DosBeep( 1000, 150 );
    WinDrawBitmap(hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL);
    GpiDeleteBitmap( hbm );		// releases the bitmap-handle
    ToggleMarked( Row, Col );
}
コード例 #9
0
ファイル: pmgame.cpp プロジェクト: kidaa/BermudaTriangle
VOID GRAPHBOARD::DrawPMPlace( const HPS hps, const char Row,
										const char Col, INT Value,
										const BOOL fSwap )
{
    POINTL Point;
    ULONG Bitmap;
    HBITMAP hbm;

    Point.x = LowerLeftPlace.x + (Col - 1)*dist - dist/3;
    Point.y = LowerLeftPlace.y + (Row - 1)*dist - dist/3;
    if( !fSwap ){
	if( Value >= 50 ) Value -= 50;
	else if(Value <= 4 ) Value += 50;
    }
				// fSwap indicates if a number
				// will be swapped into a circle or vice versa
    if ( Value >= 50 ) {	// a number has already been found and will be
				// replaced by a circle now
	Bitmap = BMP_FCIRCLE;
	SetDiscovered( Row, Col, (SHORT)(Value - 50) );
    } else {
	switch( Value ){
	case 0: Bitmap = BMP_F0; break;
	case 1: Bitmap = BMP_F1; break;
	case 2: Bitmap = BMP_F2; break;
	case 3: Bitmap = BMP_F3; break;
	case 4: Bitmap = BMP_F4; break;
	default: Bitmap = BMP_SHIP;
	}
	if( Value != GetShipNumber() + 10 )
	    SetDiscovered( Row, Col, (SHORT)(Value + 50) );
    }
    hbm = GpiLoadBitmap( hps, (HMODULE)NULL, Bitmap, dist*2/3, dist*2/3);
//	if( hbm == NULLHANDLE ) DosBeep( 500, 150 );
//	if( !(WinDrawBitmap( hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL ) ))
//		DosBeep( 1000, 150 );
    WinDrawBitmap(hps, hbm, NULL, &Point, 0, 0, DBM_NORMAL);
    GpiDeleteBitmap( hbm );		// releases the bitmap-handle
}