/*********************************************************************
*
* FUNCTION NAME: ShowFrameControls
*
* DESCRIPTION:
*
*
* INPUT PARAMETERS:
*     None.
*
* OUTPUT PARAMETERS:
*     None.
*
*********************************************************************/
VOID ShowFrameControls (VOID)
{
    RECTL rclTitlebar, rclMenu;

    /* Increase the height of the frame now and titlebar are back */
	 WinQueryWindowRect (hwndMenu, &rclMenu);
	 WinQueryWindowRect (hwndTitlebar, &rclTitlebar);
	 gsFrameHeight += (SHORT)((rclTitlebar.yTop - rclMenu.yBottom) +
	 							  	(rclMenu.yTop - rclMenu.yBottom));
    WinSetWindowPos (hwndDefFrame, HWND_TOP, 0, 0,
                     gsFrameWidth,
                     gsFrameHeight,
                     SWP_SIZE);

	 /* Make the parent of the windows the frame to reenable them */
    WinSetParent (hwndTitlebar, hwndDefFrame, FALSE);
    WinSetParent (hwndSysmenu, hwndDefFrame, FALSE);
    WinSetParent (hwndMinmax, hwndDefFrame, FALSE);
    WinSetParent (hwndMenu, hwndDefFrame, FALSE);

    WinSendMsg (hwndDefFrame, WM_UPDATEFRAME,
                MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX | FCF_MENU),
                MPVOID);
    WinInvalidateRect (hwndDefFrame, NULL, TRUE);
}
//----------------------------------------------------------------------------
// NPP_SetWindow:
//----------------------------------------------------------------------------
NPError NP_LOADDS
NPP_SetWindow(NPP instance, NPWindow* window) {
  pprintf( szPPR, "NPP_SetWindow\n\r" );
  if ( instance == 0 ) return NPERR_INVALID_INSTANCE_ERROR;

  PluginInstance* This = (PluginInstance*) instance->pdata;

  //
  // *Developers*: Before setting fWindow to point to the
  // new window, you may wish to compare the new window
  // info to the previous window (if any) to note window
  // size changes, etc.
  //

  // if window handle changed
  if ( This->hWnd != (HWND)window->window ) {
    pprintf( szPPR, "HWND (hmf %x) changed, %x --> %x\n\r", This->hmf, (int)This->hWnd, (int)window->window );
    // remember the new window
    This->fWindow = window;
    if ( This->hWnd ) {
      // Remove the subclass for the old client window
      WinSubclassWindow(This->hWnd, This->lpfnOldWndProc);
    }
    // remember the new window handle
    This->hWnd = (HWND)This->fWindow->window;
    // subclass the window
    This->lpfnOldWndProc = WinSubclassWindow(This->hWnd, SubClassFunc);
    AssociateInstance( This->hWnd, This );
    /* paint a background for the drawing */
    WinQueryWindowRect( This->hWnd, &This->rclWnd );
//    WinFillRect( This->hps, &This->rclWnd, CLR_PALEGRAY );
    // destroy old PS and create new PS
    if ( This->hps ) GpiDestroyPS( This->hps );
    HDC hdc = WinQueryWindowDC( This->hWnd );
    if ( !hdc ) hdc = WinOpenWindowDC( This->hWnd );
    SIZEL siz={ 0, 0 };
    HAB hab=WinQueryAnchorBlock( This->hWnd );
    This->hps = GpiCreatePS( hab, hdc, &siz,
                                  PU_PELS | GPIT_NORMAL | GPIA_ASSOC );
    pprintf( szPPR, "GpiCreatePS, hdc=%x, hps=%x\n\r", (int)hdc, (int)This->hps );
    if ( !This->hps ) {
      pprintf( szPPR, "GpiCreatePS failed, Err=%x\n\r",
        WinGetLastError( hab ) );
    }
    SetTransform( This, This->hps, &This->rclWnd );
  } else { // check if window coordinates changed.
           //It may happens for full-screan
    RECTL rcl;
    WinQueryWindowRect( This->hWnd, &rcl );
    if ( memcmp( &This->rclWnd, &rcl, sizeof( rcl ) ) ) {
      pprintf( szPPR, "Rect (hmf %x) changed, ( %d, %d ) - ( %d, %d ) --> ( %d, %d ) - ( %d, %d )\n\r",
        This->hmf,
        This->rclWnd.xLeft, This->rclWnd.yBottom, This->rclWnd.xRight, This->rclWnd.yTop,
        rcl.xLeft, rcl.yBottom, rcl.xRight, rcl.yTop );
      memcpy( &This->rclWnd, &rcl, sizeof( rcl ) );
      SetTransform( This, This->hps, &This->rclWnd );
    }
  }
  return NPERR_NO_ERROR;
}
void CenterWindow(HWND hwnd)
{
    RECTL           rclParent;
    RECTL           rclWindow;

    WinQueryWindowRect(hwnd, &rclWindow);
    WinQueryWindowRect(WinQueryWindow(hwnd, QW_PARENT), &rclParent);

    rclWindow.xLeft = (rclParent.xRight - rclWindow.xRight) / 2;
    rclWindow.yBottom = (rclParent.yTop - rclWindow.yTop) / 2;

    WinSetWindowPos(hwnd, NULLHANDLE, rclWindow.xLeft, rclWindow.yBottom,
                    0, 0, SWP_MOVE | SWP_SHOW);
}
Beispiel #4
0
 int icqskin_autoSize(HWND hwnd, short x, short y, short cx, short cy, short baseCy)
 {
    RECTL rcl;
    WinQueryWindowRect( WinQueryWindow(hwnd, QW_OWNER), &rcl);

    if(cx < 0)
       cx = rcl.xRight + cx;

    if( ((USHORT) cy) == 0xFFFF)
       cy = baseCy;
    else if(cy < 0)
       cy = rcl.yTop + cy;

    if(x < 0)
       x = (rcl.xRight + x) - cx;

    if(y < 0)
       y = (rcl.yTop + y) - cy;

    if( cx != (rcl.xLeft - rcl.xRight) || cy != (rcl.yTop - rcl.yBottom))
    {
       WinSetWindowPos(hwnd, 0, x, y, cx, cy, SWP_SIZE|SWP_MOVE);
       WinInvalidateRect(hwnd,NULL,FALSE);
       return TRUE;
    }

    return FALSE;
 }
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     {
     static BOOL fFlipFlop ;
     HPS         hps ;
     RECTL       rcl ;

     switch (msg)
          {
          case WM_TIMER:
               WinAlarm (HWND_DESKTOP, WA_NOTE) ;
               fFlipFlop = !fFlipFlop ;
               WinInvalidateRect (hwnd, NULL, FALSE) ;
               return 0 ;

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

               WinQueryWindowRect (hwnd, &rcl) ;
               WinFillRect (hps, &rcl, fFlipFlop ? CLR_BLUE : CLR_RED) ;

               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Beispiel #6
0
BOOL TrackChildWindow(HAB hab,HWND hwnd,PRECTL prcl,LONG flMoveFrom)
  {

  WinCopyRect(hab,&stColTrack.rclTrack,prcl);

  WinQueryWindowRect(hwndClient,&stColTrack.rclBoundary);
#ifdef this_junk
          stColTrack.cxBorder = 4;
          stColTrack.cyBorder = 4;
          stColTrack.cxGrid = stCell.cx;
          stColTrack.cyGrid = stCell.cy;
          stColTrack.cxKeyboard = stCell.cx;
          stColTrack.cyKeyboard = stCell.cy;
          stColTrack.ptlMinTrackSize.x = (stCell.cx * 4);
          stColTrack.ptlMinTrackSize.y = (stCell.cy * 3);
  stColTrack.ptlMaxTrackSize.x = (stCell.cx * (stRead.lCharWidth + stWrite.lCharWidth - 4));
  stColTrack.ptlMaxTrackSize.y = (stCell.cy * stRead.lCharHeight);
#endif

  stColTrack.fs = (flMoveFrom | TF_ALLINBOUNDARY | TF_SETPOINTERPOS | TF_GRID);

  if (!WinTrackRect(hwnd,0L,&stColTrack))
    return(FALSE);
  WinCopyRect(hab,prcl,&stColTrack.rclTrack);
  return(TRUE);
  }
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) ;
     }
