Example #1
0
MRESULT mainwmSize( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
//  printf("HMLEdit:: WM_SIZE\n");

    WinSetWindowPos( WinWindowFromID( hwnd, ID_HANMLE ), NULLHANDLE,
            0, (use_statbar?STATBAR_YSIZE:0),
            SHORT1FROMMP(mp2),
            SHORT2FROMMP(mp2)-(use_statbar?STATBAR_YSIZE:0)-(use_toolbar?TOOLBAR_YSIZE:0),
            SWP_SIZE | SWP_MOVE );
    if (use_toolbar)
        WinSetWindowPos( WinWindowFromID( hwnd, ID_TOOLBAR ), NULLHANDLE,
            0, SHORT2FROMMP(mp2)-TOOLBAR_YSIZE, SHORT1FROMMP(mp2) , TOOLBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_SHOW);
        else
        WinSetWindowPos( WinWindowFromID( hwnd, ID_TOOLBAR ), NULLHANDLE,
            0, SHORT2FROMMP(mp2)-TOOLBAR_YSIZE, SHORT1FROMMP(mp2) , TOOLBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_HIDE);
    if (use_statbar)
        WinSetWindowPos( WinWindowFromID( hwnd, ID_STATBAR ), NULLHANDLE,
            0, 0, SHORT1FROMMP(mp2), STATBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_SHOW);
        else
        WinSetWindowPos( WinWindowFromID( hwnd, ID_STATBAR ), NULLHANDLE,
            0, 0, SHORT1FROMMP(mp2), STATBAR_YSIZE,
            SWP_SIZE | SWP_MOVE | SWP_HIDE);
    return MRFROMLONG(0L);
}
Example #2
0
void ShowXYZT(BOOL fXyzt)
{
   SWP  swp;
   int  mv=0;

   WinQueryWindowPos(hwndFrame, &swp);
       if (!fXyzt) {
          if (swp.cy!=0) { /* occurs at startup */
             mv = swp.cy-(ROWDISPLAY + ROWSTEP*9/4);
          } /* endif */
          WinSetWindowPos(hwndFrame, HWND_TOP, swp.x,
                swp.y + mv,
                (DISPLAYWIDTH+3*COL1),
                (ROWDISPLAY + ROWSTEP*9/4),
                SWP_SIZE | SWP_MOVE);
       } else {
          if (swp.cy!=0) { /* occurs at startup */
             mv = swp.cy-(ROWDISPLAY + ROWSTEP*9/4 + KEYHEIGHT*12/3);
          } /* endif */
          WinSetWindowPos(hwndFrame, HWND_TOP, swp.x,
                swp.y + mv,
                (DISPLAYWIDTH+3*COL1),
                (ROWDISPLAY + ROWSTEP*9/4 + KEYHEIGHT*12/3),
                SWP_SIZE | SWP_MOVE);
       }
}
MRESULT EXPENTRY MyWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  SWP   swp;
  ULONG rc;

  HWND  hFrame;
  HWND  hListBox;                                /* Listbox window handle    */

  switch (msg)
         {
         case WM_CREATE:
              hListBox = WinCreateWindow(hwnd,
                                         WC_LISTBOX,
                                         NULL,
                                         WS_VISIBLE     |
                                         LS_NOADJUSTPOS |
                                         LS_HORZSCROLL,
                                         0, 0, 0, 0,
                                         hwnd,
                                         HWND_TOP,
                                         ID_LISTBOX,
                                         0,
                                         0);

              pwpList = WinSubclassWindow(hListBox,
                           wpSubList);

              hFrame = WinQueryWindow(hwnd,
                                      QW_PARENT);
              rc = WinSetWindowPos(hFrame,
                                   HWND_TOP,
                                   0, 0,
                                   400, 300,
                                   SWP_SIZE     |
                                   SWP_ACTIVATE |
                                   SWP_SHOW);
              break;

         case WM_SIZE:
              WinQueryWindowPos(hwnd, &swp);
              hListBox=WinWindowFromID(hwnd,
                                       ID_LISTBOX);
              WinSetWindowPos(hListBox,
                              HWND_TOP,
                              swp.x, swp.y,
                              swp.cx, swp.cy,
                              SWP_SIZE  |
                              SWP_SHOW);
              break;

         default:
              return(WinDefWindowProc(hwnd,
                                      msg,
                                      mp1,
                                      mp2));
         }
  return((MRESULT)FALSE);
}
HWND bookSetup( ULONG idInitialPage )
{
    HWND hwndFrame;

    if( hwndBook )
    {
        hwndFrame = PARENT( hwndBook );

        // For some reason it is necessary to restore the notebook before
        // setting the frame as the active window if the frame is being
        // restored from a minimized state.

        WinSetWindowPos( hwndBook, NULLHANDLE, 0, 0, 0, 0,
                         SWP_SHOW | SWP_RESTORE );
        WinSetWindowPos( hwndFrame, NULLHANDLE, 0, 0, 0, 0,
                         SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE );
    }
    else
    {
        FRAMECDATA fcdata;

        memset( &fcdata, 0, sizeof fcdata );
        fcdata.cb            = sizeof( FRAMECDATA );
        fcdata.flCreateFlags = FRAME_FLAGS;
        fcdata.idResources   = ID_NBFRAME;

        hwndFrame = WinCreateWindow( HWND_DESKTOP, WC_FRAME, NULL, WS_ANIMATE,
                                     0, 0, 0, 0, NULLHANDLE, HWND_TOP,
                                     ID_NBFRAME, &fcdata, NULL );
        if( hwndFrame )
        {
            pfnwpFrame = WinSubclassWindow( hwndFrame, wpNBFrame );
            if( pfnwpFrame )
                if( CreateNotebookWindow( hwndFrame ) )
                    WinSetWindowText( hwndFrame, BOOK_TITLE );
                else
                {
                    WinDestroyWindow( hwndFrame );
                    hwndFrame = NULLHANDLE;
                }
            else
            {
                WinDestroyWindow( hwndFrame );
                Msg( "bookSetup WinSubclassWindow RC(%X)", HWNDERR(hwndFrame) );
                hwndFrame = NULLHANDLE;
            }
        }
        else
            Msg( "bookSetup WinCreateWindow of frame window RC(%X)", HABERR(0));
    }

    if( hwndBook )
        TurnToPage( idInitialPage );

    return hwndFrame;
}
BOOL launchPad::lpSetLaunchPadPos(HWND hwndInsertBehind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl)
{
  if(WinIsWindow(WinQueryAnchorBlock(hwndLaunchPad), hwndPrevious)) {
    SWP swp;
    WinQueryWindowPos(hwndPrevious,&swp);
    return WinSetWindowPos(hwndLaunchPad, hwndInsertBehind, swp.x+swp.cx+x, y, cx, cy, fl);
  }
  else
    return WinSetWindowPos(hwndLaunchPad, hwndInsertBehind, x, y, cx, cy, fl);
}
Example #6
0
nsresult os2FrameWindow::SetSizeMode(int32_t aMode)
{
  int32_t previousMode;
  mOwner->GetSizeMode(&previousMode);

  // save the new state
  nsresult rv = mOwner->nsBaseWidget::SetSizeMode(aMode);
  if (!NS_SUCCEEDED(rv)) {
    return rv;
  }

  // Minimized windows would get restored involuntarily if we fired an
  // NS_ACTIVATE when the user clicks on them.  Instead, we defer the
  // activation event until the window has explicitly been restored.
  if (previousMode == nsSizeMode_Minimized && previousMode != aMode) {
    DEBUGFOCUS(deferred NS_ACTIVATE);
    ActivateTopLevelWidget();
  }

  ULONG ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE);

  switch (aMode) {
    case nsSizeMode_Normal:
      if (ulStyle & (WS_MAXIMIZED | WS_MINIMIZED)) {
        WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, SWP_RESTORE);
      }
      break;

    case nsSizeMode_Minimized:
      if (!(ulStyle & WS_MINIMIZED)) {
        WinSetWindowPos(mFrameWnd, HWND_BOTTOM, 0, 0, 0, 0,
                        SWP_MINIMIZE | SWP_ZORDER | SWP_DEACTIVATE);
      }
      break;

    case nsSizeMode_Maximized:
      // Don't permit the window to be maximized when in
      // fullscreen mode because it won't be restored correctly.
      if (!(ulStyle & WS_MAXIMIZED) && !mChromeHidden) {
        WinSetWindowPos(mFrameWnd, HWND_TOP, 0, 0, 0, 0,
                        SWP_MAXIMIZE | SWP_ZORDER);
      }
      break;

    // 'nsSizeMode_Fullscreen' is defined but isn't used (as of v1.9.3)
    case nsSizeMode_Fullscreen:
    default:
      break;
  }

  return NS_OK;
}
// ------------------------------------------------------------------------------------------------------------
int main( int argc, char **argv )
{
  HMQ           hmq;
  QMSG          qmsg;
  ULONG         ulWork;
  SWP           swp;
  LONG          cx;

  // initialize globals struct to defaults
  memset( &globals, 0, sizeof( globals ));
  strcpy( globals.szRexxFileName, "DRAW.CMD" );
  // parameter is a REXX filename
  if( argc > 1 ) {
    strcpy( globals.szRexxFileName, argv[ 1 ] );
  }
  // PM application init
  globals.hab = WinInitialize( 0 );
  hmq = WinCreateMsgQueue( globals.hab, 0);
  // create a frame window with listbox to display REXX diagnostic output
  ulWork = FCF_SYSMENU | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_TASKLIST;
  globals.hwndOutputFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulWork, WC_LISTBOX, OUTPUTCAPTION, LS_NOADJUSTPOS,
                                               (HMODULE)0, ID_RXDRAW, &globals.hwndOutputListbox );
  assert( globals.hwndOutputFrame   );
  assert( globals.hwndOutputListbox );
  // create a frame window to display REXX graphical output
  WinRegisterClass( globals.hab, CLASSNAME, (PFNWP)ClientWinProc, CS_SIZEREDRAW, 0 );
  ulWork = FCF_SYSMENU | FCF_TITLEBAR | FCF_SIZEBORDER | FCF_MINMAX | FCF_MENU | FCF_ICON | FCF_TASKLIST;
  globals.hwndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulWork, CLASSNAME, CAPTION, 0,
                                         (HMODULE)0, ID_RXDRAW, &globals.hwndClient );
  assert( globals.hwndFrame  );
  assert( globals.hwndClient );
  // tile the two windows using shell's preferred placement for one
  WinQueryTaskSizePos( globals.hab, 0, &swp );
  cx = (swp.cx * 2) / 3;
  ulWork = SWP_SIZE | SWP_MOVE | SWP_ZORDER | SWP_SHOW | SWP_ACTIVATE | SWP_RESTORE;
  WinSetWindowPos( globals.hwndOutputFrame, HWND_TOP, swp.x+cx, swp.y, swp.cx-cx, swp.cy, ulWork );
  WinSetWindowPos( globals.hwndFrame, HWND_TOP, swp.x, swp.y, cx, swp.cy, ulWork );
  // message loop
  while( WinGetMsg( globals.hab, &qmsg, 0, 0, 0 ))   WinDispatchMsg( globals.hab, &qmsg );
  if( !globals.fCloseMsgSent ) {
    // got a WM_QUIT without WM_CLOSE; must be shutdown or Close from Window List
    WinPostMsg( globals.hwndObject, WM_QUIT, 0, 0 );
  }
  // clean up
  WinDestroyWindow( globals.hwndFrame );
  WinDestroyWindow( globals.hwndOutputFrame );
  WinDestroyMsgQueue( hmq );
  WinTerminate( globals.hab );
  DosWaitThread( &globals.tidObject, DCWW_WAIT );
  return 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) ;
     }
