Ejemplo n.º 1
0
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 );
  }
}
Ejemplo n.º 2
0
VOID SETTINGS :: QueryWindowData (SWP *pswp, USHORT us[7], BOOL f)
{
    // FIXME puke, yukk, choke! get this flag thing away! do it better!
    // FIXME what is with US?
    if (f)
        memcpy (pswp, QueryBinary(SEI_SWPSSW), sizeof (SWP));
    else
        memcpy (pswp, QueryBinary(SEI_SWP), sizeof (SWP));

    LONG  cx, cy;
    cx = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);
    cy = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);

    if (pswp->cx < 32)
        pswp->cx = 32;
    // bigger than screen?
    if (pswp->cx > cx)
        pswp->cx = cx;
    // partly outside of screen?
    if (pswp->x+pswp->cx >= cx)
        pswp->x = cx-pswp->cx;
    if (pswp->cy < 32)
        pswp->cy = 32;
    // bigger than screen?
    if (pswp->cy > cy)
        pswp->cy = cy;
    // partly outside of screen?
    if (pswp->y+pswp->cy >= cy)
        pswp->y = cy-pswp->cy;
}
Ejemplo n.º 3
0
/*------------------------------------------------------------------------*/
MRESULT EXPENTRY ClientDlgProc(HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2)
{
   SWP   swp;
  
   switch(msg)
   {
      case WM_INITDLG:
         WinQueryWindowPos(hwnd, (PSWP)&swp);
         WinSetWindowPos(hwnd, HWND_TOP,
		       ((WinQuerySysValue(HWND_DESKTOP,	SV_CXSCREEN) - swp.cx) / 2),
		       ((WinQuerySysValue(HWND_DESKTOP,	SV_CYSCREEN) - swp.cy) / 2),
		       0, 0, SWP_MOVE);
         return (MRESULT)0;

      case WM_COMMAND:
         switch(LOUSHORT(mp1))
         {
            case DID_OK:
               WinDismissDlg( hwnd, DID_OK);
               break;
            case ID_SPLHLP: /* Tell them how to register this version */
               ShowDlgHelp(hwnd);
               break;
         }
         return (MRESULT)0;
   }
   return( WinDefDlgProc(hwnd, msg, mp1, mp2) );
}
Ejemplo n.º 4
0
BOOL
WgtControl( PXCENTERWIDGET pWidget, MPARAM mp1, MPARAM mp2 )
{
  BOOL   brc = FALSE;
  USHORT usID = SHORT1FROMMP(mp1),
         usNotifyCode = SHORT2FROMMP(mp1);

  // is this from the XCenter client?
  if( usID == ID_XCENTER_CLIENT )
  {
    // yes:
    switch( usNotifyCode )
    {
      /*
       * XN_QUERYSIZE:
       *      XCenter wants to know our size.
       */

      case XN_QUERYSIZE:
      {
        PSIZEL pszl = (PSIZEL)mp2;

        pszl->cx = WinQuerySysValue( HWND_DESKTOP, SV_CXICON ) / 2 + 6;
        pszl->cy = WinQuerySysValue( HWND_DESKTOP, SV_CYICON ) / 2 + 6;
        brc = TRUE;
        break;
      }
    }
  }

  return brc;
}
OIcon::OIcon(const HPOINTER ptrHandle)
    : OPicture((ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CXICON),
               (ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CYICON)),
      hptr(ptrHandle)
{
    if (!hptr)
        throw OPMException(OCL::error(71), 0, OException::recoverable);
}
OIcon::OIcon(PCSZ fileName)
    : OPicture((ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CXICON),
               (ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CYICON)),
      hptr(WinLoadFileIcon((PSZ)fileName, TRUE))
{
    if (!hptr)
        throw OPMException(OCL::error(72), 0, OException::recoverable);
}
OIcon::OIcon(const ULONG resID, const HMODULE module)
    : OPicture((ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CXICON),
               (ULONG)WinQuerySysValue(HWND_DESKTOP, SV_CYICON)),
      hptr(WinLoadPointer(HWND_DESKTOP, module, resID))
{
    if (!hptr)
        throw OPMException(OCL::error(70), 0, OException::recoverable);
}
Ejemplo n.º 8
0
// static
HPOINTER QPixmap::toPmHPOINTER(const QIcon &icon, bool isPointer,
                               int hotX, int hotY, bool embedRealAlpha,
                               bool isMini)
{
    if (icon.isNull())
        return NULLHANDLE;

    // get the system icon size
    int w = WinQuerySysValue(HWND_DESKTOP, isPointer ? SV_CXPOINTER : SV_CXICON);
    int h = WinQuerySysValue(HWND_DESKTOP, isPointer ? SV_CYPOINTER : SV_CYICON);
    if (!isPointer && isMini) {
        w = w / 2;
        h = h / 2;
    }

    // obtain the closest (but never larger) icon size we have
    QSize size = icon.actualSize(QSize(w, h));

    QPixmap pm = icon.pixmap(size);
    if (pm.isNull())
        return NULLHANDLE;

    // if we got a smaller pixmap then center it inside the box matching the
    // system size instead of letting WinCreatePointerIndirect() scale (this
    // covers a usual case when we get 32/16 px pixmaps on a 120 DPI system
    // where the icon size is 40/20 px respectively): scaling such small images
    // looks really ugly.
    if (!pm.isNull() && (pm.width() < w || pm.height() < h)) {
        Q_ASSERT(pm.width() <= w && pm.height() <= h);
        QPixmap pmNew(w, h);
        pmNew.fill(Qt::transparent);
        QPainter painter(&pmNew);
        int dx = (w - pm.width()) / 2;
        int dy = (h - pm.height()) / 2;
        painter.drawPixmap(dx, dy, pm);
        pm = pmNew;
        hotX += dx;
        hotY += dy;
    }

    POINTERINFO info;
    info.fPointer = isPointer;
    info.xHotspot = hotX;
    info.yHotspot = pm.height() - hotY - 1;
    info.hbmColor = pm.toPmHBITMAP(&info.hbmPointer, embedRealAlpha);
    info.hbmMiniPointer = NULLHANDLE;
    info.hbmMiniColor = NULLHANDLE;

    HPOINTER hIcon = WinCreatePointerIndirect(HWND_DESKTOP, &info);

    GpiDeleteBitmap(info.hbmPointer);
    GpiDeleteBitmap(info.hbmColor);

    return hIcon;
}
Ejemplo n.º 9
0
VOID hia_initScsel( HIA *hia, HWND hwndParent, HWND hwndOwner )
{
    int i, j;
    LONG cxScreen, cyScreen;

    hia->hwndHCHLB = WinCreateWindow( hwndParent,
                                      WC_HCHLB,
                                      "Special Character Selection",
                                      WS_SYNCPAINT,
                                      0, 0,
                                      0, 0,
                                      hwndOwner,
                                      HWND_TOP,
                                      IDHCHLB_SPECIALCHARSEL,
                                      NULL,
                                      NULL );


    if( hia->hwndHCHLB )
    {
        hia->fRunningHCHLB = TRUE;

        WinSendMsg( hia->hwndHCHLB, HCHLM_SETHORZINT, MPFROMSHORT( 4 ), 0 );
        WinSendMsg( hia->hwndHCHLB, HCHLM_SETVERTINT, MPFROMSHORT( 4 ), 0 );

        for( i = 0; i < 6; i++ )
        {
            for( j = 0x31; j <= 0x7E; j ++ )
                WinSendMsg( hia->hwndHCHLB, HCHLM_INSERT,
                            MPFROMSHORT( HCHLIT_END ),
                            MPFROMSHORT( HCHFROM2CH( 0xD9 + i, j )));

            for( j = 0x91; j <= 0xFE; j ++ )
                WinSendMsg( hia->hwndHCHLB, HCHLM_INSERT,
                            MPFROMSHORT( HCHLIT_END ),
                            MPFROMSHORT( HCHFROM2CH( 0xD9 + i, j )));
        }

        WinSendMsg( hia->hwndHCHLB, HCHLM_SELECTITEM, MPFROMSHORT( hia->scselIndex ),
                    MPFROMLONG( TRUE ));

        cxScreen = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
        cyScreen = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );

        WinSetWindowPos( hia->hwndHCHLB, HWND_TOP,
                        ( cxScreen - CX_SCSEL ) / 2,
                        ( cyScreen - CY_SCSEL ) / 2,
                        CX_SCSEL, CY_SCSEL,
                        SWP_SHOW | SWP_MOVE | SWP_ZORDER | SWP_SIZE );
    }
}
Ejemplo n.º 10
0
// Centers the specified window over the desktop. Assumes the window is
// smaller both horizontally and vertically than the desktop
static void
CenterWindow(HWND hWndDlg)
{
  SWP swpDlg;

  WinQueryWindowPos(hWndDlg, &swpDlg);
  WinSetWindowPos(hWndDlg,
                  0,
                  (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)/2)-(swpDlg.cx/2),
                  (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN)/2)-(swpDlg.cy/2),
                  0,
                  0,
                  SWP_MOVE);
}
/* 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() */
Ejemplo n.º 12
0
static void internal_AdjustConfigDialogControls(HWND hwnd) {
	SWP swpTemp, swpTemp2, swpWindow;
	int staticheight, buttonheight;
	int iCX, iCY, iBottomButtonsWidth;
	ULONG CXDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
	ULONG CYDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
	BOOL rc;

	// Get window size!
	WinQueryWindowPos(hwnd, &swpWindow);

	// Resize the window
	rc = WinQueryWindowPos(WinWindowFromID(hwnd, PB_CONFCANCEL), &swpTemp);
	#ifdef DEBUG_LOGGING
		if (rc) AddLog("TRUE\n"); else AddLog("FALSE\n");
		AddToLogInt(swpTemp.x);
		AddToLogInt(swpTemp.y);
		AddToLogInt(swpTemp.cx);
		AddToLogInt(swpTemp.cy);
	#endif
	internal_GetStaticTextSize(hwnd, PB_CONFCANCEL, &iCX, &iCY);
	iBottomButtonsWidth = iCX;
	internal_GetStaticTextSize(hwnd, PB_CONFOK, &iCX, &iCY);
	if (iBottomButtonsWidth<iCX) iBottomButtonsWidth = iCX;
	WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 4*(iBottomButtonsWidth + 6*CXDLGFRAME), (3.8*(iCY+CYDLGFRAME*3))+(CYDLGFRAME*4)+WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR), SWP_SIZE); /*(swpTemp.cy)+(CYDLGFRAME*4)+WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR), SWP_SIZE);*/

	// Get window size!
	WinQueryWindowPos(hwnd, &swpWindow);

	// Query static height in pixels.
	internal_GetStaticTextSize(hwnd, ST_TEXT, &iCX, &iCY);
	staticheight = iCY;

	// Set the position of buttons
	WinSetWindowPos(WinWindowFromID(hwnd, PB_CONFOK), HWND_TOP, CXDLGFRAME*2, CYDLGFRAME*2, iBottomButtonsWidth + 6*CXDLGFRAME, iCY + 3*CYDLGFRAME, SWP_MOVE | SWP_SIZE);
	WinSetWindowPos(WinWindowFromID(hwnd, PB_CONFCANCEL), HWND_TOP, swpWindow.cx - CXDLGFRAME*2 - (iBottomButtonsWidth + 6*CXDLGFRAME), CYDLGFRAME*2, iBottomButtonsWidth + 6*CXDLGFRAME, iCY + 3*CYDLGFRAME, SWP_MOVE | SWP_SIZE);

	// Query button height in pixels.
	WinQueryWindowPos(WinWindowFromID(hwnd, PB_CONFOK), &swpTemp);
	buttonheight = swpTemp.cy;

	// Set the entry field
	WinSetWindowPos(WinWindowFromID(hwnd, EF_TEXT), HWND_TOP, CXDLGFRAME*2 + 2, CYDLGFRAME*2+buttonheight+ CYDLGFRAME*4+5, swpWindow.cx- (4*CXDLGFRAME*2), staticheight, SWP_MOVE | SWP_SIZE);

	// Set the text for the entry field
	internal_GetStaticTextSize(hwnd, ST_TEXT, &iCX, &iCY);
	WinQueryWindowPos(WinWindowFromID(hwnd, EF_TEXT), &swpTemp2);
	WinSetWindowPos(WinWindowFromID(hwnd, ST_TEXT), HWND_TOP, swpTemp2.x, swpTemp2.y+CYDLGFRAME*2 + swpTemp2.cy, iCX, iCY, SWP_MOVE | SWP_SIZE);
}
Ejemplo n.º 13
0
static void internal_ArrangeWrongPwdWindowControls(HWND hwnd)
{
  SWP swpWindow;
  ULONG CXDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
  ULONG CYDLGFRAME = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
  ULONG CYTITLEBAR = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
  int iCX, iCY;     // Control size
  int iMaxBtnCX, iBtnCY;

  // Arrange password protection window controls, and
  // set window size so it will look nice!


  // First get the sizes of texts inside buttons
  internal_GetStaticTextSize(hwnd, DID_OK, &iMaxBtnCX, &iBtnCY);

  // Now get size of text!
  internal_GetStaticTextSize(hwnd, ST_INVALIDPASSWORDTEXT, &iCX, &iCY);

  // Oookay, now we know how big window we want!

  WinSetWindowPos(hwnd,
                  HWND_TOP,
                  0, 0,
                  6*CXDLGFRAME + iCX,
                  CYDLGFRAME + CYTITLEBAR + 2*CYDLGFRAME + iCY + 2*CYDLGFRAME + (iBtnCY+4*CYDLGFRAME) + 2*CYDLGFRAME,
                  SWP_SIZE);

  WinQueryWindowPos(hwnd, &swpWindow);

  // Set the button in there
  WinSetWindowPos(WinWindowFromID(hwnd, DID_OK),
                  HWND_TOP,
                  (swpWindow.cx - (6*CXDLGFRAME + iMaxBtnCX)) / 2,
                  2*CYDLGFRAME,
                  6*CXDLGFRAME + iMaxBtnCX,
                  3*CYDLGFRAME + iBtnCY,
                  SWP_MOVE | SWP_SIZE);

  // Set the position of wrong password text
  WinSetWindowPos(WinWindowFromID(hwnd, ST_INVALIDPASSWORDTEXT),
                  HWND_TOP,
                  3*CXDLGFRAME,
                  swpWindow.cy - CYDLGFRAME - CYTITLEBAR - 2*CYDLGFRAME - iCY,
                  iCX,
                  iCY,
                  SWP_MOVE | SWP_SIZE);

}
Ejemplo n.º 14
0
Archivo: kva_wo.c Proyecto: komh/kva
static APIRET APIENTRY woCaps( PKVACAPS pkvac )
{
    int i;

    switch( m_hwvc.fccDstColor )
    {
        case FOURCC_BGR4 :
            pkvac->ulDepth = 32;
            break;

        case FOURCC_BGR3 :
            pkvac->ulDepth = 24;
            break;

        case FOURCC_R565 :
        case FOURCC_R555 :  // AS DIVE do with SNAP
            pkvac->ulDepth = 16;
            break;

        default :           // WO doesn't support palettized mode.
            return KVAE_WO_PALETTIZED_MODE;
    }

    pkvac->ulMode = KVAM_WO;
    pkvac->cxScreen = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
    pkvac->cyScreen = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
    pkvac->fccScreen = m_hwvc.fccDstColor;

    pkvac->ulInputFormatFlags = 0;
    for( i = 0; i < m_hwvc.ulNumColors; i++ )
    {
        switch( m_hwvc.fccColorType[ i ])
        {
            case FOURCC_Y422 :
                pkvac->ulInputFormatFlags |= KVAF_YUY2;
                break;

            case FOURCC_R565 :
                pkvac->ulInputFormatFlags |= KVAF_BGR16;
                pkvac->ulRMask = (( 1 << 5 ) - 1 ) << 11;
                pkvac->ulGMask = (( 1 << 6 ) - 1 ) << 5;
                pkvac->ulBMask = (( 1 << 5 ) - 1 ) << 0;
                break;
        }
    }

    return KVAE_NO_ERROR;
}
Ejemplo n.º 15
0
MRESULT
DrawMenuItem( POWNERITEM poi )
{
  TASKDATA* data = (TASKDATA*)poi->hItem;
  BOOL   select  = (poi->fsAttribute & MIA_HILITED) ? TRUE : FALSE;
  ULONG  cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON );
  ULONG  cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON );
  POINTL pos;
  RECTL  rect = poi->rclItem;

  WinFillRect( poi->hps, &rect, select ? SYSCLR_MENUHILITEBGND : SYSCLR_MENU );

  rect.xLeft += 2;
  rect.yBottom += ( rect.yTop - rect.yBottom - cy_icon/2 ) / 2;
  if( data->hIcon != NULLHANDLE ) {
    WinDrawPointer( poi->hps, rect.xLeft + 1, rect.yBottom + 1, data->hIcon, DP_MINI );
  }

  rect.xLeft += cx_icon/2 + 5;
  rect.yBottom = poi->rclItem.yBottom;
  WinDrawText( poi->hps, -1, data->szTitle, &rect,
                    select ? SYSCLR_MENUHILITE : SYSCLR_MENUTEXT, 0,
                    DT_LEFT | DT_VCENTER );

  // Well well well... And now ;) we are going to fix A great-Warp4-Menu-Bug
  // Make to redraw erased parts of menu's window border
  // Define something like #ifdef WARP_3 if you are running OS/2 Warp 3.x

  // vertical "light" line
  pos.x = poi->rclItem.xLeft;
  pos.y = 1;
  GpiSetColor( poi->hps, SYSCLR_BUTTONLIGHT );
  GpiMove( poi->hps, &pos );
  pos.y = poi->rclItem.yTop;
  GpiLine( poi->hps, &pos );

  // horizontal "dark" line
  pos.x = 1;
  pos.y = 1;
  GpiSetColor( poi->hps, SYSCLR_BUTTONDARK );
  GpiMove( poi->hps, &pos );
  pos.x = poi->rclItem.xRight;
  GpiLine( poi->hps, &pos );

  poi->fsAttributeOld = (poi->fsAttribute &= ~MIA_HILITED);
  return MRFROMLONG( TRUE );
}
Ejemplo n.º 16
0
VOID hia_initHanjaSel( HIA *hia, HWND hwndParent, HWND hwndOwner, HANCHAR hch )
{
    LONG    cxScreen, cyScreen;
    int     pos, count;


    hia->hwndHCHLB = WinCreateWindow( hwndParent,
                                      WC_HCHLB,
                                      "Hanja Selection",
                                      WS_SYNCPAINT,
                                      0, 0,
                                      0, 0,
                                      hwndOwner,
                                      HWND_TOP,
                                      IDHCHLB_HANJASEL,
                                      NULL,
                                      NULL );

    if( hia->hwndHCHLB )
    {
        hia->fRunningHCHLB = TRUE;

        WinSendMsg( hia->hwndHCHLB, HCHLM_SETHORZINT, MPFROMSHORT( 4 ), 0 );
        WinSendMsg( hia->hwndHCHLB, HCHLM_SETVERTINT, MPFROMSHORT( 4 ), 0 );

        WinSendMsg( hia->hwndHCHLB, HCHLM_INSERT,
                    MPFROMSHORT( HCHLIT_END ), MPFROMSHORT( hch ));

        if( hch_hg2hjpos( hch, &pos, &count ) == 0 )
        {
            int i;

            for( i = 0; i < count; i ++, pos ++ )
                WinSendMsg( hia->hwndHCHLB, HCHLM_INSERT,
                            MPFROMSHORT( HCHLIT_END ), MPFROMSHORT( hch_pos2hj( pos )));
        }

        cxScreen = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
        cyScreen = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );

        WinSetWindowPos( hia->hwndHCHLB, HWND_TOP,
                         ( cxScreen - CX_HANJASEL ) / 2,
                         ( cyScreen - CY_HANJASEL ) / 2,
                         CX_HANJASEL, CY_HANJASEL,
                         SWP_SHOW | SWP_MOVE | SWP_ZORDER | SWP_SIZE  );
    }
}
Ejemplo n.º 17
0
// Set the notebook and top-level dialog sizes based on the page sizes
void SetNotebookSize(PNBHDR pNotebookHdr)
{
	int i;
	RECTL rcl;
	SWP swp;
	HWND hwndNB = pNotebookHdr->hwndNB;
	LONG cx, cy, px, py;

	(void) memset(&rcl, 0, sizeof(RECTL));

	// Get the size of a notebook page by finding the dimensions of the largest
	// dialog.

	for (i = 0; i < pNotebookHdr->nPages; i++) {

		// Get the height and width of the dialog. Also fill in the id of the
		// item that is to get focus when the dialog is brought up.
		if (pNotebookHdr->PageArray[i].idDlg) {
			GetDialogDimensions(pNotebookHdr->PageArray[i].idDlg, &cx, &cy, &(pNotebookHdr->PageArray[i].idFocus));
			if (cx > rcl.xRight)
				rcl.xRight = cx;
			if (cy > rcl.yTop)
				rcl.yTop = cy;
		}
	}

	// Adjust the notebook so it is big enough for the pages
	WinMapDlgPoints(HWND_DESKTOP, (PPOINTL) &rcl, 2, TRUE);
	WinSendMsg(hwndNB, BKM_CALCPAGERECT, MPFROMP(&rcl), MPFROMLONG(FALSE));
	WinSetWindowPos(hwndNB, NULLHANDLE, 0, 0, rcl.xRight-rcl.xLeft, rcl.yTop-rcl.yBottom, SWP_SIZE);

	// Calculate the size required for the dialog window
	WinQueryWindowPos(hwndNB, &swp);
	rcl.xLeft = 0;
	rcl.yBottom = 0;
	rcl.xRight = swp.x + swp.cx;
	rcl.yTop = swp.y + swp.cy;
	WinCalcFrameRect(pNotebookHdr->hwndNBDlg, &rcl, FALSE );

	// Find the centered position and size, and adjust the dialog window so
	// it is centered, and big enough for the notebook
	cx = rcl.xRight - rcl.xLeft;
	cy = rcl.yTop - rcl.yBottom;
	px = (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN) - cx) / 2;
	py = (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - cy) / 2;
	WinSetWindowPos(pNotebookHdr->hwndNBDlg, NULLHANDLE, px, py, cx, cy, SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ACTIVATE);
}
// Window - окно, Type - какую полоску надо найти, значение "SBS_*".
// Target_window_placement - расположение окна, для которого должна быть найдена полоска.
// Возвращаемое значение: окно полоски просмотра или NULLHANDLE.
HWND Scroller_FindScrollBar( HWND Window, BYTE Type, PSWP Target_window_placement = NULL )
{
 // Если расположение окна не указано - задаем пустые значения.
 HWND Desktop = QueryDesktopWindow();

 INT X_Screen = WinQuerySysValue( Desktop, SV_CXSCREEN );
 INT Y_Screen = WinQuerySysValue( Desktop, SV_CYSCREEN );

 SWP Default_placement = { 0, Y_Screen * 2, X_Screen * 2, Y_Screen * (-1), X_Screen * (-1), NULLHANDLE, NULLHANDLE, 0, 0 };
 if( Target_window_placement == NULL ) Target_window_placement = &Default_placement;

 // Изначально окно полоски неизвестно.
 HWND Scroll_bar = NULLHANDLE;

 {
  // Перебираем окна, пока не найдем полоску.
  HENUM Enumeration = WinBeginEnumWindows( Window ); HWND Current_window = NULLHANDLE; 
  while( ( Current_window = WinGetNextWindow( Enumeration ) ) != NULLHANDLE )
   {
    // Если окно не скрыто:
    if( WinIsWindowVisible( Current_window ) )
     {
      // Если это полоска просмотра:
      if( IsScrollBarWindow( Current_window ) )
       {
        // Узнаем, как она расположена.
        SWP Rectangle = {0}; WinQueryWindowPos( Current_window, &Rectangle );

        // Если мы ищем как раз такую полоску - завершаем перебор окон.
        if( Type == SBS_VERT ) if( Rectangle.cy > Rectangle.cx )
         if( Rectangle.y + Rectangle.cy / 2 > Target_window_placement->y )
          if( Rectangle.y + Rectangle.cy / 2 < Target_window_placement->y + Target_window_placement->cy )
           { Scroll_bar = Current_window; break; }

        if( Type == SBS_HORZ ) if( Rectangle.cx > Rectangle.cy )
         if( Rectangle.x + Rectangle.cx / 2 > Target_window_placement->x )
          if( Rectangle.x + Rectangle.cx / 2 < Target_window_placement->x + Target_window_placement->cx )
           { Scroll_bar = Current_window; break; }
       }
     }
   }
  WinEndEnumWindows( Enumeration );
 }

 // Возвращаем указатель на полоску, если она была найдена, или NULLHANDLE.
 return Scroll_bar;
}
Ejemplo n.º 19
0
void XToolBar::Cut(void)
{
   XRect rect2;

   frame->frameWin->RemoveFrameControl(this);

   frame->GetSize(&rect2);
   rect2.SetHeight(rect2.GetHeight() + 1);
   frame->SetSize(&rect2);

   XResource res(0, XApplication::GetApplication()->GetResourceLibrary());

   XPoint p;

   GetPointerPos(&p);
   GetSize(&rect2);
   rect2.SetX(p.GetX() - 30);

   ULONG width = 0, hight = 0, lowest = 0;
   XRect rect;

   for (int i = 0; i < clients; i++)
   {
      clientArray[i]->clientWin->GetSize(&rect);
      if (rect.GetX() + rect.GetWidth() > width)
         width = rect.GetX() + rect.GetWidth();
      if (lowest == 0)
         lowest = rect.GetY();
      if (rect.GetY() < lowest)
         lowest = rect.GetY();
   }

   rect2.SetWidth(width + borderSize);

   rect2.SetHeight(rect2.GetHeight() + borderSize - lowest);

   rect2.SetY(p.GetY() - rect2.GetHeight());

   LONG y = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);

   y += WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
   rect2.SetHeight(rect2.GetHeight() + y);
   rect2.SetY(rect2.GetY() - y);

   cutWindow = new ToolBarParent(&res, rect2, this);
}
Ejemplo n.º 20
0
nsresult os2FrameWindow::Resize(int32_t aX, int32_t aY,
                                int32_t aWidth, int32_t aHeight,
                                bool aRepaint)
{
  aY = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - aY - aHeight;
  WinSetWindowPos(mFrameWnd, 0, aX, aY, aWidth, aHeight, SWP_MOVE | SWP_SIZE);
  return NS_OK;
}
Ejemplo n.º 21
0
void PM_mainloop(VOID *arg)
{
    SIZEL sizelHps = {0,0};
    HAB   hab;  // Anchor Block to PM
    HMQ   hmq;  // Handle to Msg Queue
    HDC   hdc;  // Handle to Device (Window-Screen)
    QMSG  qmsg; // Msg Queue Event
    video_canvas_t *ptr=(video_canvas_t*)arg;

    hab = WinInitialize(0);            // Initialize PM
    hmq = WinCreateMsgQueue(hab, 0);   // Create Msg Queue

    // 2048 Byte Memory (Used eg for the Anchor Blocks
    WinRegisterClass(hab, szClientClass, PM_winProc, CS_SIZEREDRAW, 2048);

    (*ptr)->hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                   WS_ANIMATE, &flFrameFlags,
                                   szClientClass, szTitleBarText, 0L, 0, 0,
                                   &((*ptr)->hwndClient));

    WinSetWindowPos((*ptr)->hwndFrame, HWND_TOP, 0, 0,
                    (*ptr)->width*stretch,
                    (*ptr)->height*stretch+
                    WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR), // +1 with gcc?
                    SWP_SIZE|SWP_SHOW|SWP_ZORDER|SWP_ACTIVATE);    // Make visible, resize, top window
    WinSetWindowPtr((*ptr)->hwndClient, QWL_USER, (VOID*)(*ptr));
    // --------------------
    // maybe ---> WM_CREATE
    // --------------------
    hdc         = WinOpenWindowDC((*ptr)->hwndFrame);
    (*ptr)->hps = GpiCreatePS(WinQueryAnchorBlock((*ptr)->hwndFrame),
                              hdc, &sizelHps,
                              PU_PELS|GPIF_DEFAULT|GPIT_MICRO|GPIA_ASSOC); // GPIT_NORMAL does also work with vac++

    (*ptr)->pbmi = lib_calloc(1, 16+sizeof(RGB2)*256);
    (*ptr)->pbmi->cbFix      = 16; // Size of cbFix, cPlanes, cBitCount = Begin of RGB2
    (*ptr)->pbmi->cPlanes    =  1;
    (*ptr)->pbmi->cBitCount  =  8; // Using 8-bit color mode
    (*ptr)->palette=(RGB2*)((ULONG)(*ptr)->pbmi+(*ptr)->pbmi->cbFix);

    vidlog("pbmiAllocated",0);
    (*ptr)->pbmi_initialized = TRUE;    // All stuff for pbmi created
    //    DosReleaseMutexSem(hmtx); // gfx init end
    //-----------------------
    
    while (WinGetMsg (hab, &qmsg, NULLHANDLE, 0, 0))
        WinDispatchMsg (hab, &qmsg) ;

    //    (*ptr)->pbmi_initialized = FALSE;
    DosRequestMutexSem(hmtx, SEM_INDEFINITE_WAIT);
    GpiDestroyPS((*ptr)->hps);
    WinDestroyWindow ((*ptr)->hwndFrame); // why was this commented out? --> WM_CLOSE ??
    WinDestroyMsgQueue(hmq);  // Destroy Msg Queue
    WinTerminate (hab);       // Release Anchor to PM
    lib_free((*ptr)->pbmi);   // is this the right moment to do this???
    //    lib_free(*ptr); // Vice crashes... why??? This must be done in the main thread!
    exit(0);                  // Kill VICE, All went OK
}
Ejemplo n.º 22
0
MRESULT
MeasureMenuItem( POWNERITEM poi )
{
  TASKDATA* data = (TASKDATA*)poi->hItem;
  ULONG cx_icon = WinQuerySysValue( HWND_DESKTOP, SV_CXICON );
  ULONG cy_icon = WinQuerySysValue( HWND_DESKTOP, SV_CYICON );

  RECTL rect = { 0, 0, 32000, 32000 };

  WinDrawText( poi->hps, -1, data->szTitle, &rect, 0, 0, DT_QUERYEXTENT | DT_LEFT | DT_VCENTER );

  poi->rclItem.xLeft   = 0;
  poi->rclItem.xRight  = max( cx_icon/2 + 4, rect.xRight - rect.xLeft   ) + 10;
  poi->rclItem.yBottom = 0;
  poi->rclItem.yTop    = max( cy_icon/2 + 2, rect.yTop   - rect.yBottom ) + 1;

  return MRFROMLONG( poi->rclItem.yTop );
}
Ejemplo n.º 23
0
int main()
{
  HMQ hmq;
  HAB hab;
  CHAR szPMWIN[CCHMAXPATH];
  HMODULE hmodPMWIN;
  PSZ psz;
  HWND hwndDlg;
  SWP swp;
 
  hab = WinInitialize(0);
  hmq = WinCreateMsgQueue(hab, 0);

  if (!DosLoadModule(NULL, 0, "PMWIN", &hmodPMWIN))
  {
    DosQueryModuleName(hmodPMWIN, sizeof(szPMWIN), szPMWIN);
    psz = strrchr(szPMWIN, '\\');
    *psz = '\0';

    strcpy(vszSysDLLPath, szPMWIN);
  }
 
  hwndDlg = WinLoadDlg(HWND_DESKTOP,
      NULLHANDLE, ShrInstallDlgProc,
      NULLHANDLE,
      IDD_INSTALL, vszSysDLLPath);

  WinQueryWindowPos(hwndDlg, &swp);
  swp.x = (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN) - swp.cx) / 2;
  swp.y = (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - swp.cy) / 2;
  swp.fl |= SWP_ACTIVATE | SWP_MOVE | SWP_ZORDER;
  swp.hwndInsertBehind = HWND_TOP;

  WinSetMultWindowPos(NULLHANDLE, &swp, 1);

  WinProcessDlg(hwndDlg);

  WinDestroyMsgQueue(hmq);
  WinTerminate(hab);

  return 0;
}
Ejemplo n.º 24
0
void OS2Popup::show( int xPos, int yPos )
{
    POINTL ptl = { xPos, yPos };
    // Invert Y
    ptl.y = ( WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ) - 1 ) - ptl.y;
    WinMapWindowPoints( HWND_DESKTOP, m_hWnd, &ptl, 1 );

    WinPopupMenu( m_hWnd, m_hWnd, m_hMenu, ptl.x, ptl.y, 0,
                  PU_HCONSTRAIN | PU_VCONSTRAIN | PU_NONE |
                  PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 );
}
Ejemplo n.º 25
0
// *******************************************************************************
// FUNCTION:     GetSysValues 
//
// FUNCTION USE: Obtains system values                                  
//
// DESCRIPTION:  This function is used to return valuable system information 
//               in the form of a SYSVALUES structure.  The structure is defined
//               in CLKDRAW.H.
//
// PARAMETERS:   VOID     
//
// RETURNS:      SYSVALUES  a structure containing the required system values
//
// HISTORY:
//
// *******************************************************************************
SYSVALUES GetSysValues(VOID)                                                                
{                                                                                           
 SYSVALUES sysvalues;                                                                       
                                                                                            
 sysvalues.lcxScreen     = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);                    
 sysvalues.lcyScreen     = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);                    
 sysvalues.lcxFullScreen = WinQuerySysValue (HWND_DESKTOP, SV_CXFULLSCREEN);                
 sysvalues.lcyFullScreen = WinQuerySysValue (HWND_DESKTOP, SV_CYFULLSCREEN);                
 sysvalues.lcxPointer    = WinQuerySysValue (HWND_DESKTOP, SV_CXPOINTER);                   
 sysvalues.lcyPointer    = WinQuerySysValue (HWND_DESKTOP, SV_CYPOINTER);                   
 sysvalues.lcxDlgFrame   = WinQuerySysValue (HWND_DESKTOP, SV_CXDLGFRAME);                  
 sysvalues.lcyDlgFrame   = WinQuerySysValue (HWND_DESKTOP, SV_CYDLGFRAME);                  
 return sysvalues;                                                                          
}                                                                                           
Ejemplo n.º 26
0
void WorldView::Init (World* world) {

#ifdef DEBUG
  if (debugP(5)) {
    debug("(Done) WorldView::Init");
  }
#endif

  WorldRep* rep = world->Rep();
  canvas = new Canvas((void*)HWND_DESKTOP);
 
  if ((canvas->width = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)) == 0) {
    ReportError(rep->hab(), "(43) ");
  }
  if ((canvas->height = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN)) == 0) {
    ReportError(rep->hab(), "(44) ");
  }
  canvas->status = CanvasMapped;
  xmax = canvas->width - 1;
  ymax = canvas->height - 1;
  output->SetOverwrite(true);
}
Ejemplo n.º 27
0
MRESULT EXPENTRY ClientWndProc (HWND hwnd, USHORT msg, 
                                MPARAM mp1, MPARAM mp2)
     {
     static HWND hwndMenuPopup ;
     HPS         hps ;
     POINTL      ptlMouse ;

     switch (msg)
          {
          case WM_CREATE:
               hwndMenuPopup = WinLoadMenu (hwnd, NULL, ID_POPUP) ;
               WinSetWindowPos (hwndMenuPopup, NULL, 
                                0, 0, 0, 0, SWP_SIZE) ;
               WinSetParent (hwndMenuPopup, HWND_DESKTOP, FALSE) ;
               return 0 ;

          case WM_BUTTON2UP:
               WinQueryPointerPos (HWND_DESKTOP, &ptlMouse) ;
               ptlMouse.y += WinQuerySysValue (HWND_DESKTOP, 
                                               SV_CYMENU) ;

               WinSetWindowPos (hwndMenuPopup, NULL,
                                (SHORT) ptlMouse.x, (SHORT) ptlMouse.y,
                                0, 0, SWP_MOVE) ;

               WinSendMsg (hwndMenuPopup, MM_SELECTITEM,
                           MPFROM2SHORT (IDM_POPUP, FALSE),
                           MPFROMSHORT (FALSE)) ;

               WinSetCapture (HWND_DESKTOP, hwndMenuPopup) ;
               return 0 ;

          case WM_COMMAND:
               switch (COMMANDMSG(&msg)->cmd)
                    {
                    case IDM_ABOUT:
                         WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
                                    NULL, IDD_ABOUT, NULL) ;
                         return 0 ;
                    }
               break ;

          case WM_PAINT:
               hps = WinBeginPaint (hwnd, NULL, NULL) ;
               GpiErase (hps) ;
               WinEndPaint (hps) ;
               return 0 ;
          }
     return WinDefWindowProc (hwnd, msg, mp1, mp2) ;
     }