Beispiel #8
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, ULONG msg, 
                                        MPARAM mp1, MPARAM mp2)

{
HPS hps;
RECTL rcl;

switch (msg)
    {
    case WM_CREATE:
        return 0;

    case WM_PAINT:
        hps=WinBeginPaint(hwnd, NULLHANDLE, NULL);
        WinQueryWindowRect(hwnd, &rcl);
        GpiErase(hps);
        WinFillRect(hps, &rcl, CLR_BLUE);
        PaintClient(hps, 100, 100);

        WinEndPaint(hps);
        return 0;

    case WM_DESTROY:
        return 0;
    }
return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Beispiel #9
0
/****************************************************************\
 *  Name:UpdateScreen()
 *
 *  Purpose: Update the screen area.
\****************************************************************/
VOID UpdateScreen (RECTL *prclUpdate)
{
    POINTL aptl[3];

    if ( prclUpdate != NULL)
    {
        aptl[0].x = prclUpdate->xLeft;
        aptl[0].y = prclUpdate->yBottom;
        aptl[1].x = prclUpdate->xRight;
        aptl[1].y = prclUpdate->yTop;
        aptl[2].x = prclUpdate->xLeft;
        aptl[2].y = prclUpdate->yBottom;
    }
    else
    {
        WinQueryWindowRect (hwndMain, (PRECTL)aptl);
        aptl[2].x = aptl[2].y = 0;
    }

    // als letzten Parameter mal 0L einsetzen? (war so in clock)
    if( GpiBitBlt( hpsGlob, hpsBufferGlob, 3L, aptl, ROP_SRCCOPY,
		   BBO_IGNORE ) == GPI_ERROR )
	wcprintf(" BitBlt error!");

}
Beispiel #10
0
 static void loadSkin(HWND hwnd, const char *name, SKINFILESECTION *fl)
 {
    static const char *pallete[ICQCLR_COUNTER]     = { STANDARD_SKIN_PALLETE_NAMES };
#ifdef SKINNED_GUI
    static const char *names[ICQFRAME_SKINBITMAPS] = { STANDARD_FRAME_ELEMENTS     };
#endif

    ICQFRAME          *cfg = WinQueryWindowPtr(hwnd,0);
    RECTL             rcl;

#ifdef SKINNED_GUI
    const char        *ptr;
    int               f;

    for(f=0;f<ICQFRAME_SKINBITMAPS;f++)
    {
       ptr = icqskin_getSkinFileEntry(fl, name, names[f]);
       icqskin_loadImage(cfg->icq, ptr, &cfg->img[f], &cfg->msk[f]);
    }
#endif

    icqskin_loadSkinPallete(hwnd, name, fl, pallete, ICQCLR_COUNTER, cfg->pal);

    WinQueryWindowRect( hwnd, &rcl);
    resize(hwnd,rcl.xRight-rcl.xLeft,rcl.yTop-rcl.yBottom);

 }
Beispiel #11
0
void ReflowText(HWND hwnd, PVIEWERPARAMS pViewerParams)
{
   RECTL rectl;

   FreeLines(pViewerParams);

   WinQueryWindowRect(hwnd, &rectl);

   if ((rectl.xRight-rectl.xLeft) <=5  ||
       (rectl.yTop-rectl.yBottom) <=5)
      return;

   if (pViewerParams->pchMessageText)
   {
      LONG lMaxWidth =pViewerParams->recWindow.xRight-pViewerParams->recWindow.xLeft-2*pViewerParams->lBorder;
      PVIEWERLINE pLines;

      pLines = SegmentText(pViewerParams, pViewerParams->pchMessageText, pViewerParams->bHighlight);

      if (pLines)
      {
         ULONG ulLongestSeg;

         WrapSegments(pViewerParams, pLines, lMaxWidth);
         ConvertSegments(pViewerParams, pLines, &ulLongestSeg);
         pViewerParams->pIncrements = malloc(sizeof(LONG) * ulLongestSeg);
      }
   }

   return;
}
/****************************************************************************
   SysMenu Dialog Procedure
*****************************************************************************/
MRESULT EXPENTRY SysMenuProc (HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    {
        BOOL    Handled = TRUE;
        MRESULT mReturn  = 0;
        RECTL   Rectl;
        POINTL  Pointl;
        ULONG   temp;
        HPS     hps;
        HBITMAP hbm;

        switch (msg)
            {
                case    WM_PAINT:
                    hps = WinBeginPaint(hWnd, 0, 0);
                    WinQueryWindowRect(hWnd,&Rectl);
                    WinFillRect(hps, &Rectl, CLR_BLACK);
                    hbm = PointerInfo.hbmMiniColor;
                    WinInflateRect(hab, &Rectl, -1L, -1L);
                    WinDrawBitmap(hps, hbm, NULL, (PPOINTL)&Rectl, 0L, 0L, DBM_NORMAL);
                    WinEndPaint(hps);
                    break;
                case WM_ERASEBACKGROUND:
                    WinFillRect((HPS)LONGFROMMP(mp1),PVOIDFROMMP(mp2),CLR_BLACK);
                    mReturn = MRFROMLONG(1L);
                    break;
                default:
                    Handled = FALSE;
                    break;
            }
        if (!Handled) mReturn =  (*SysMenuDefProc)(hWnd, msg, mp1, mp2);
        return (mReturn);
    }
Beispiel #13
0
gfxOS2Surface::gfxOS2Surface(HWND aWnd)
    : mWnd(aWnd), mDC(nullptr), mPS(nullptr), mBitmap(nullptr)
{
#ifdef DEBUG_thebes_2
    printf("gfxOS2Surface[%#x]::gfxOS2Surface(HWND=%#x)\n", (unsigned int)this,
           (unsigned int)aWnd);
#endif

    RECTL rectl;
    WinQueryWindowRect(aWnd, &rectl);
    mSize.width = rectl.xRight - rectl.xLeft;
    mSize.height = rectl.yTop - rectl.yBottom;
    if (mSize.width == 0) mSize.width = 1;   // fake a minimal surface area to let
    if (mSize.height == 0) mSize.height = 1; // cairo_os2_surface_create() return something

    // This variation on cairo_os2_surface_create() avoids creating a
    // persistent HPS that may never be used.  It also enables manual
    // refresh so nsWindow::OnPaint() controls when the screen is updated.
    cairo_surface_t *surf =
        cairo_os2_surface_create_for_window(mWnd, mSize.width, mSize.height);
#ifdef DEBUG_thebes_2
    printf("  type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf,
           cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height);
#endif

    Init(surf);
}
VOID
WgtPaint( HWND hwnd, PXCENTERWIDGET pWidget )
{
  ULONG cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON ) / 2;
  ULONG cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON ) / 2;

  HPS hps = WinBeginPaint( hwnd, NULLHANDLE, NULL );

  if( hps )
  {
    RECTL rclWin;
    int   x, y;

    // Get windows size
    WinQueryWindowRect( hwnd, &rclWin );

    // Fill background
    WinFillRect( hps, &rclWin, CLR_PALEGRAY );

    // Center icon in window
    y = rclWin.yTop - rclWin.yBottom;
    x = rclWin.xRight - rclWin.xLeft;

    y = ( y - cy_icon ) / 2;
    x = ( x - cx_icon ) / 2;

    // Draw icon in window
    WinDrawPointer( hps, x, y, ico_tasks, DP_MINI );
    WinEndPaint( hps );
  }
}
Beispiel #15
0
MRESULT mainwmPaint(HWND hwnd,MPARAM mp1,MPARAM mp2)
{
HPS hps;
RECTL rectlEntire,rectlUpdate;
char str[203];

	hps=WinBeginPaint(hwnd, NULLHANDLE, &rectlUpdate);
#ifdef DEBUG
	assert(hps!=NULLHANDLE);
#endif
	if (hps==NULLHANDLE) return 0;

	WinQueryWindowRect(hwnd,&rectlEntire);

	GpiSetBackMix(hps,BM_OVERPAINT);

	WinQueryWindowText(hwndHEF1,201,str);
//	printf("%d\n",strlen(str));
	strcat(str,"  ");
	HanOut(hps,0,100,str);
	WinQueryWindowText(hwndHEF2,201,str);
	strcat(str,"  ");
	HanOut(hps,0,80,str);

	WinEndPaint(hps);
	return 0L;
}
Beispiel #16
0
VOID DrawClock (HPS hpsDraw)
{
    RECTL rcl;

    WinQueryWindowRect (hwndClient, &rcl);
    WinFillRect (hpsBuffer, &rcl, cp.clrBackground);

    /* draw the face, the hour hand, and the minute hand */

    ClkDrawRing (hpsDraw);
    ClkDrawFace (hpsDraw);
    ClkDrawDate (hpsDraw, DM_REDRAW);
    ClkDrawHand (hpsDraw, HT_HOUR_SHADE, dt.hours);
    ClkDrawHand (hpsDraw, HT_MINUTE_SHADE, dt.minutes);
    ClkDrawHand (hpsDraw, HT_HOUR, dt.hours);
    ClkDrawHand (hpsDraw, HT_MINUTE, dt.minutes);

    /* draw the tick marks */
    if ((cp.usMajorTickPref == CLKTM_ALWAYS) ||
	    ((cp.usMajorTickPref == CLKTM_NOTICONIC) && ! fIconic))
	ClkDrawTicks (hpsDraw, CLK_MAJORTICKS);

    if ((cp.usMinorTickPref == CLKTM_ALWAYS) ||
	    ((cp.usMinorTickPref == CLKTM_NOTICONIC) && !fIconic))
	ClkDrawTicks (hpsDraw, CLK_MINORTICKS);
}
/*------------------------------------------------------------------------*/
void PaperSetSize(WINDOWINFO *pwi,USHORT usWidth, USHORT usHeight)
{
   HWND   hwndframe;
   HWND   hParent;
   POINTL ptl;
   RECTL  rcl;
   LONG   x,y,cx,cy;

   hwndframe = WinQueryWindow(pwi->hwndClient,QW_PARENT);
   hParent   = WinQueryWindow(hwndframe,QW_PARENT); /* canvas */

   WinQueryWindowRect(hParent,&rcl);

   view.iZoom = 0;

   pwi->usFormWidth   = usWidth;
   pwi->usFormHeight  = usHeight;
   pwi->usWidth       = usWidth;
   pwi->usHeight      = usHeight;

   ptl.x = usWidth;
   ptl.y = usHeight;
   GpiConvert(pwi->hps,CVTC_DEFAULTPAGE,CVTC_DEVICE,1,(POINTL *)&ptl);

   cx = ptl.x;
   cy = ptl.y;
   pwi->cxClient = cx;
   pwi->cyClient = cy;
   pwi->cxClnt   = cx;
   pwi->cyClnt   = cy;

   /*
   ** If paperwidth is smaller than the window wherein it is drawn
   ** than try to center it in the x-direction.
   ** Else simply begin at zero.
   */
   if (cx < rcl.xRight)
   {
      x = (rcl.xRight - cx)/2;
   }
   else
      x = 0;

   if (cy < rcl.yTop)
   {
      y = (rcl.yTop - cy)/2;
   }
   else
   {
      y = rcl.yTop - cy;
   }
   view.sVscrollPos = 0;
   view.sHscrollPos = 0;
   CanvScrollBar(pwi,FALSE);
   WinSetWindowPos(hwndframe,(HWND)0,x,y,cx,cy,SWP_MOVE | SWP_SIZE);

   return;
}
Beispiel #18
0
/*
 * _NewWindow - create a new window
 */