void OS2Factory::removeFromTaskBar()
{
    WinSetWindowPos( m_hParentWindow, NULLHANDLE, 0, 0, 0, 0, SWP_HIDE );

    HSWITCH hswitch = WinQuerySwitchHandle( m_hParentWindow, 0 );

    SWCNTRL swctl;
    WinQuerySwitchEntry( hswitch, &swctl );
    swctl.uchVisibility = SWL_INVISIBLE;
    WinChangeSwitchEntry( hswitch, &swctl );

    WinSetWindowPos( m_hParentWindow, NULLHANDLE, 0, 0, 0, 0,
                     SWP_ACTIVATE | SWP_SHOW );
}
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);
}
/**
 * Center the dialog.
 * @param     cx  New client area size - x.
 * @param     cy  New client area size - y.
 */
VOID kAboutPage::ntfySized(LONG cx, LONG cy)
{
    SWP     swp;
    if (WinQueryWindowPos(hwnd, &swp))
    {
        /*
         * Center dialog.
         * This didn't work while all space around the dialog
         * were white and I haven't figured out how to make it colored.
         * So we'll do it a different manner. Blow up the dialog and center
         * all elements.
         */
        #if 0
        WinSetWindowPos(hwnd,
                        NULLHANDLE,
                        cx / 2 - swp.cx / 2,
                        cy / 2 - swp.cy / 2,
                        0,
                        0,
                        SWP_MOVE);
        #else
        HWND  hwndCtrl;
        HENUM henum;

        WinSetWindowPos(hwnd,
                        NULLHANDLE,
                        0,
                        0,
                        cx,
                        cy,
                        SWP_MOVE | SWP_SIZE);

        henum = WinBeginEnumWindows(hwnd);
        while ((hwndCtrl = WinGetNextWindow(henum)) != NULLHANDLE)
        {
            SWP swpCtrl;
            if (WinQueryWindowPos(hwndCtrl, &swpCtrl))
                WinSetWindowPos(hwndCtrl,
                                NULLHANDLE,
                                cx / 2 - swpCtrl.cx / 2,
                                swpCtrl.y + (cy - swp.cy) / 2,
                                0,
                                0,
                                SWP_MOVE);
        }
        WinEndEnumWindows(henum);
        #endif
    }
}
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);

}
Example #13
0
File: gvpmeas.c Project: 131/gsview
void 
measure_show(void)
{
    if (hwnd_measure) {
	WinSetWindowPos(hwnd_measure, HWND_TOP, 0, 0, 0, 0, 
	    SWP_ZORDER | SWP_ACTIVATE);
	return;
    }

    hwnd_measure = WinLoadDlg(HWND_DESKTOP, hwnd_frame, MeasureDlgProc, 
	hlanguage, IDD_MEASURE, NULL);
    WinSetWindowPos(hwnd_measure, HWND_TOP, 0, 0, 0, 0, 
	SWP_ZORDER | SWP_ACTIVATE);

}
Example #14
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) );
}
Example #15
0
void main (void)
{
   QMSG  qmsg;
   HMQ   hmq;
   HWND  hwndClient;
   ULONG flFrameFlags;

   WinInitialize(0);
   hmq = WinCreateMsgQueue(hab, 0);

   /* get access to shared memory */
   DosGetNamedSharedMem((PVOID*)&memptr, MEM_NAME, PAG_READ);
   if (!memptr)
      WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
                    "  FreeType/2 is not running!",
                    "Error", 0, MB_OK | MB_ERROR);

   else {
      meminfo = memptr->address;
      if (meminfo->signature != 0x46524545)
         WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
                       "  FreeType/2 is not running!",
                       "Error", 0, MB_OK | MB_ERROR);
      else {
         flFrameFlags = FCF_TITLEBAR      | FCF_SYSMENU  |
                        FCF_TASKLIST ;

         WinRegisterClass(hab, "MyClass",
                          (PFNWP) ClientWndProc,
                          CS_SIZEREDRAW, 0);

         hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                        WS_VISIBLE,
                                        &flFrameFlags,
                                        "MyClass", "FreeType/2 Heap Usage",
                                        0, (HMODULE) NULL,
                                        0, &hwndClient);

         WinSetVisibleRegionNotify(hwndClient, TRUE);

         /* make titlebar text look better */
         WinSetPresParam(WinWindowFromID(hwndFrame, FID_TITLEBAR),
                         PP_FONTNAMESIZE, 9, (PVOID)"8.Helv");

         WinSetWindowPos(hwndFrame, NULLHANDLE, 0, 0, 350, 42,
                         SWP_MOVE | SWP_SIZE | SWP_SHOW);

         while (WinGetMsg(hab, &qmsg, (HWND) NULL, 0, 0))
            WinDispatchMsg(hab, &qmsg);

         WinSetVisibleRegionNotify(hwndClient, FALSE);
      }
   }
   /* free shared memory block */
   DosFreeMem(memptr);

   WinDestroyWindow(hwndFrame);
   WinDestroyMsgQueue(hmq);
   WinTerminate(hab);
}
Example #16
0
 static USHORT sizeButtonBar(HWND hwnd, short cx, USHORT btnCount, const USHORT *btnlist)
 {
    USHORT              pos;
    int                 ySize = 0;
    USHORT			    xSize;
    int                 f;
    USHORT				y     = 0;
    HWND                h;

    for(f=0;f < btnCount; f++)
    {
       icqskin_querySizes(CHILD_WINDOW(hwnd,btnlist[f]),0,&y);
       if(y > ySize)
          ySize = y;
    }

    pos = cx;

    for(f=0;f < btnCount; f++)
    {
       h = CHILD_WINDOW(hwnd,btnlist[f]);
       if(WinIsWindowVisible(h))
       {
          xSize  = (USHORT) icqskin_querySizes(h,0,0);
          pos   -= xSize;
          WinSetWindowPos(h, 0, pos, 0, xSize, ySize, SWP_SIZE|SWP_MOVE);
          pos   -= 4;
       }
    }

    return ySize;
 }