Ejemplo n.º 28
0
void doAutoSize()
{
 int i;

 i = NearestFont(Font.H, Font.W);
 if (i >= 0)
 {
  Font.W = FontList[i].cx;
  Font.H = FontList[i].cy;
 }

 // If position is explicitely defined and size is not, auto compute window size
 if ((!fExplicitSize) && (Font.W > 0) && (Font.H > 0) && fAutoSize)
 {
  int bw = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
  int bh = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);
  int th = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);

  if (Console.W == -1)
  { Console.W = 80; Console.H = 25; }
  ConsolePos.W = bw * 2 + Console.W * Font.W;
  ConsolePos.H = th + bh * 2 + Console.H * Font.H;
 }
}
/**************************************************************************
 *
 *  Name       : InitGlobalVars()
 *
 *  Description: Performs initialization of the application  s
 *               global variables
 *
 *  Concepts   : Called once by the Init() routine
 *
 *  API's      :  WinQuerySysValue
 *                WinQuerySysPointer
 *
 *  Parameters :  [none]
 *
 *  Return     :  TRUE - initialization is successful
 *                FALSE - initialization failed
 *
 *************************************************************************/
BOOL InitGlobalVars(VOID)
{
   /* load system sizes */
   vlXScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
   vlYScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
   vlcxVScroll = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL);
   vlcyHScroll = WinQuerySysValue(HWND_DESKTOP, SV_CYHSCROLL);
   vlcyTitle = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
   vlcyMenu = WinQuerySysValue(HWND_DESKTOP, SV_CYMENU);
   vlcxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER);
   vlcyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER);

   /* load system pointers */
   vhptrArrow = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
   vhptrWait = WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
   return TRUE;
} /* End of InitGlobalVars  */
Ejemplo n.º 30
0
MRESULT hchlb_wmCreate( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
    PCREATESTRUCT pcs = ( PCREATESTRUCT )mp2;
    PHCHLB hchlb;
    int x, y;
    int cx, cy;
    LONG sv_cxVscroll = WinQuerySysValue( HWND_DESKTOP, SV_CXVSCROLL );

    WinSetWindowPtr( hwnd, 0, NULL );

    hchlb = malloc( sizeof( HCHLB ));
    if( hchlb == NULL )
        return MRFROMLONG( TRUE );

    hchlb->hchCol = HCHColCreate();
    hchlb->topIndex = 0;
    hchlb->bottomIndex = 0;
    hchlb->curIndex = 0;
    hchlb->horzInt = 0;
    hchlb->vertInt = 0;
    hchlb->fgColor = SYSCLR_WINDOWTEXT;
    hchlb->bgColor = SYSCLR_ENTRYFIELD;
    hchlb->eraseBg = TRUE;
    WinSetWindowPtr( hwnd, 0, hchlb );

    x = HCH_BORDER;
    y = HCH_BORDER;
    cx = pcs->cx - ( HCH_BORDER * 2 ) - sv_cxVscroll;
    cy = pcs->cy - ( HCH_BORDER * 2 );

    hchlb->hwndHCHLB = hwnd;
    hchlb->hwndClient = WinCreateWindow(
                            hwnd, WC_HCHLB_CLIENT, NULL,
                            WS_VISIBLE,
                            x, y, cx, cy,
                            hwnd, HWND_TOP,
                            HCHLBID_CLIENT, hchlb, NULL );

    WinCreateWindow( hwnd, WC_SCROLLBAR, NULL,
                     WS_VISIBLE | SBS_VERT,
                     x + cx, y, sv_cxVscroll, cy,
                     hwnd, HWND_TOP,
                     HCHLBID_VSCROLL, NULL, NULL );

    return 0;
}