unsigned _NewWindow( char *name, ... )
{
    LPWDATA     w;
    MENUITEM    menus;
    HWND        hwnd,frame,temp;
    char        str[80];
    int         x1,x2,y1,y2;
    ULONG       style;
    RECTL       rcl;
    va_list     al;

    _GetWindowNameAndCoords( name, str, &x1, &x2, &y1, &y2 );

    style = FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX |
            FCF_VERTSCROLL;
    frame = WinCreateStdWindow( _MainWindow,
                WS_VISIBLE | WS_CLIPSIBLINGS,
                &style, _ClassName, str, 0, NULL, 0, &hwnd );
    if( frame == 0 ) return( FALSE );
    WinSetOwner( hwnd, _MainWindow );

    va_start( al, name );
    w = _AnotherWindowData( hwnd, al );
    w->frame = frame;
    w->text_color = CLR_WHITE;
    w->background_color = CLR_BLACK;
    WinSendMsg( frame, WM_SETICON,
        MPFROMLONG( WinQuerySysPointer( HWND_DESKTOP, SPTR_APPICON, TRUE ) ), 0 );
    WinSetWindowBits( WinWindowFromID( w->frame, FID_VERTSCROLL ), QWL_STYLE,
                        SBS_AUTOTRACK, SBS_AUTOTRACK );

    _CreateFont( w );
    _PositionScrollThumb( w );
    WinQueryWindowRect( _MainWindow, &rcl );
    WinSetWindowPos( frame, HWND_TOP,
                x1*w->xchar,
                (rcl.yTop - rcl.yBottom)-y1*w->ychar-y2*w->ychar,
                x2*w->xchar,
                y2*w->ychar,
                SWP_SIZE | SWP_MOVE | SWP_ZORDER );

    menus.iPosition = _MainWindowData->window_count - 1;
    menus.afStyle = MIS_TEXT;
    menus.afAttribute = 0;
    menus.id = DID_WIND_STDIO + w->handles[0];
    menus.hwndSubMenu = NULL;
    menus.hItem = 0;
    if ( MIT_ERROR == (BOOL)WinSendMsg( menuHandle, ( ULONG )MM_INSERTITEM, MPFROMP( &menus ), MPFROMP( str ) ) ) abort();
    temp = WinWindowFromID( frame, FID_SYSMENU );
    WinSendMsg( temp, MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, TRUE),
                               MPFROMP((PSZ)&menus) );
    WinSendMsg( menus.hwndSubMenu, MM_DELETEITEM, MPFROM2SHORT( SC_CLOSE, TRUE ), 0 );
    WinUpdateWindow( hwnd );
    WinSetFocus( HWND_DESKTOP, hwnd );
    return( TRUE );

} /* _NewWindow */
Beispiel #19
0
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
   HPS      hps;
   RECTL    rcl;
   static ULONG    i = 1;
   ULONG    ulMem;
   char     szBuf[200];

   switch (msg) {
      case WM_CREATE:
         /* use smaller text */
         WinSetPresParam(hwnd, PP_FONTNAMESIZE, 7, (PVOID)"8.Helv");
         /* start the timer (ticks each 0.5 sec.) */
         AddFloat(WinQueryWindow(hwnd, QW_PARENT));
         WinStartTimer(hab, hwnd, ID_TIMER, 500);
         break;

      /* make window always stay on top (if desired) */
      case WM_VRNENABLED:
         if (bFloat)
            WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER);
         break;

      case WM_COMMAND:  /* why doesn't WM_SYSCOMMAND work? */
         if (LOUSHORT(mp1) == IDM_FLOAT) {
            bFloat = !bFloat;
            WinCheckMenuItem(hwndSysSubmenu, IDM_FLOAT, bFloat);
         }
         break;

      case WM_TIMER:
         if (++i > 13)
            i = 1;
         WinInvalidateRect(hwnd, NULL, FALSE);
         return FALSE;

      case WM_PAINT:
         hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl);
         /* necessary to avoid incorrectly repainting window */
         WinQueryWindowRect(hwnd, &rcl);