Example #17
0
// For frame windows, 'Show' is equivalent to 'Show & Activate'
nsresult nsFrameWindow::Show( PRBool bState)
{
   if( mWnd)
   {
      ULONG ulFlags;
      if( bState) {
         ULONG ulStyle = WinQueryWindowULong( GetMainWindow(), QWL_STYLE);
         ulFlags = SWP_SHOW;
         /* Don't activate the window unless the parent is visible */
         if (WinIsWindowVisible(WinQueryWindow(GetMainWindow(), QW_PARENT)))
           ulFlags |= SWP_ACTIVATE;
         if (!( ulStyle & WS_VISIBLE)) {
            PRInt32 sizeMode;
            GetSizeMode( &sizeMode);
            if ( sizeMode == nsSizeMode_Maximized) {
               ulFlags |= SWP_MAXIMIZE;
            } else if ( sizeMode == nsSizeMode_Minimized) {
               ulFlags |= SWP_MINIMIZE;
            } else {
               ulFlags |= SWP_RESTORE;
            }
         }
         if( ulStyle & WS_MINIMIZED)
            ulFlags |= (SWP_RESTORE | SWP_MAXIMIZE);
      }
      else
         ulFlags = SWP_HIDE | SWP_DEACTIVATE;
      WinSetWindowPos( GetMainWindow(), NULLHANDLE, 0L, 0L, 0L, 0L, ulFlags);
      SetWindowListVisibility( bState);
   }

   return NS_OK;
}
Example #18
0
 static USHORT setControlPos(HWND hwnd, USHORT x, USHORT y, USHORT ySize)
 {
    char   buffer[0x0100];
    POINTL aptl[TXTBOX_COUNT];
    HPS    hps;

    ULONG  flag        = SWP_SIZE;

    WinQueryWindowText(hwnd,0xFF,buffer);
    *(buffer+0xFF) = 0;

    hps = WinGetPS(hwnd);

    GpiQueryTextBox(      hps,
                          strlen(buffer),
                          (char *) buffer,
                          TXTBOX_COUNT,
                          aptl);
    WinReleasePS(hps);

    if(x != 0xFFFF && y != 0xFFFF)
       flag |= SWP_MOVE|SWP_SHOW;

    WinSetWindowPos(hwnd, 0, x, y, aptl[TXTBOX_TOPRIGHT].x, ySize, flag);

    return x+aptl[TXTBOX_TOPRIGHT].x;

 }
Example #19
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;
 }
Example #20
0
/*------------------------------------------------------------------------*/
static void positionWindowInViewPort(WINDOWINFO *pwi )
{
   HWND hFrame = WinQueryWindow(pwi->hwndClient,QW_PARENT);

   LONG x,y;

   x = y = 0;

   if (pwi->cxClient < view.cxCanvas)
   {
      x = (view.cxCanvas - pwi->cxClient)/2;
      x -= view.sHscrollPos;
   }
   else
   {
      x -= view.sHscrollPos;
   }

   if (pwi->cyClient < view.cyCanvas)
   {
      y = (view.cyCanvas - pwi->cyClient)/2;
      y += view.sVscrollPos;
   }
   else
   {
      y  = view.cyCanvas - pwi->cyClient;
      y += view.sVscrollPos;
   }
   WinSetWindowPos(hFrame,(HWND)0,x,y,0,0,SWP_MOVE);
}
Example #21
0
nsresult os2FrameWindow::Show(bool aState)
{
  uint32_t ulFlags;
  if (!aState) {
    ulFlags = SWP_HIDE | SWP_DEACTIVATE;
  } else {
    ulFlags = SWP_SHOW | SWP_ACTIVATE;

    uint32_t ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE);
    int32_t sizeMode;
    mOwner->GetSizeMode(&sizeMode);
    if (!(ulStyle & WS_VISIBLE)) {
      if (sizeMode == nsSizeMode_Maximized) {
        ulFlags |= SWP_MAXIMIZE;
      } else if (sizeMode == nsSizeMode_Minimized) {
        ulFlags |= SWP_MINIMIZE;
      } else {
        ulFlags |= SWP_RESTORE;
      }
    } else if (ulStyle & WS_MINIMIZED) {
      if (sizeMode == nsSizeMode_Maximized) {
        ulFlags |= SWP_MAXIMIZE;
      } else {
        ulFlags |= SWP_RESTORE;
      }
    }
  }

  WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, ulFlags);
  SetWindowListVisibility(aState);

  return NS_OK;
}
Example #22
0
/*********************************************************************
*
* 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);
}
Example #23
0
static BOOL init_instance( int show )
{
    HWND        frame_hwnd;
    ULONG       flags = FCF_SIZEBORDER | FCF_TITLEBAR
                | FCF_SYSMENU | FCF_MENU | FCF_MINMAX | FCF_SHELLPOSITION;

    frame_hwnd = WinCreateStdWindow( HWND_DESKTOP, WS_VISIBLE,
                &flags, "DrawDemo", "Draw a Picture", WS_VISIBLE,
                0, 200, &hwnd );

    /* If window could not be created, return "failure" */

    if( hwnd == 0 || frame_hwnd == 0 ) {
        return (FALSE);
    }

    /* Make the window visible; update its client area; and return "success" */

    WinSetWindowPos( frame_hwnd, HWND_TOP, 50, 50, 200, 200, show );

    make_buttons( hwnd );

    WinShowWindow( frame_hwnd, TRUE );
    WinUpdateWindow( frame_hwnd );
    return( TRUE );
}
Example #24
0
static void reposic(HWND hwnd,USHORT mCx,USHORT mCy)
{
   SLIDERDATA    *cfg = WinQueryWindowPtr(hwnd,0);
   SHORT        x,y,cx,cy;

   if(!(cfg->cx || cfg->cy))
   {
      WinShowWindow(hwnd,FALSE);
      return;
   }

   x  = cfg->x  < 0 ? (mCx + cfg->x) - cfg->cx  : cfg->x;
   y  = cfg->y  < 0 ? (mCy + cfg->y) - cfg->cy  : cfg->y;

   cx = cfg->cx < 0 ? mCx + cfg->cx : cfg->cx;
   cy = cfg->cy < 0 ? mCy + cfg->cy : cfg->cy;

   WinSetWindowPos(     hwnd,
                        0,
                        x,y,
                        cx,cy,
                        SWP_MOVE|SWP_SIZE|SWP_SHOW );


}
Example #25
0
HWND CreateStdWindow(HWND hwndParent, ULONG flStyle, ULONG flCreateFlags,
		     PSZ pszClientClass, PSZ pszTitle, ULONG styleClient,
		     HMODULE hmod, ULONG idResources, PHWND phwndClient,
		     LONG x, LONG y, LONG cx, LONG cy)