/*         sprintf(szBuf, " Current use %dK  Maximum ever used %dK  Errors %d",
                 meminfo->used / 1024,
                 meminfo->maxused / 1024, meminfo->num_err);*/
         sprintf(szBuf, " Current use %dB  Maximum ever used %dK  Errors %d",
                 meminfo->used,
                 meminfo->maxused / 1024, meminfo->num_err);
         WinDrawText(hps, -1, szBuf, &rcl, CLR_BLACK, CLR_WHITE,
                     DT_CENTER | DT_VCENTER | DT_ERASERECT);

         WinEndPaint(hps);
         break;
   }

   return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
Beispiel #20
0
QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
{
    QPixmap pm;

    if (w == 0 || h == 0)
        return pm;

    RECTL rcl;
    if (!WinQueryWindowRect(winId, &rcl))
        return pm;

    if (w < 0)
        w = rcl.xRight;
    if (h < 0)
        h = rcl.yTop;

    // flip y coordinate
    y = rcl.yTop - (y + h);

    HPS hps = qt_alloc_mem_ps(w, h);
    if (hps == NULLHANDLE)
        return pm;

    HBITMAP hbm = NULLHANDLE;

    // bitmap header + 2 palette entries (for the mask)
    BITMAPINFOHEADER2 bmh;
    bmh.cbFix = sizeof(BITMAPINFOHEADER2);

    // create the uninitialized bitmap to hold window pixels
    bmh.cx = w;
    bmh.cy = h;
    bmh.cPlanes = 1;
    bmh.cBitCount = 32;
    hbm = GpiCreateBitmap(hps, &bmh, 0, 0, 0);

    if (hbm != NULLHANDLE) {
        GpiSetBitmap(hps, hbm);
        HPS hpsWin = WinGetPS(winId);
        if (hpsWin != NULLHANDLE) {
            POINTL pnts[] = { {0, 0}, {w, h}, {x, y} };
            if (GpiBitBlt(hps, hpsWin, 3, pnts,
                          ROP_SRCCOPY, BBO_IGNORE) != GPI_ERROR) {
                GpiSetBitmap(hps, NULLHANDLE);
                pm = fromPmHBITMAP(hbm);
            }
            WinReleasePS(hpsWin);
        }
        GpiDeleteBitmap(hbm);
    }

    qt_free_mem_ps(hps);

    return pm;
}
Beispiel #21
0
/*
 * _ShiftWindow - move current window up/down
*/
void _ShiftWindow( LPWDATA w, int diff )
{
    HWND        hwnd;
    int         amt;
    LPSTR       txt_s,txt_d;
    int         i,sline,eline,add;

    hwnd = w->hwnd;
    amt = -diff*w->ychar;

#if defined( __OS2__ )
    {
        RECTL       rcl;

        WinQueryWindowRect( hwnd, &rcl );
        WinScrollWindow( hwnd, 0, -amt, NULL, &rcl, NULL, NULL, SW_INVALIDATERGN );
    }
#else
    {
        RECT        rect;

        GetClientRect( hwnd, &rect );
        i = (rect.bottom + 1) / w->ychar;
        rect.bottom = i * w->ychar;
        ScrollWindow( hwnd, 0, amt, NULL, &rect );
    }
#endif

    if( diff < 0 ) {
        sline = w->height - 3 + diff;
        if( sline < 0 )
            sline = 0;
        eline = 0;
        add = -1;
    } else {
        sline = diff;
        eline = w->height - 1;
        if( eline < sline )
            eline = sline;
        add = 1;
    }
    i = sline;
    while( i != eline ) {
        txt_s = (LPSTR)&w->image[i * w->width];
        txt_d = (LPSTR)&w->image[(i - diff) * w->width];
#ifdef _MBCS
        FARmemcpy( txt_d, txt_s, sizeof( mb_char ) * w->width );
#else
        FARmemcpy( txt_d, txt_s, w->width );
#endif
        i += add;
    }

} /* _ShiftWindow */
void mwpSize(HWND hWnd)
{
   RECTL    rect;
   ULONG    fl = SWP_SIZE | SWP_MOVE;

   WinQueryWindowRect(hWnd, &rect);

   WinSetControlRelPos(WinWindowFromID(hWnd, PB_PROGRESS), HWND_TOP, &rect, 0.00, 0.40, 1.00, 1.00, fl, 0, 5, -5, -5);
   WinSetControlRelPos(WinWindowFromID(hWnd, ST_VOLUME),   HWND_TOP, &rect, 0.00, 0.00, 0.10, 0.40, fl, 5, 5,  0, -5);
   WinSetControlRelPos(WinWindowFromID(hWnd, SLRD_VOLUME), HWND_TOP, &rect, 0.10, 0.00, 1.00, 0.40, fl, 0, 5, -5, -5);
}
// Frame_window - окно рамки, Window - окно, которое надо проверить.
VOID Diver_CheckWindowFrame( HWND Frame_window, HWND Window )
{
 // Узнаем размер окна рамки.
 RECT Frame_rectangle = {0}; WinQueryWindowRect( Frame_window, &Frame_rectangle );

 // Проверяем рамку.
 if( PermissionForInnerFrameDrawing( Frame_window, Window, &Frame_rectangle ) )
  Diver_CheckWindowFrameDrawingNode( Frame_window );

 // Возврат.
 return;
}
Beispiel #24
0
/*
 * _ClearWindow - erase a window
 */