{
HWND   hwndFrame;		   /* Frame Window Handle		*/
POINTL aptl[2];			   /* Point Translation	Array		*/

if ( !(hwndFrame = WinCreateStdWindow(hwndParent, flStyle, &flCreateFlags,
				      pszClientClass, pszTitle,	styleClient,
				      hmod, idResources, phwndClient)) )
   return((HWND)NULL);

if ( !(flCreateFlags & FCF_SHELLPOSITION) )
   {
   aptl[0].x = x;
   aptl[0].y = y;
   aptl[1].x = cx;
   aptl[1].y = cy;
   WinMapDlgPoints(HWND_DESKTOP, aptl, 2UL, TRUE);
   WinSetWindowPos(hwndFrame, HWND_TOP,	aptl[0].x, aptl[0].y,
		   aptl[1].x, aptl[1].y, SWP_ACTIVATE |	SWP_SIZE | SWP_MOVE |
		   (ULONG)((flStyle & WS_VISIBLE) ? SWP_SHOW : 0UL));
   }
		       /* Return back the window handle			*/
return(hwndFrame);
}
/*--------------------------------------------------
 * Set the window shape
 *--------------------------------------------------*/
PMWindow& PMWindow::reshape( const SHAPE& rect )
{
  if( !WinSetWindowPos( handle(), 0, rect.x, rect.y, rect.cx, rect.cy, SWP_SIZE | SWP_MOVE ))
    PM_THROW_GUIERROR();

  return *this;
}
void OS2Factory::minimize()
{
    /* Make sure no tooltip is visible first */
    getIntf()->p_sys->p_theme->getWindowManager().hideTooltip();

    WinSetWindowPos( m_hParentWindow, NULLHANDLE, 0, 0, 0, 0, SWP_MINIMIZE );
}
Example #28
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);
}
Example #29
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;
}
Example #30
0
 static void autoSize(HWND hwnd)
 {
    ICQFRAME *cfg = WinQueryWindowPtr(hwnd,0);
    SWP      swp;

    WinQueryWindowPos(hwnd, &swp);
    WinSetWindowPos(hwnd, 0, swp.x, swp.y, swp.cx, swp.cy, SWP_SIZE);
 }