void _ClearWindow( LPWDATA w )
{
    HWND        hwnd;

    hwnd = w->hwnd;

    /*** Clear the w->image array ***/
#ifdef _MBCS
    {
        mb_char         mbc;
        int             count;

        mbc = _mbsnextc( (unsigned char *)" " );
        for( count=0; count < w->width * w->height; count++ ) {
            w->image[count] = mbc;              /* store space in w->image */
        }
    }
#else
    FARmemset( w->image, 0x20, w->width*w->height );
#endif

#if defined( __OS2__ )
    {
        HPS     ps;
        RECTL   rcl;

        ps = WinGetPS( hwnd );
        WinQueryWindowRect( hwnd, &rcl );
        WinFillRect( ps, &rcl, CLR_WHITE );
        WinReleasePS( ps );
    }
#else
    {
        RECT    rect;
        HDC     dc;

        dc = GetDC( hwnd );
    #ifndef __NT__
        UnrealizeObject( w->brush );
    #endif
        SelectObject( dc, w->brush );
    #ifdef __NT__
        SetBrushOrgEx( dc, 0, 0, NULL  );
    #endif
        GetClientRect( hwnd, &rect );
        FillRect( dc, &rect, w->brush );
        ReleaseDC( hwnd, dc );
    }
#endif

} /* _ClearWindow */
Beispiel #25
0
/**************************************************************************
*
* FUNCTION NAME: HideFrameControls
*
* DESCRIPTION:
*
*
* INPUT PARAMETERS:
*     None.
*
* OUTPUT PARAMETERS:
*     None.
*
**************************************************************************/
VOID HideFrameControls (VOID)
{
    RECTL rclTitlebar, rclMenu;

	 /* Make the parent of the frames HWND_OBJECT to effectively remove them */
    WinSetParent (hwndTitlebar, HWND_OBJECT, FALSE);
    WinSetParent (hwndSysmenu, HWND_OBJECT, FALSE);
    WinSetParent (hwndMinmax, HWND_OBJECT, FALSE);
    WinSetParent (hwndMenu, HWND_OBJECT, FALSE);
    WinSendMsg (hwndDefFrame, WM_UPDATEFRAME,
                MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX | FCF_MENU),
                MPVOID);

    /* Reduce the height of the frame once menu and titlebar are gone */
	 WinQueryWindowRect (hwndMenu, &rclMenu);
	 WinQueryWindowRect (hwndTitlebar, &rclTitlebar);
	 gsFrameHeight -= (SHORT)((rclTitlebar.yTop - rclMenu.yBottom) +
	 							  	(rclMenu.yTop - rclMenu.yBottom));
    WinSetWindowPos (hwndDefFrame, HWND_TOP, 0, 0,
                     gsFrameWidth,
                     gsFrameHeight,
                     SWP_SIZE);
}
/* Dialog-Procedure f�r die AboutBox (OS/2-Standard) */
MRESULT EXPENTRY AboutBoxDlgProc(HWND hwnd, ULONG msg, MPARAM mp1,MPARAM mp2)
{
   HWND  TextPos;
   IString textstr;
   SHORT i;
   ULONG   ulScrWidth, ulScrHeight;
   RECTL   Rectl;
   SWP     Swp;
   HPS     hps;

   switch(msg) {
   case WM_PAINT:
      hps = WinBeginPaint (hwnd,0,0);
      WinQueryWindowRect (hwnd, &Rectl);
      WinFillRect (hps, &Rectl, SYSCLR_DIALOGBACKGROUND);
      Rectl.yTop -= WinQuerySysValue(HWND_DESKTOP,SV_CYTITLEBAR),

      WinDrawBorder (hps, &Rectl,
          WinQuerySysValue(HWND_DESKTOP,SV_CXDLGFRAME),
          WinQuerySysValue(HWND_DESKTOP,SV_CYDLGFRAME),
          CLR_DARKGRAY, CLR_WHITE, DB_RAISED);
      GpiMove (hps, (PPOINTL)&Rectl);
      Rectl.xRight--;
      Rectl.yTop--;
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_ACOPYRIGHTFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinQueryWindowPos (WinWindowFromID (hwnd, IDD_APROGRAMFRAME), &Swp);
      Rectl.xLeft   = Swp.x-1;
      Rectl.yBottom = Swp.y-1;
      Rectl.xRight  = Swp.x + Swp.cx + 1;
      Rectl.yTop    = Swp.y + Swp.cy + 1;
      WinDrawBorder (hps, &Rectl, 1L, 1L,
          CLR_DARKGRAY, CLR_WHITE, DB_DEPRESSED);
      WinEndPaint (hps);
      break;
   case WM_COMMAND:
     /* no matter what the command, close the dialog */
      WinDismissDlg(hwnd, TRUE);
      break;

   default:
      return(WinDefDlgProc(hwnd, msg, mp1, mp2));
   }
   return(MPVOID);
}  /* AboutBoxWndProc() */
/*@ XToolBar::Draw(void)
@group display
@remarks Redraw the toolbar.
*/
void XToolBar::Draw(void)
{
   RECTL rect;
   WinQueryWindowRect(winhandle, &rect);
   HPS hps = WinGetPS(winhandle);
   GpiCreateLogColorTable(hps, LCOL_RESET, LCOLF_RGB, 0,0,NULL);
   WinFillRect( hps, &rect, SYSCLR_BUTTONMIDDLE);
   WinDrawBorder(hps, &rect, 1,1,0,0,DB_PATCOPY|DB_RAISED);
   HENUM e;
   HWND hwnd;

   e = WinBeginEnumWindows(winhandle);
   while ((hwnd = WinGetNextWindow(e)) != 0)
      WinInvalidateRegion(hwnd, NULLHANDLE, TRUE);
   WinEndEnumWindows(e);
}
void OListBox::auto_scroll()
{
 FONTMETRICS FontMetrics;

 WinQueryWindowRect(hwnd, &rcl);
 hps = WinGetPS(hwnd);
 GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &FontMetrics);
 WinReleasePS(hps);
 if (queryItemCount() > ((rcl.yTop - rcl.yBottom) / FontMetrics.lMaxBaselineExt))
  {
   if ((rcl.yTop - rcl.yBottom) % FontMetrics.lMaxBaselineExt)
     setToTop(queryTopItem()+2); 
   else
     setToTop(queryTopItem()+1); 
  }
}
void checkScrollbars(WINDOWINFO *pwi, POINTL ptl)
{
   RECTL rcl;

   WinQueryWindowRect(view.hwndClient,&rcl);

   GpiConvert(pwi->hps,CVTC_DEFAULTPAGE,CVTC_DEVICE,1,&ptl);
   WinMapWindowPoints(pwi->hwndClient,view.hwndClient,&ptl,1);

   if (ptl.y < 0)
      WinSendMsg(view.hwndClient,WM_VSCROLL,(MPARAM)0,
                 MPFROM2SHORT(0,SB_LINEDOWN));
   if (ptl.x > rcl.xRight)
      WinSendMsg(view.hwndClient,WM_HSCROLL,(MPARAM)0,
                 MPFROM2SHORT(0,SB_LINERIGHT));
}
Beispiel #30
0
static VOID SizeBitmap(HWND hWnd)

{
BITMAPINFOHEADER bmp;		   /* Bitmap Information Header		*/
RECTL		 rcl;		   /* Window Rectangle			*/
LONG		 cx;		   /* Bitmap Width			*/
LONG		 cy;		   /* Bitmap Height			*/

WinQueryWindowRect(hWnd, &rcl);

GpiQueryBitmapParameters(hbmView, &bmp);

cx = (bmp.cx * lScale) / 100L;
cy = (bmp.cy * lScale) / 100L;

rclDest.xRight = (rclDest.xLeft	  = ((rcl.xRight - rcl.xLeft) /	2L) - (cx / 2L)) + cx;
rclDest.yTop   = (rclDest.yBottom = ((rcl.yTop - rcl.yBottom) /	2L) - (cy / 2L)) + cy;

rclImage.xRight	= (rclImage.xLeft   = ((rcl.xRight - rcl.xLeft)	/ 2L) -	(bmp.cx	* 4L)) + bmp.cx	* 8L;
rclImage.yTop	= (rclImage.yBottom = ((rcl.yTop - rcl.yBottom)	/ 2L) -	(bmp.cy	* 4L)) + bmp.cy	* 8L;

rclImage.xLeft	 -= 3L;
rclImage.yBottom -= 3L;
rclImage.xRight	 += 3L;
rclImage.yTop	 += 3L;
		       /* Form the final boundary points		*/

aptlArea[0].x =	rclDest.xLeft  - 2L;
aptlArea[0].y =	rclDest.yTop   + 2L;
aptlArea[1].x =	rclDest.xRight + 2L;
aptlArea[1].y =	rclDest.yTop   + 2L;

aptlArea[2].x =	rclDest.xRight	+ 2L;
aptlArea[2].y =	rclDest.yBottom	- 2L;
aptlArea[3].x =	rclDest.xLeft	- 2L;
aptlArea[3].y =	rclDest.yBottom	- 2L;

aptlArea[4].x =	rclDest.xLeft  - 1L;
aptlArea[4].y =	rclDest.yTop   + 1L;
aptlArea[5].x =	rclDest.xRight + 1L;
aptlArea[5].y =	rclDest.yTop   + 1L;

aptlArea[6].x =	rclDest.xRight	+ 1L;
aptlArea[6].y =	rclDest.yBottom	- 1L;
aptlArea[7].x =	rclDest.xLeft	- 1L;
aptlArea[7].y =	rclDest.yBottom	- 1L;
}