MRESULT __CPP_EXPORT__ EXPENTRY OWinDefDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
 switch(msg)
  {
   case WM_INITDLG:
     if (!mp2) return(MRESULT(TRUE));
     WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp2);
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefDlgProc(hwnd, msg, mp1, mp2));
     break;

   case DM_DRAGOVER:
     if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
     else
       return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));

   case WM_CONTROL:
     if(SHORT2FROMMP(mp1) == CN_DRAGOVER)
      {
       if (OApp::OCMDTrace(hwnd, msg, mp1, mp2))
         return(MPFROM2SHORT(DOR_DROP, DO_UNKNOWN));
       else
         return(MPFROM2SHORT(DOR_NODROP, DO_UNKNOWN));
      }
     else if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     break;

   case WM_HITTEST:
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     else
       return(MPFROMSHORT(HT_NORMAL));

   case WM_DRAWITEM:
     return(MRESULT(OApp::OCMDTrace(hwnd, msg, mp1, mp2)));

   case WM_CLOSE:
   case WM_DESTROY: {
     BOOL dispatched = OApp::OCMDTrace(hwnd, msg, mp1, mp2);
     WinSetWindowULong(hwnd, QWL_USER, (ULONG)OApp::currentOApp->NullHandler());
     if (!dispatched)
       return(WinDefWindowProc(hwnd, msg, mp1, mp2));
     break; }

   default:
     if (!OApp::OCMDTrace(hwnd, msg, mp1, mp2))
       return(WinDefDlgProc(hwnd, msg, mp1, mp2));
     break;
  }
 return(MRESULT(FALSE));
}
예제 #2
0
//************************************************************************************************
// "Playlist API"
//************************************************************************************************
void plAddEntry(HWND hWnd, PSZ pszFilename)
{
   PSTRINGLIST pFirstNode = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_PLAYLIST);
   PSTRINGLIST pList = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_CURRENTENTRY);
   ULONG       cCount = WinQueryWindowULong(hWnd, QWL_PLAYLISTENTRIES);

   if(pFirstNode == NULL)
   {
      // allocate node and increase nodecounter
      pFirstNode = new STRINGLIST;
      cCount++;

      // link it to itself (ever tried biting your own tail?)
      pFirstNode->next = pFirstNode;
      pFirstNode->prev = pFirstNode;

      // allocate stringbuffer in node and copy string to node
      pFirstNode->pszString = new char[strlen(pszFilename)+1];
      strcpy(pFirstNode->pszString, pszFilename);

      // set some nice pointers
      WinSetWindowPtr(hWnd, QWP_PLAYLIST, (PVOID)pFirstNode);
      WinSetWindowPtr(hWnd, QWP_CURRENTENTRY, (PVOID)pFirstNode);
      WinSetWindowULong(hWnd, QWL_PLAYLISTENTRIES, cCount);

      // go no further
      return;
   }

   // allocate the new node & increase the nodecounter
   pList->next = new STRINGLIST;
   cCount++;

   // set the new nodes previous-pointer to the current node (are we confused yet?)
   pList->next->prev = pList;

   // move to the next node
   pList = pList->next;

   // allocate stringbuffer in node and copy string to node
   pList->pszString = new char[strlen(pszFilename)+1];
   strcpy(pList->pszString, pszFilename);

   // link it to the first node in the list
   pList->next = pFirstNode;

   // link the first node's previous-pointer to the current node, since it is the last one (hello?)
   pFirstNode->prev = pList;

   // finish it all off with a big party!
   WinSetWindowPtr(hWnd, QWP_CURRENTENTRY, (PVOID)pList);
   WinSetWindowULong(hWnd, QWL_PLAYLISTENTRIES, cCount);
}
예제 #3
0
void plNuke(HWND hWnd)
{
   PSTRINGLIST pFirst = (PSTRINGLIST)WinQueryWindowPtr(hWnd, QWP_PLAYLIST);
   PSTRINGLIST pEntry = pFirst;
   PSTRINGLIST pTmp = pEntry;

   if(pFirst == NULL)
      return;

   do
   {
      pEntry = pEntry->next;

      delete pTmp->pszString;
      delete pTmp;

      pTmp = pEntry;

      DosSleep(0);
   }while(pTmp != pFirst);

   // reset playlist info
   WinSetWindowPtr(hWnd, QWP_PLAYLIST, (PVOID)NULL);
   WinSetWindowPtr(hWnd, QWP_CURRENTENTRY, (PVOID)NULL);
   WinSetWindowULong(hWnd, QWL_PLAYLISTENTRIES, 0);
}
예제 #4
0
파일: os2nb.c 프로젝트: ErisBlastar/osfree
// Top-level notebook dialog procedure -- for WM_INITDLG, expects mp2 to be a
// pointer to a notebook header structure which defines the notebook
MRESULT EXPENTRY NotebookDlgProc(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
{
	int nPage;
	PNBHDR pNotebookHdr;

	if (msg != WM_INITDLG)
		pNotebookHdr = (PNBHDR)WinQueryWindowULong(hDlg, QWL_USER);

	switch(msg) {
	case WM_INITDLG:

		pNotebookHdr = (PNBHDR)(PVOIDFROMMP(mp2));
		pNotebookHdr->hwndNB = WinWindowFromID(hDlg, pNotebookHdr->ulNotebookID);

		// Save upper-level dialog handle for use by page dialog code
		pNotebookHdr->hwndNBDlg = hDlg;

		// Save header pointer in window data so WM_SIZE code can use it
		WinSetWindowULong(hDlg, QWL_USER, (ULONG)pNotebookHdr);

		// Create the notebook
		if (!CreateNotebook(pNotebookHdr)) {
			WinDismissDlg(hDlg, 0);
			return 0;
		}

		// Post a message to open the notebook after initialization is complete
		WinPostMsg(hDlg, WM_OPEN_NOTEBOOK, MP0, MP0);
		break;

	case WM_OPEN_NOTEBOOK:

		// Select the first page, and set the notebook size
		TurnToFirstPage(pNotebookHdr->hwndNB);
		SetNotebookSize(pNotebookHdr);
		break;

	case WM_CONTROL:
		// If user selected a new page, switch to it
		if (((ULONG)pNotebookHdr != 0L) && (SHORT1FROMMP(mp1) == pNotebookHdr->ulNotebookID) && (SHORT2FROMMP(mp1) == BKN_PAGESELECTED))
			SetNBPage(hDlg, (PPAGESELECTNOTIFY)mp2);
		break;

	case WM_CLOSE_NOTEBOOK:
		// clear the notebook page array dialog handles to show the pages are no longer in use
		for (nPage = 0; (nPage < pNotebookHdr->nPages); nPage++)
			pNotebookHdr->PageArray[nPage].hwndPageDlg = (HWND)0L;
		WinDismissDlg(hDlg, 0);
		break;

	default:
		return WinDefDlgProc(hDlg, msg, mp1, mp2);
	}

	return 0;

}
예제 #5
0
void toLink( HWND hwnd )
{
    linkData *ld;
    detectBrowser();
    ld = (linkData *)malloc( sizeof( linkData ) );
    memset( ld, 0, sizeof( linkData ) );
    ld->labelProc = WinSubclassWindow( hwnd, LinkLabelProc );
    WinSetWindowULong( hwnd, QWL_USER, (ULONG)ld );
    WinInvalidateRect( hwnd, NULL, FALSE );
}
예제 #6
0
MRESULT _System DrvMountDrivesDlg( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
 
{
    if (msg == WM_TIMER && mp1 == (MP)CAM_LVMTMR) {
        HEV  hev = WinQueryWindowULong( hwnd, QWL_USER);

        if (!WinWaitEventSem( hev, 0))
            WinSendMsg( hwnd, WM_COMMAND, (MP)CAM_LVMTMR, 0);
        return (0);
    }

    if (msg == WM_COMMAND || msg == WM_SYSCOMMAND) {
        ULONG   ulChk;

        if (!WinStopTimer( 0, hwnd, CAM_LVMTMR))
            printf( "DrvMountDrivesDlg - WinStopTimer\n");

        ulChk = (ULONG)WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT,
                                          BM_QUERYCHECK, 0, 0);
        DrvSetUseLvm( WinQueryWindow( hwnd, QW_OWNER), ulChk);

        WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
        WinDismissDlg( hwnd, (mp1 == (MP)CAM_LVMTMR));
        return (0);
    }

    if (msg == WM_INITDLG) {
        HEV  hev = (HEV)mp2;

        WinSetWindowULong( hwnd, QWL_USER, hev);
        LoadDlgStrings( hwnd, nlsMountDlg);
        WinSendDlgItemMsg( hwnd, IDC_AUTOMOUNT, BM_SETCHECK,
                           (MP)(CAMDRV_IS_NOLVM ? 0 : 1), 0);
        ShowDialog( hwnd, 0);

        if (!WinWaitEventSem( hev, 0)) {
            WindowClosed( WinQueryWindowUShort( hwnd, QWS_ID));
            WinDismissDlg( hwnd, TRUE);
        }
        else
            if (!WinStartTimer( 0, hwnd, CAM_LVMTMR, 250))
                printf( "DrvMountDrivesDlg - WinStartTimer\n");
        return (0);
    }

    if (msg == WM_FOCUSCHANGE) {
        if (SHORT1FROMMP(mp2) && !WinIsWindowEnabled( hwnd)) {
            WinPostMsg( WinQueryWindow( hwnd, QW_OWNER),
                        CAMMSG_FOCUSCHANGE, 0, 0);
            return (0);
        }
    }

    return (WinDefDlgProc( hwnd, msg, mp1, mp2));
}
예제 #7
0
MRESULT EXPENTRY WndProc( HWND hWnd,ULONG iMessage,
                          MPARAM mParam1, MPARAM mParam2)
{
	Window *pWindow = (Window *)WinQueryWindowULong(hWnd,0);
  MRESULT res;

	if (pWindow == 0) {
		if (iMessage == WM_CREATE) {
			pWindow = (Window *)Application::tempthis;
			WinSetWindowULong(hWnd,0,(ULONG)pWindow);
			res = pWindow->wndProc(hWnd,iMessage,mParam1,mParam2);
		} else
			return WinDefWindowProc(hWnd,iMessage,mParam1,mParam2);
	} else
		res = pWindow->wndProc(hWnd,iMessage,mParam1,mParam2);

  if( pWindow != 0 && pWindow->killMe )
  {
    WinSetWindowULong(hWnd,0,(ULONG)0L);
    delete pWindow;
  }
  return res;
}
예제 #8
0
nsresult os2FrameWindow::HideWindowChrome(bool aShouldHide)
{
  // Putting a maximized window into fullscreen mode causes multiple
  // problems if it's later minimized & then restored.  To avoid them,
  // restore maximized windows before putting them in fullscreen mode.
  if (WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MAXIMIZED) {
    WinSetWindowPos(mFrameWnd, 0, 0, 0, 0, 0, SWP_RESTORE | SWP_NOREDRAW);
  }

  HWND hParent;
  if (aShouldHide) {
    hParent = HWND_OBJECT;
    mChromeHidden = true;
  } else {
    hParent = mFrameWnd;
    mChromeHidden = false;
  }

  // Hide or show the frame controls.
  WinSetParent(mTitleBar, hParent, FALSE);
  WinSetParent(mSysMenu, hParent, FALSE);
  WinSetParent(mMinMax, hParent, FALSE);

  // Modify the frame style, then advise it of the changes.
  if (aShouldHide) {
    mSavedStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE);
    WinSetWindowULong(mFrameWnd, QWL_STYLE, mSavedStyle & ~FS_SIZEBORDER);
    WinSendMsg(mFrameWnd, WM_UPDATEFRAME, 0, 0);
  } else {
    WinSetWindowULong(mFrameWnd, QWL_STYLE, mSavedStyle);
    WinSendMsg(mFrameWnd, WM_UPDATEFRAME,
               MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX), 0);
  }

  return NS_OK;
}
void InitRecorder(PRECORDER_PARM prec)
{
   SWP             swp;
   CHAR            szTemp[CCHMAXPATH];
   ULONG           dummy = errAEBadParm;

   if(prec->pmp->Profile.testrec_cx != 0)
   {
     WinSetWindowPos(prec->hwnd,
                     HWND_TOP,
                     prec->pmp->Profile.testrec_x,
                     prec->pmp->Profile.testrec_y,
                     prec->pmp->Profile.testrec_cx,
                     prec->pmp->Profile.testrec_cy,
                     SWP_MOVE | SWP_SIZE);
     WinSetWindowPos(prec->hwndStatus,
                     HWND_TOP,
                     prec->pmp->Profile.testrecStat_x,
                     prec->pmp->Profile.testrecStat_y,
                     prec->pmp->Profile.testrecStat_cx,
                     prec->pmp->Profile.testrecStat_cy,
                     SWP_MOVE | SWP_SIZE);
   }
   else
   {
    WinQueryTaskSizePos(WinQueryAnchorBlock(prec->hwnd),0,&swp);
    WinSetWindowPos(prec->hwnd,
                    HWND_TOP,
                    swp.x,
                    swp.y,
                    swp.cx,
                    swp.cy,
                    SWP_MOVE );
   }
   WinSetWindowULong(prec->hwnd, QWL_USER, (ULONG) prec );

   prec->pmp->hwndRecordEvent = prec->hwnd;

   prec->hwndStatus = WinWindowFromID(prec->hwnd, IDD_ODRECSTATUS);
   WinSetWindowText(prec->hwndStatus, "idle");
   prec->recording = FALSE;
   WinShowWindow(prec->hwnd,TRUE);
}
// Window - окно, для которого надо отключить заставку.
VOID Patcher_DisableAnimation( HWND Window )
{
 // Если окно неизвестно - возврат.
 if( Window == NULLHANDLE ) return;

 // Узнаем свойства окна.
 ULONG Window_style = WinQueryWindowULong( Window, QWL_STYLE );

 // Если заставка отключена - возврат.
 if( !( Window_style & WS_ANIMATE ) ) return;

 // Отключаем заставку.
 Window_style = Window_style & ~WS_ANIMATE;

 // Устанавливаем свойства рамки окна.
 WinSetWindowULong( Window, QWL_STYLE, Window_style );

 // Возврат.
 return;
}
예제 #11
0
launchPad::launchPad(HWND hwndParent,HWND hwndOwner, BOOL bVisible, WPFolder *wpParent, LPList** lpadList, HWND hwndPrev, ULONG ulFl)
{
  LPList *lplTemp;

  wpParentFolder=wpParent;
  hwndPrevious=hwndPrev;
  fl=ulFl;
  lpList=lpadList;

  /* Reset text */
  chrFlyOverText[0]=0;

  if((hwndLaunchPad=WinCreateWindow(hwndParent ,WC_FRAME, "Toolbar", FS_BORDER| (bVisible ? WS_VISIBLE: 0),
                                    0, 0, 0, 0, hwndOwner, HWND_TOP, 1234, NULLHANDLE, NULLHANDLE))!=NULLHANDLE) {
    WinSetWindowULong(hwndLaunchPad, QWL_USER,(ULONG) this);//Save object ptr.	
    pfnwpOldLPProc=WinSubclassWindow(hwndLaunchPad, launchPadWindowProc);
  }

  ulNumObjects=0;
  lpoObjectList=NULL;

  /* Add this pad to the list of pads */
  if(!lplAllLPads) {
    /* It's the first one */
    if((lplAllLPads=new LPList)!=NULL) {
      lplAllLPads->lpPad=this;
      lplAllLPads->lplNext=NULL;
    }
  }
  else {
    if((lplTemp=new LPList)!=NULL) {
      lplTemp->lpPad=this;
      lplTemp->lplNext=lplAllLPads;
      lplAllLPads=lplTemp;
    }
  }
}
예제 #12
0
MRESULT EXPENTRY AreaSettingsProc(HWND parent, ULONG message, MPARAM mp1, MPARAM mp2)
{
   extern WINDOWPOSITIONS windowpositions;
   extern HWND hwndhelp;
   char pchTemp[200];
   char pchTitle[250];
   HWND notebook=NULLHANDLE;
   MRESULT resultbuf=0;
   int rc;

   switch(message)
   {
      case WM_INITDLG:
         notebook=WinWindowFromID(parent,IDD_AREASETTINGS+1);
         AddCancelItem(parent);
         InsertSettingsPages(notebook, (PVOID) mp2);
         WinSetWindowULong(parent, QWL_USER, ((PAREAPAR)mp2)->bMultiple);
         RestoreWinPos(parent, &windowpositions.areasetuppos, TRUE, TRUE);
         WinAssociateHelpInstance(hwndhelp, parent);
         break;

      case WM_ADJUSTFRAMEPOS:
         SizeToClient(anchor, (PSWP) mp1, parent, IDD_AREASETTINGS+1);
         break;

      case WM_QUERYTRACKINFO:
         /* Default-Werte aus Original-Prozedur holen */
         resultbuf=WinDefDlgProc(parent,message,mp1,mp2);

         /* Minimale Fenstergroesse einstellen */
         ((PTRACKINFO)mp2)->ptlMinTrackSize.x=255;
         ((PTRACKINFO)mp2)->ptlMinTrackSize.y=190;

         return resultbuf;

      case WM_CLOSE:
         if (!WinQueryWindowULong(parent, QWL_USER))
         {
            /* Message an alle Windows schicken */
            rc = SendToAllPages(WinWindowFromID(parent, IDD_AREASETTINGS+1), APM_REQCLOSE, NULL, NULL);
            if (rc == 1)
               return (MRESULT) FALSE;
            if (rc == 2)
            {
               SendToAllPages(WinWindowFromID(parent, IDD_AREASETTINGS+1), APM_CANCEL, NULL, NULL);
               WinDismissDlg(parent, DID_CANCEL);
            }
            else
               WinDismissDlg(parent, DID_OK);
         }
         else
            WinDismissDlg(parent, DID_OK);
         QueryWinPos(parent, &(windowpositions.areasetuppos));
         WinAssociateHelpInstance(hwndhelp, WinQueryWindow(parent, QW_OWNER));
         return (MRESULT) FALSE;

      case APM_SETTITLE:
         if (!((PCHAR) mp1)[0])
            LoadString(IDST_AP_EMPTYTITLE, 250, pchTitle);
         else
         {
            LoadString(IDST_AP_TITLE, 200, pchTemp);
            sprintf(pchTitle, pchTemp, (PCHAR) mp1);
         }
         WinSetWindowText(parent, pchTitle);
         break;

      case WM_COMMAND:
         if (SHORT1FROMMP(mp1) == IDM_AS_CANCEL)
         {
            SendToAllPages(WinWindowFromID(parent, IDD_AREASETTINGS+1), APM_CANCEL, NULL, NULL);
            WinDismissDlg(parent, DID_CANCEL);
         }
         return (MRESULT) FALSE;

      default:
         break;
   }
   return WinDefDlgProc(parent,message,mp1,mp2);
}
예제 #13
0
파일: cdialog.cpp 프로젝트: kenjreno/lora3
BOOL CALLBACK CDialogDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
#endif
{
   int i;
   class CDialog *dlgClass;
   CPC_MSGMAP_ENTRY *msgMap = NULL;

#if defined(__OS2__)
   dlgClass = (class CDialog *)WinQueryWindowULong (hwnd, QWL_USER);
#elif defined(__NT__)
   dlgClass = (class CDialog *)GetWindowLong (hwnd, GWL_USERDATA);
#endif

   if (dlgClass != NULL) {
      dlgClass->m_msg = msg;
#if defined(__OS2__)
      dlgClass->m_mp1 = mp1;
      dlgClass->m_mp2 = mp2;
#elif defined(__NT__)
      dlgClass->m_wParam = wParam;
      dlgClass->m_lParam = lParam;
#endif

      msgMap = dlgClass->GetMessageMap ();
   }

   switch (msg) {
#if defined(__OS2__)
      case WM_INITDLG: {
         CDIALOG_DATA *cData = (CDIALOG_DATA *)mp2;
#elif defined(__NT__)
      case WM_INITDIALOG: {
         CDIALOG_DATA *cData = (CDIALOG_DATA *)lParam;
#endif

         dlgClass = cData->Dlg;
         dlgClass->m_hWnd = hwnd;
         dlgClass->lv_Selected = -1;
#if defined(__OS2__)
         WinSetWindowULong (hwnd, QWL_USER, (ULONG)dlgClass);
#elif defined(__NT__)
         SetWindowLong (hwnd, GWL_USERDATA, (LONG)dlgClass);
#endif

         dlgClass->OnInitDialog ();
#if defined(__OS2__)
         break;
#elif defined(__NT__)
         return ((BOOL)TRUE);
#endif
      }

#if defined(__OS2__)
      case WM_CONTROL:
         for (i = 0; msgMap[i].pfn != NULL; i++) {
            if (msgMap[i].nMessage == msg) {
               if (msgMap[i].nID >= SHORT1FROMMP (mp1) && msgMap[i].nLastID <= SHORT1FROMMP (mp1)) {
                  if (msgMap[i].nCode == SHORT2FROMMP (mp1)) {
                     (dlgClass->*msgMap[i].pfn) ();
                     break;
                  }
               }
            }
         }
         return (0);
#endif

#if defined(__NT__)
      case WM_NOTIFY: {
         LPNMHDR pnmh = (LPNMHDR)lParam;
         NM_LISTVIEW *pnmv = (NM_LISTVIEW *)lParam;

         if (pnmh->code == NM_DBLCLK)
            dlgClass->OnOK ();
         else if (pnmh->code == LVN_ITEMCHANGED) {
            if (!(pnmv->uNewState & LVIS_SELECTED) && (pnmv->uOldState & LVIS_SELECTED))
               dlgClass->lv_Selected = -1;
            if (pnmv->uNewState & LVIS_SELECTED)
               dlgClass->lv_Selected = (SHORT)pnmv->iItem;
         }
         else {
            for (i = 0; msgMap[i].pfn != NULL; i++) {
               if (msgMap[i].nMessage == msg && msgMap[i].nCode == pnmh->code) {
                  if (msgMap[i].nID >= pnmh->idFrom && msgMap[i].nLastID <= pnmh->idFrom) {
                     (dlgClass->*msgMap[i].pfn) ();
                     break;
                  }
               }
            }
         }
         return (0);
      }
#endif

#if defined(__OS2__)
      case WM_CHAR:
         if (SHORT1FROMMP (mp1) & KC_VIRTUALKEY && SHORT2FROMMP (mp2) == VK_F1)
            dlgClass->OnHelp ();
         break;
#endif

      case WM_HELP:
         dlgClass->OnHelp ();
         break;
/*
#if defined(__OS2__)
      case WM_HELP: {
         USHORT id;
         HWND hwndHelpInstance;

         id = WinQueryWindowUShort (hwnd, QWS_ID);
         hwndHelpInstance = WinQueryHelpInstance (dlgClass->owner_hWnd);
         WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP, MPFROM2SHORT (id, 0), MPFROMSHORT (HM_RESOURCEID));
         break;
      }
#endif
*/

      case WM_COMMAND:
#if defined(__OS2__)
         switch (SHORT1FROMMP (mp1)) {
#elif defined(__NT__)
         switch (LOWORD (wParam)) {
#endif
            case IDOK:
               dlgClass->OnOK ();
               break;
            case IDCANCEL:
               dlgClass->OnCancel ();
               break;
            case IDHELP:
               dlgClass->OnHelp ();
               break;
            default:
               for (i = 0; msgMap[i].pfn != NULL; i++) {
#if defined(__OS2__)
                  if (msgMap[i].nMessage == msg) {
                     if (msgMap[i].nID >= SHORT1FROMMP (mp1) && msgMap[i].nLastID <= SHORT1FROMMP (mp1)) {
#elif defined(__NT__)
                  if (msgMap[i].nMessage == msg && msgMap[i].nCode == HIWORD (wParam)) {
                     if (msgMap[i].nID >= LOWORD (wParam) && msgMap[i].nLastID <= LOWORD (wParam)) {
#endif
                        (dlgClass->*msgMap[i].pfn) ();
                        break;
                     }
                  }
               }
               break;
         }
         return (0);

#if defined(__NT__)
      case WM_CLOSE:
         EndDialog (hwnd, FALSE);
         break;
#endif

      default:
         if (msgMap != NULL) {
            for (i = 0; msgMap[i].pfn != NULL; i++) {
               if (msgMap[i].nMessage == msg) {
                  (dlgClass->*msgMap[i].pfn) ();
                  return (0);
               }
            }
         }
         break;
   }

#if defined(__OS2__)
   return (WinDefDlgProc (hwnd, msg, mp1, mp2));
#elif defined(__NT__)
   return ((BOOL)FALSE);
#endif
}

CDialog::CDialog (PSZ dialogTemplate, HWND p_hWnd)
{
   strcpy (dlgTemplate, dialogTemplate);
   owner_hWnd = p_hWnd;
   help_hWnd = NULL;
#if defined(__OS2__)
   WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_WAIT, FALSE));
#elif defined(__NT__)
#endif
}

CDialog::~CDialog ()
{
#if defined(__OS2__)
   if (help_hWnd != NULL)
      WinDestroyHelpInstance (help_hWnd);
#elif defined(__NT__)
#endif
}

VOID CDialog::Center ()
{
#if defined(__OS2__)
   RECTL rc;
#elif defined(__NT__)
   RECT rc;
#endif

#if defined(__OS2__)
   WinQueryWindowRect (m_hWnd, &rc);
   rc.yTop = (WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN) - (rc.yTop - rc.yBottom)) / 2;
   rc.xLeft = (WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN) - (rc.xRight - rc.xLeft)) / 2;
   WinSetWindowPos (m_hWnd, NULL, rc.xLeft, rc.yTop, 0, 0, SWP_MOVE);
#elif defined(__NT__)
   GetWindowRect (m_hWnd, &rc);
   rc.top = (GetSystemMetrics (SM_CYSCREEN) - (rc.bottom - rc.top)) / 2;
   rc.left = (GetSystemMetrics (SM_CXSCREEN) - (rc.right - rc.left)) / 2;
   SetWindowPos (m_hWnd, NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
#endif
}

LONG CDialog::DoModal ()
{
   LONG ulResult = 0L;
   CDIALOG_DATA cDialog;

   cDialog.cbSize = sizeof (CDIALOG_DATA);
   cDialog.Dlg = this;

#if defined(__OS2__)
   WinSetPointer (HWND_DESKTOP, WinQuerySysPointer (HWND_DESKTOP, SPTR_ARROW, FALSE));
   ulResult = WinDlgBox (HWND_DESKTOP, owner_hWnd, CDialogDlgProc, NULLHANDLE, atoi (dlgTemplate), &cDialog);
#elif defined(__NT__)
   ulResult = DialogBoxParam (hinst, MAKEINTRESOURCE (atoi (dlgTemplate)), owner_hWnd, (DLGPROC)CDialogDlgProc, (LPARAM)&cDialog);
#endif

   return (ulResult);
}

// ----------------------------------------------------------------------
// Windowing API replacement
// ----------------------------------------------------------------------

VOID CDialog::EndDialog (USHORT Result)
{
#if defined(__OS2__)
   WinDismissDlg (m_hWnd, Result);
#elif defined(__NT__)
   ::EndDialog (m_hWnd, Result);
#endif
}

VOID CDialog::GetDlgItemText (int id, PSZ text, USHORT size)
{
#if defined(__OS2__)
   WinQueryDlgItemText (m_hWnd, id, size, text);
#elif defined(__NT__)
   ::GetDlgItemText (m_hWnd, id, text, size);
#endif
}

VOID CDialog::GetDlgItemText (int id, USHORT size, PSZ text)
{
#if defined(__OS2__)
   WinQueryDlgItemText (m_hWnd, id, size, text);
#elif defined(__NT__)
   ::GetDlgItemText (m_hWnd, id, text, size);
#endif
}
예제 #14
0
static MRESULT EXPENTRY AreaMsgBaseProc(HWND parent, ULONG message, MPARAM mp1, MPARAM mp2)
{
   extern AREALIST arealiste;
   extern HWND hwndhelp;
   static AREADEFLIST *pArea=NULL;
   char pchTemp[LEN_PATHNAME+1];
   SHORT sTemp;

   switch(message)
   {
      case WM_INITDLG:
         pArea=((AREAPAR *)mp2)->pAreaDef;
         WinSubclassWindow(WinWindowFromID(parent, IDD_AS_MSGBASE+9),
                           FileEntryProc);

         WinSendDlgItemMsg(parent, IDD_AS_MSGBASE+9,
                           EM_SETTEXTLIMIT,
                           MPFROMSHORT(LEN_PATHNAME),
                           (MPARAM) NULL);
         if (pArea)
         {
            WinSetDlgItemText(parent, IDD_AS_MSGBASE+9,
                              pArea->areadata.pathfile);

            switch(pArea->areadata.areaformat)
            {
               case AREAFORMAT_FTS:
                  WinCheckButton(parent, IDD_AS_MSGBASE+2, TRUE);
                  break;

               case AREAFORMAT_SQUISH:
                  WinCheckButton(parent, IDD_AS_MSGBASE+3, TRUE);
                  break;

               case AREAFORMAT_JAM:
                  WinCheckButton(parent, IDD_AS_MSGBASE+4, TRUE);
                  break;

               default:
                  WinCheckButton(parent, IDD_AS_MSGBASE+2, TRUE);
                  break;
            }
            switch(pArea->areadata.areatype)
            {
               case AREATYPE_NET:
                  WinCheckButton(parent, IDD_AS_MSGBASE+6, TRUE);
                  break;

               case AREATYPE_ECHO:
                  WinCheckButton(parent, IDD_AS_MSGBASE+7, TRUE);
                  break;

               case AREATYPE_LOCAL:
                  WinCheckButton(parent, IDD_AS_MSGBASE+12, TRUE);
                  break;
            }
            if (pArea->areadata.ulAreaOpt & AREAOPT_FROMCFG)
            {
               WinEnableControl(parent, IDD_AS_MSGBASE+2, FALSE);
               WinEnableControl(parent, IDD_AS_MSGBASE+3, FALSE);
               WinEnableControl(parent, IDD_AS_MSGBASE+4, FALSE);
               WinEnableControl(parent, IDD_AS_MSGBASE+6, FALSE);
               WinEnableControl(parent, IDD_AS_MSGBASE+7, FALSE);
               WinEnableControl(parent, IDD_AS_MSGBASE+12, FALSE);
               WinSendDlgItemMsg(parent, IDD_AS_MSGBASE+9, EM_SETREADONLY,
                                 (MPARAM)TRUE, (MPARAM) NULL);
               WinEnableControl(parent, IDD_AS_MSGBASE+10, FALSE);
            }
         }
         WinDefDlgProc(parent, message, mp1, mp2);
         SetFocusControl(parent, IDD_AS_MSGBASE+9);
         return (MRESULT) TRUE;

      case WM_CLOSE:
      case WM_DESTROY:
         if (!WinQueryWindowULong(parent, QWL_USER))
         {
            WinQueryDlgItemText(parent, IDD_AS_MSGBASE+9, LEN_PATHNAME+1,
                                pchTemp);
            if (strcmp(pArea->areadata.pathfile, pchTemp))
            {
               strcpy(pArea->areadata.pathfile, pchTemp);
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }

            if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+2))
               sTemp=AREAFORMAT_FTS;
            else
               if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+3))
                  sTemp=AREAFORMAT_SQUISH;
               else
                  if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+4))
                     sTemp=AREAFORMAT_JAM;
                  else
                     sTemp=AREAFORMAT_FTS;

            if (sTemp!=pArea->areadata.areaformat)
            {
               pArea->areadata.areaformat=sTemp;
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }

            if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+6))
               sTemp=AREATYPE_NET;
            else
               if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+7))
                  sTemp=AREATYPE_ECHO;
               else
                  if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+12))
                     sTemp=AREATYPE_LOCAL;
                  else
                     sTemp=AREATYPE_NET;

            if (sTemp != pArea->areadata.areatype)
            {
               pArea->areadata.areatype=sTemp;
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
         }
         break;

      case WM_COMMAND:
         if (SHORT1FROMMP(mp2)==CMDSRC_PUSHBUTTON)
         {
            if(SHORT1FROMMP(mp1)==IDD_AS_MSGBASE+10)
            {
               WinQueryDlgItemText(parent, IDD_AS_MSGBASE+9,
                                   LEN_PATHNAME+1, pchTemp);
               if (GetPathname(parent, pchTemp)==DID_OK)
               {
                  char drive[_MAX_DRIVE];
                  char path[_MAX_DIR];
                  char name[_MAX_FNAME];
                  char ext[_MAX_EXT];

                  _splitpath(pchTemp, drive, path, name, ext);
                  if (WinQueryButtonCheckstate(parent, IDD_AS_MSGBASE+3))
                     _makepath(pchTemp, drive, path, name, "");
                  else
                  {
                    _makepath(pchTemp, drive, path, "", "");
                    pchTemp[strlen(pchTemp)-1]='\0';
                  }
                  WinSetDlgItemText(parent, IDD_AS_MSGBASE+9,
                                    pchTemp);
                  arealiste.bDirty = TRUE;
               }
            }
         }
         return (MRESULT) FALSE;

      case APM_REQCLOSE:
         if (WinQueryDlgItemTextLength(parent, IDD_AS_MSGBASE+9)==0)
         {
            /* Fehler, kein Pfadname */
            if (MessageBox(parent, IDST_MSG_NOPATHFILE, 0,
                           IDD_NOPATHFILE, MB_RETRYCANCEL | MB_ERROR) == MBID_CANCEL)
                return (MRESULT) 2;
            else
                return (MRESULT) 1;
         }
         return (MRESULT) 0;

      case APM_CANCEL:
         WinSetWindowULong(parent, QWL_USER, 1);
         break;

      default:
         break;
   }
   return WinDefDlgProc(parent,message,mp1,mp2);
}
예제 #15
0
static MRESULT EXPENTRY AreaAttribProc(HWND parent, ULONG message, MPARAM mp1, MPARAM mp2)
{
   extern AREALIST arealiste;
   static AREADEFLIST *pArea=NULL;

   switch(message)
   {
      case WM_INITDLG:
         pArea=((AREAPAR *)mp2)->pAreaDef;
         if (pArea)
         {
            ULONG ulMask;

            WinCheckButton(parent, IDD_AS_ATTRIB+9, !!(pArea->areadata.ulAreaOpt & AREAOPT_HIGHASCII));
            WinCheckButton(parent, IDD_AS_ATTRIB+10, !!(pArea->areadata.ulAreaOpt & AREAOPT_SEPARATOR));
            WinCheckButton(parent, IDD_AS_ATTRIB+11, !!(pArea->areadata.ulAreaOpt & AREAOPT_NOHIGHLIGHT));

            /* Message Attributes */
            MSG_QueryAttribCaps(&arealiste, pArea->areadata.areatag, &ulMask);
            WinSendDlgItemMsg(parent, IDD_AS_ATTRIB+2, ATTSM_SETATTRIB,
                              MPFROMLONG(pArea->areadata.ulDefAttrib),
                              MPFROMLONG(ulMask));
         }
         break;

      case WM_CLOSE:
      case WM_DESTROY:
         if (!WinQueryWindowULong(parent, QWL_USER))
         {
            ULONG ulTemp = pArea->areadata.ulAreaOpt & AREAOPT_FROMCFG;

            if (WinQueryButtonCheckstate(parent, IDD_AS_ATTRIB+9))
               ulTemp |= AREAOPT_HIGHASCII;
            if (WinQueryButtonCheckstate(parent, IDD_AS_ATTRIB+10))
               ulTemp |= AREAOPT_SEPARATOR;
            if (WinQueryButtonCheckstate(parent, IDD_AS_ATTRIB+11))
               ulTemp |= AREAOPT_NOHIGHLIGHT;
            if (pArea->areadata.ulAreaOpt != ulTemp)
            {
               pArea->areadata.ulAreaOpt = ulTemp;
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }

            ulTemp = (ULONG) WinSendDlgItemMsg(parent, IDD_AS_ATTRIB+2, ATTSM_QUERYATTRIB, NULL, NULL);
            if (pArea->areadata.ulDefAttrib != ulTemp)
            {
               pArea->areadata.ulDefAttrib = ulTemp;
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
         }
         break;

      case WM_COMMAND:
         return (MRESULT) FALSE;

      case APM_REQCLOSE:
         return (MRESULT) 0;

      case APM_CANCEL:
         WinSetWindowULong(parent, QWL_USER, 1);
         break;

      default:
         break;
   }
   return WinDefDlgProc(parent,message,mp1,mp2);
}
OWindow& OWindow::cancelClose()
{
 WinSetWindowULong(hwnd, QWL_USER, (ULONG)this);
 return(*this);
}
예제 #17
0
static MRESULT EXPENTRY AreaGenSettProc(HWND parent, ULONG message, MPARAM mp1, MPARAM mp2)
{
   HWND hwndList;
   extern USERDATAOPT userdaten;
   extern AREALIST arealiste;
   extern TEMPLATELIST templatelist;
   SHORT sItem=0, sSelect=0;
   static AREADEFLIST *pArea=NULL;
   char pchTemp[LEN_PATHNAME+1];
   static HWND hwndSettingsFrame;
   PMSGTEMPLATE pTemplate;
   AREADEFLIST *pAreaTemp;

   switch(message)
   {
      case WM_INITDLG:
         pArea=((PAREAPAR)mp2)->pAreaDef;

         if (!((PAREAPAR)mp2)->bMultiple)
         {
            SendMsg(hwndSettingsFrame=WinQueryWindow(parent, QW_PARENT),
                       APM_SETTITLE, pArea->areadata.areatag, NULL);
            WinSendDlgItemMsg(parent,IDD_AS_GENERAL+3,
                              EM_SETTEXTLIMIT,
                              MPFROMSHORT(LEN_AREATAG),
                              (MPARAM) NULL);

            WinSendDlgItemMsg(parent,IDD_AS_GENERAL+5,
                              EM_SETTEXTLIMIT,
                              MPFROMSHORT(LEN_AREADESC),
                              (MPARAM) NULL);
         }
         else
         {
            WinShowWindow(WinWindowFromID(parent, IDD_AS_GENERAL+2), FALSE);
            WinShowWindow(WinWindowFromID(parent, IDD_AS_GENERAL+3), FALSE);
            WinShowWindow(WinWindowFromID(parent, IDD_AS_GENERAL+4), FALSE);
            WinShowWindow(WinWindowFromID(parent, IDD_AS_GENERAL+5), FALSE);
         }

         /* Adressen eintragen */
         hwndList=WinWindowFromID(parent, IDD_AS_GENERAL+9);
         SendMsg(hwndList, LM_DELETEALL, (MPARAM)0, (MPARAM)0);
         sItem=0;
         sSelect = LIT_NONE;
         while(sItem<MAX_ADDRESSES && userdaten.address[sItem][0])
         {
            SendMsg(hwndList, LM_INSERTITEM,
                       MPFROMSHORT(LIT_END),
                       (MPARAM) userdaten.address[sItem]);
            if (pArea && !strcmp(pArea->areadata.address, userdaten.address[sItem]))
               sSelect = sItem;
            sItem++;
         }
         SendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(sSelect), (MPARAM) TRUE);

         /* Namen eintragen */
         hwndList=WinWindowFromID(parent, IDD_AS_GENERAL+12);
         SendMsg(hwndList, LM_DELETEALL, (MPARAM)0, (MPARAM)0);
         sItem=0;
         sSelect = LIT_NONE;
         while(sItem<MAX_USERNAMES && userdaten.username[sItem][0])
         {
            SendMsg(hwndList, LM_INSERTITEM,
                       MPFROMSHORT(LIT_END),
                       (MPARAM) userdaten.username[sItem]);
            if (pArea && !strcmp(pArea->areadata.username, userdaten.username[sItem]))
               sSelect = sItem;
            sItem++;
         }
         SendMsg(hwndList, LM_SELECTITEM, MPFROMSHORT(sSelect), (MPARAM) TRUE);

         if (pArea)
         {
            WinSetDlgItemText(parent, IDD_AS_GENERAL+3,
                              pArea->areadata.areatag);
            WinSetDlgItemText(parent, IDD_AS_GENERAL+5,
                              pArea->areadata.areadesc);

            if (pArea->areadata.ulAreaOpt & AREAOPT_FROMCFG)
               WinSendDlgItemMsg(parent, IDD_AS_GENERAL+3, EM_SETREADONLY,
                                 (MPARAM)TRUE, NULL);
         }

         /* Template-Namen eintragen */
         pTemplate = templatelist.pTemplates;
         while (pTemplate)
         {
            sItem = (SHORT) WinSendDlgItemMsg(parent, IDD_AS_GENERAL+14, LM_INSERTITEM,
                                              MPFROMSHORT(LIT_SORTASCENDING),
                                              pTemplate->TName);
            WinSendDlgItemMsg(parent, IDD_AS_GENERAL+14, LM_SETITEMHANDLE,
                              MPFROMSHORT(sItem),
                              MPFROMLONG(pTemplate->ulID));
            if (pArea && pTemplate->ulID == pArea->areadata.ulTemplateID)
               WinSendDlgItemMsg(parent, IDD_AS_GENERAL+14, LM_SELECTITEM,
                                 MPFROMSHORT(sItem), MPFROMSHORT(TRUE));

            pTemplate = pTemplate->next;
         }
         break;

      case WM_CLOSE:
      case WM_DESTROY:
         if (!WinQueryWindowULong(parent, QWL_USER))
         {
            WinQueryDlgItemText(parent, IDD_AS_GENERAL+3, LEN_AREATAG+1,
                                pchTemp);
            if (strcmp(pArea->areadata.areatag, pchTemp))
            {
               strcpy(pArea->areadata.areatag, pchTemp);
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
            WinQueryDlgItemText(parent, IDD_AS_GENERAL+5, LEN_AREADESC+1,
                                pchTemp);
            if (strcmp(pArea->areadata.areadesc, pchTemp))
            {
               strcpy(pArea->areadata.areadesc, pchTemp);
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
            WinQueryDlgItemText(parent, IDD_AS_GENERAL+9, LEN_5DADDRESS+1,
                                pchTemp);
            if (strcmp(pArea->areadata.address, pchTemp))
            {
               strcpy(pArea->areadata.address, pchTemp);
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
            WinQueryDlgItemText(parent, IDD_AS_GENERAL+12, LEN_USERNAME+1,
                                pchTemp);
            if (strcmp(pArea->areadata.username, pchTemp))
            {
               strcpy(pArea->areadata.username, pchTemp);
               arealiste.bDirty = TRUE;
               pArea->dirty=TRUE;
            }
            sItem = (SHORT)WinSendDlgItemMsg(parent, IDD_AS_GENERAL+14, LM_QUERYSELECTION,
                                               MPFROMSHORT(LIT_FIRST), NULL);
            if (sItem >= 0)
            {
               ULONG ulID;

               ulID = (ULONG) WinSendDlgItemMsg(parent, IDD_AS_GENERAL+14, LM_QUERYITEMHANDLE,
                                                MPFROMSHORT(sItem), NULL);
               if (ulID != pArea->areadata.ulTemplateID)
               {
                  pArea->areadata.ulTemplateID = ulID;
                  arealiste.bDirty = TRUE;
                  pArea->dirty=TRUE;
               }
            }
         }
         break;

      case WM_COMMAND:
         return (MRESULT) FALSE;

      case WM_CONTROL:
         if (SHORT1FROMMP(mp1)==IDD_AS_GENERAL+3)
            if (SHORT2FROMMP(mp1)==EN_KILLFOCUS)
            {
               char pchTempTag[LEN_AREATAG+1];

               WinQueryDlgItemText(parent, IDD_AS_GENERAL+3, LEN_AREATAG+1, pchTempTag);
               SendMsg(hwndSettingsFrame,
                          APM_SETTITLE, pchTempTag, NULL);
            }
         if (SHORT1FROMMP(mp1) == IDD_AS_GENERAL+15)
            if (SHORT2FROMMP(mp1) == BN_CLICKED ||
                SHORT2FROMMP(mp1) == BN_DBLCLICKED)
            {
               if (WinQueryButtonCheckstate(parent, IDD_AS_GENERAL+15))
                  WinEnableControl(parent, IDD_AS_GENERAL+7, FALSE);
               else
                  WinEnableControl(parent, IDD_AS_GENERAL+7, TRUE);
            }
         break;

      case APM_REQCLOSE:
         WinQueryDlgItemText(parent, IDD_AS_GENERAL+3, LEN_AREATAG+1,
                             pchTemp);
         if (pchTemp[0] == 0)
         {
            /* Fehler, kein Area-Tag */
            if (MessageBox(parent, IDST_MSG_NOAREATAG, 0,
                           IDD_NOAREATAG, MB_RETRYCANCEL | MB_ERROR) == MBID_CANCEL)
                return (MRESULT) 2;
            else
                return (MRESULT) 1;
         }
         else
         {
            pAreaTemp = AM_FindArea(&arealiste, pchTemp);
            if (pAreaTemp && pAreaTemp != pArea)
            {
               /* Fehler, schon vorhanden */
               if (MessageBox(parent, IDST_MSG_ALREADYHAVEAREA, 0,
                              IDD_ALREADYHAVEAREA, MB_RETRYCANCEL | MB_ERROR) == MBID_CANCEL)
                   return (MRESULT) 2;
               else
                   return (MRESULT) 1;
            }
         }
         return (MRESULT) 0;

      case APM_CANCEL:
         WinSetWindowULong(parent, QWL_USER, 1);
         break;

      default:
         break;
   }
   return WinDefDlgProc(parent,message,mp1,mp2);
}
MRESULT EXPENTRY newProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{

  switch (msg)
    {      
    case WM_CREATE:
      {
        PCREATESTRUCT pCreate=PVOIDFROMMP(mp2);

        /* Initialize the slider data */
        WinSetWindowUShort(hwnd, SLIDERARMWITH,20);
        WinSetWindowUShort(hwnd, SLIDERARMHEIGHT,10);
        /* Dimensions of slider. The slider active area is smaller than the window to
           allow drawing of active state. */
        WinSetWindowULong(hwnd, SLIDERCX,pCreate->cx-4);
        WinSetWindowULong(hwnd, SLIDERCY,pCreate->cy-4);
        WinSetWindowULong(hwnd, SLIDERX,2);
        WinSetWindowULong(hwnd, SLIDERY,2);
        WinSetWindowULong(hwnd, SLIDERARMPOS, 0);
        WinSetWindowULong(hwnd, SLDRAGGING,FALSE);
        return (MRESULT)0;
      }
    case WM_SIZE:
      WinSetWindowULong(hwnd, SLIDERCX, SHORT1FROMMP(mp2)-4);
      WinSetWindowULong(hwnd, SLIDERCY, SHORT2FROMMP(mp2)-4);
      WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
      return (MRESULT)0;
    case WM_BUTTON1DOWN:
      {
        SHORT x=SHORT1FROMMP( mp1);
        SHORT y=SHORT2FROMMP( mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);

        if(x<lPos+usWidth && y<WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY)
           && y>WinQueryWindowUShort(hwnd, SLIDERY)) {
          WinSetWindowUShort(hwnd, PTRPOSINSLARM, x-lPos);
        }
        WinSetFocus(HWND_DESKTOP, hwnd);
      break;
      }
    case WM_FOCUSCHANGE:
      {
        HPS hps;
        RECTL rcl;
        POINTL ptl;

        if(SHORT1FROMMP(mp2)) {
          hps=WinGetPS(hwnd);
          WinQueryWindowRect(hwnd, &rcl);        
          GpiSetLineType(hps, LINETYPE_DOT);
          ptl.x=rcl.xLeft;
          ptl.y=rcl.yBottom;
          GpiMove(hps,&ptl);
          ptl.x=rcl.xRight-1;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yTop-1;
          GpiLine(hps,&ptl);
          ptl.x=rcl.xLeft;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yBottom;
          GpiLine(hps,&ptl);
          WinReleasePS(hps);
        }
        else {
          WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
        }

        break;
      }
    case WM_CHAR:
      if(WinQueryFocus(HWND_DESKTOP)==hwnd) {
        /* We have the focus */
        if((SHORT1FROMMP(mp1) & (KC_VIRTUALKEY))==(KC_VIRTUALKEY)) {
          LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
          USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
          ULONG ulCx=WinQueryWindowULong(hwnd, SLIDERCX);
#if 0
          FILE* file;
          file=fopen("d:\\md.log","a");
          fprintf(file,"0x%x 0x%x \n",SHORT1FROMMP(mp1),SHORT2FROMMP(mp1) );
          fclose(file);
#endif
          /*(KC_KEYUP|KC_PREVDOWN|KC_VIRTUALKEY)*/
          switch(SHORT2FROMMP(mp2))
            {
            case VK_RIGHT:

              if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) {
                lPos+=2;
                if(lPos>ulCx-usWidth)
                  lPos=ulCx-usWidth;
                else {
                  WinPostMsg( hwnd,
                              SLM_SETSLIDERINFO,
                              MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                              MPFROMLONG( (LONG) lPos ));
                  if(SHORT1FROMMP(mp1) & KC_LONEKEY)
                    /* Post SLN_CHANGE notification */
                    WinPostMsg( WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL,
                                MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                                MPFROMLONG(lPos));
                  else
                    /* Post SLN_SLIDERTRACK notification */
                    WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL,
                               MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_SLIDERTRACK),
                               MPFROMLONG(lPos));
                  
                }
                WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
              }
              return (MRESULT)TRUE;
            case VK_LEFT:
              if(SHORT1FROMMP(mp1) & (KC_KEYUP|KC_PREVDOWN)) {
                lPos-=2;
                if(lPos<0) {
                  lPos=0;
                }
                else {
                  WinPostMsg( hwnd,
                              SLM_SETSLIDERINFO,
                              MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE),
                              MPFROMLONG( (LONG) lPos ));
                  /* Post SLN_CHANGE notification */
                  WinPostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
                             MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                   MPFROMLONG(WinQueryWindowULong(hwnd, SLIDERARMPOS)));

                }
                WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
              }
              return (MRESULT)TRUE;
            default:
              break;
            }
        }
      }
      break;
    case WM_BUTTON1MOTIONSTART:
      {
        SHORT x=SHORT1FROMMP( mp1);
        SHORT y=SHORT2FROMMP( mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);

        if(x<lPos+usWidth && y<WinQueryWindowUShort(hwnd, SLIDERY)+WinQueryWindowUShort(hwnd, SLIDERCY)
           && y>WinQueryWindowUShort(hwnd, SLIDERY)) {
          WinSetWindowULong(hwnd, SLDRAGGING, TRUE);
          WinSetCapture(HWND_DESKTOP, hwnd);
        }
        break;
      }
    case WM_BUTTON1MOTIONEND:
      if(WinQueryWindowULong(hwnd, SLDRAGGING)) {
        WinSetWindowULong(hwnd, SLDRAGGING,FALSE);
        WinSetCapture(HWND_DESKTOP, NULLHANDLE);
        /* Post SLN_CHANGE notification */
        WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL, MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_CHANGE),
                   MPFROMLONG(WinQueryWindowULong(hwnd, SLIDERARMPOS)));
      }
      break;
    case SLM_SETSLIDERINFO:
      switch(SHORT1FROMMP(mp1))
        {
          case SMA_SLIDERARMPOSITION:
            /*  SMA_RANGEVALUE only for now !! */
            if(SHORT2FROMMP(mp1)==SMA_RANGEVALUE) {
              WinSetWindowULong(hwnd, SLIDERARMPOS, LONGFROMMP(mp2));
              WinInvalidateRect(hwnd, NULLHANDLE,TRUE);
              return (MRESULT)0;
            }
            break;
        default:
          break;
        }
      break;
    case WM_MOUSEMOVE:
      if(WinQueryWindowULong(hwnd, SLDRAGGING)) {
        HPS hps;
        RECTL rcl, rcl2, rcl3;
        LONG lTemp;
        SHORT x=SHORT1FROMMP(mp1);
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
       
        lTemp=lPos;
     
        rcl.xLeft=WinQueryWindowULong(hwnd, SLIDERX);
        rcl.yBottom=WinQueryWindowULong(hwnd, SLIDERY);
        rcl.xRight=rcl.xLeft+WinQueryWindowULong(hwnd, SLIDERCX);
        rcl.yTop=rcl.yBottom+WinQueryWindowULong(hwnd, SLIDERCY);

        rcl2=rcl3=rcl;
        rcl.xLeft=x-WinQueryWindowUShort(hwnd, PTRPOSINSLARM);
        if(rcl.xLeft<rcl2.xLeft)/* Make sure we stop at the left border */
          rcl.xLeft=rcl2.xLeft;

        rcl.xRight=rcl.xLeft+usWidth;
        if(rcl.xRight>rcl2.xRight)
          {/* Make sure we stop at the right border */
            rcl.xRight=rcl2.xRight;
            rcl.xLeft=rcl.xRight-usWidth;
          }
        lPos=rcl.xLeft-WinQueryWindowULong(hwnd, SLIDERX);/* Save position zero based */
        WinSetWindowULong(hwnd, SLIDERARMPOS, lPos);
        if(lPos!=lTemp) {
          BOOL rc;

          hps=WinGetPS(hwnd);
          /* Paint Background not necessary here */

          /* Shaft */
          /* Left part */
          rcl3.xRight=rcl.xLeft;
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl3;
            oi.idItem=SDA_SLIDERSHAFT;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            WinFillRect(hps, &rcl3, CLR_GREEN);

          /* Right part */
          rcl3.xRight=rcl2.xRight;
          rcl3.xLeft=rcl.xRight;
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl3;
            oi.idItem=SDA_SLIDERSHAFT;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            WinFillRect(hps, &rcl3, CLR_WHITE);

          /* Paint Slider */
          rc=FALSE;
          if(USERSLIDER) {
            OWNERITEM oi={0};
            oi.hwnd=hwnd;
            oi.hps=hps;
            oi.fsState=SLS_OWNERDRAW;/* More to come */
            oi.rclItem=rcl;
            oi.idItem=SDA_SLIDERARM;
            rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                                MPFROMP(&oi) );
          }
          if(!rc)
            {
              WinFillRect(hps,&rcl, CLR_BLUE);
              WinDrawBorder(hps, &rcl, 2, 2, 0, 0 ,0x0400);
            }

          WinReleasePS(hps);

          /* Post SLN_SLIDERTRACK notification */
          WinPostMsg(WinQueryWindow(hwnd, QW_PARENT),WM_CONTROL, MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), SLN_SLIDERTRACK),
                     MPFROMLONG(lPos));
        }
      }
      break;
    case WM_PAINT:
      {
        HPS hps, hps2;
        RECTL rcl, rcl2, rcl3;
        POINTL ptl;
        LONG  lPos=WinQueryWindowULong(hwnd, SLIDERARMPOS);
        USHORT usWidth=WinQueryWindowUShort(hwnd, SLIDERARMWITH);
        BOOL rc;

        WinQueryWindowRect(hwnd, &rcl);

        /* Shaft */
        rcl2.xLeft=WinQueryWindowULong(hwnd, SLIDERX);
        rcl2.yBottom=WinQueryWindowULong(hwnd, SLIDERY);
        rcl2.xRight=rcl2.xLeft+WinQueryWindowULong(hwnd, SLIDERCX)-1;
        rcl2.yTop=rcl2.yBottom+WinQueryWindowULong(hwnd, SLIDERCY)-1;

        /* Background */
        hps2=WinGetPS(hwnd);
        GpiExcludeClipRectangle(hps2,&rcl2);
        WinFillRect(hps2, &rcl, CLR_PALEGRAY);
        WinReleasePS(hps2);
        rcl2.yTop+=1;
        rcl2.xRight+=1;

        hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE);
        /* Focus */
        if(WinQueryFocus(HWND_DESKTOP)==hwnd) {
          GpiSetLineType(hps, LINETYPE_DOT);
          ptl.x=rcl.xLeft;
          ptl.y=rcl.yBottom;
          GpiMove(hps,&ptl);
          ptl.x=rcl.xRight-1;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yTop-1;
          GpiLine(hps,&ptl);
          ptl.x=rcl.xLeft;
          GpiLine(hps,&ptl);
          ptl.y=rcl.yBottom;
          GpiLine(hps,&ptl);
        }

        rcl3=rcl=rcl2;

        /* Arm pos */        
        rcl2.xLeft+=lPos;
        /* Arm size */        
        rcl2.xRight=rcl2.xLeft+usWidth;
        
        /* Shaft */
        /* Left part */
        rcl3.xRight=rcl2.xLeft;
        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl3;
          oi.idItem=SDA_SLIDERSHAFT;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                    MPFROMP(&oi) );
        }
        if(!rc)
          WinFillRect(hps, &rcl3, CLR_GREEN);

        /* Right part */
        rcl3.xRight=rcl.xRight;
        rcl3.xLeft=rcl2.xRight;
        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl3;
          oi.idItem=SDA_SLIDERSHAFT;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                              MPFROMP(&oi) );
        }
        if(!rc)
          WinFillRect(hps, &rcl3, CLR_WHITE);

        rc=FALSE;
        if(USERSLIDER) {
          OWNERITEM oi={0};
          oi.hwnd=hwnd;
          oi.hps=hps;
          oi.fsState=SLS_OWNERDRAW;/* More to come */
          oi.rclItem=rcl2;
          oi.idItem=SDA_SLIDERARM;
          rc=(BOOL)WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_DRAWITEM, MPFROMSHORT(WinQueryWindowUShort(hwnd, QWS_ID)),
                              MPFROMP(&oi) );
        }
        if(!rc)
          {
            WinFillRect(hps,&rcl2, CLR_BLUE);        
            WinDrawBorder(hps, &rcl2, 2, 2, 0, 0 ,0x0400);
          }

        WinEndPaint(hps);
        return (MRESULT)0;
      }
      break;
    default:
      break;
    }

  return WinDefWindowProc(hwnd, msg, mp1, mp2);
}
예제 #19
0
BOOL launchPad::lpFillPad()
{
  HOBJECT hObject;
  char chrSetup[CCHMAXPATH];
  WPFolder* wpFolder;
  LPObject *lpoTemp;

  SWP swp;
  HWND hwndTemp;
  BTNCDATA btCtrl;
  WNDPARAMS wndParams;
  ULONG ulStyle;
  int a;
  LONG lXSize;
  HENUM hEnum;
  HWND hwndClient;
  LONG lCxSave;

  /* Remove Buttons from pad */
  lpClearPad();

  /* Resize the pad for all objects */
  if(!WinQueryWindowPos(hwndLaunchPad, &swp))
    return FALSE;


  lCxSave=swp.cx;

  lXSize=(ulNumObjects == 0 ? swp.cy : (ulNumObjects) * (swp.cy+xButtonDelta) +2*xButtonOffset);
  lpSetLaunchPadPos( NULLHANDLE,0,0, lXSize , swp.cy, SWP_SIZE);

  /* Move all controls on the right */
  /* Move all client windows so they keep their distance to the left border */
  hEnum=WinBeginEnumWindows(WinQueryWindow(hwndLaunchPad,QW_PARENT));
  while((hwndClient=WinGetNextWindow(hEnum))!=NULLHANDLE) {
    SWP swpClient;

    WinQueryWindowPos(hwndClient,&swpClient);
    if(swpClient.x > swp.x)
      WinSetWindowPos(hwndClient, NULLHANDLE, swpClient.x+(lXSize-lCxSave), swpClient.y, 0, 0, SWP_MOVE);
  }/* while */
  WinEndEnumWindows(hEnum);

  lpoTemp=lpoObjectList;
  for(a=ulNumObjects;a>0 && lpoTemp; a--)
    {
      /* Create Buttons */ 
      if((hwndTemp=WinCreateWindow(hwndLaunchPad, WC_BUTTON, lpoTemp->chrName, WS_VISIBLE, xButtonOffset+(a-1)*(swp.cy+xButtonDelta), 1, swp.cy-2, swp.cy-2,
                                   hwndLaunchPad, HWND_TOP, a*100,
                                   NULLHANDLE, NULLHANDLE))!=NULLHANDLE)
        {
          /* Change Style to mini icon */
          ulStyle=WinQueryWindowULong(hwndTemp,QWL_STYLE);
          ulStyle|=(BS_MINIICON);
          ulStyle&=~BS_TEXT;
          if(WinSetWindowULong(hwndTemp,QWL_STYLE,ulStyle)) {
            memset(&btCtrl,0,sizeof(btCtrl));
            btCtrl.cb=sizeof(btCtrl);
            btCtrl.hImage=lpoTemp->hPtr;
            memset(&wndParams,0,sizeof(wndParams));
            wndParams.fsStatus=WPM_CTLDATA;
            wndParams.cbCtlData=btCtrl.cb;
            wndParams.pCtlData=&btCtrl;
            WinSendMsg(hwndTemp,WM_SETWINDOWPARAMS,
                       MPFROMP(&wndParams),0);
            /* Subclass button for flyover help */
            oldButtonProc2=WinSubclassWindow(hwndTemp, newLaunchPadButtonProc);
            /* Set the class pointer into the window words */
            WinSetWindowULong(hwndTemp,QWL_USER,(ULONG)lpoTemp);//Save object ptr.
          }
        }
      lpoTemp=lpoTemp->lpoNext;
    }
  return TRUE;  
}
예제 #20
0
// *******************************************************************************
// FUNCTION:     wm_initdlg
//
// FUNCTION USE: Process WM_INITDLG messages for the dialog window
//
// DESCRIPTION:  Initialize the dialog controls with current data
//
// PARAMETERS:   HWND     dialog window handle
//               MPARAM   first message parameter
//               MPARAM   second message parameter
//
// RETURNS:      MRESULT  Reserved value of zero
//
// INTERNALS:    NONE
//
// *******************************************************************************
static MRESULT wm_initdlg( HWND hwnd, MPARAM mp1, MPARAM mp2 )
{
   PSETFORM    pSetForm = (PSETFORM)mp2;

// --------------------------------------------------------------------------      
// Remove the system menu items that are not needed by this dialog                 
// --------------------------------------------------------------------------      
   SetTheSysMenu(hwnd, NULL);

// --------------------------------------------------------------------------
// Establish unit of measure labels for the value set items
// --------------------------------------------------------------------------
   WinSendDlgItemMsg( hwnd, CID_MEASURE, VM_SETITEM,
                            MPFROMLONG(VSI_MM), "mm" );
   WinSendDlgItemMsg( hwnd, CID_MEASURE, VM_SETITEM,
                            MPFROMLONG(VSI_INCHES), "inches" );
   WinSendDlgItemMsg( hwnd, CID_MEASURE, VM_SETITEM,
                            MPFROMLONG(VSI_POINTS), "points" );

// --------------------------------------------------------------------------
// Select the current value set item
// --------------------------------------------------------------------------
   WinSendDlgItemMsg( hwnd, CID_MEASURE, VM_SELECTITEM,
                      MPFROMLONG( pSetForm->ulUnits ), 0L );

// --------------------------------------------------------------------------
// convert rectangle from LOMETRIC to current unit of measure
// --------------------------------------------------------------------------
   if (pSetForm->ulUnits == (ULONG)VSI_INCHES) {
      pSetForm->rectlMargins.xLeft = LMTOHIN( pSetForm->rectlMargins.xLeft );
      pSetForm->rectlMargins.xRight = LMTOHIN( pSetForm->rectlMargins.xRight );
      pSetForm->rectlMargins.yTop = LMTOHIN( pSetForm->rectlMargins.yTop );
      pSetForm->rectlMargins.yBottom =
                                     LMTOHIN( pSetForm->rectlMargins.yBottom );
   } else if (pSetForm->ulUnits == (ULONG)VSI_POINTS ) {
      pSetForm->rectlMargins.xLeft = LMTOPTS( pSetForm->rectlMargins.xLeft );
      pSetForm->rectlMargins.xRight = LMTOPTS( pSetForm->rectlMargins.xRight );
      pSetForm->rectlMargins.yTop = LMTOPTS( pSetForm->rectlMargins.yTop );
      pSetForm->rectlMargins.yBottom =
                                     LMTOPTS( pSetForm->rectlMargins.yBottom );
   } else {
      pSetForm->rectlMargins.xLeft = LMTOMM( pSetForm->rectlMargins.xLeft );
      pSetForm->rectlMargins.xRight = LMTOMM( pSetForm->rectlMargins.xRight );
      pSetForm->rectlMargins.yTop = LMTOMM( pSetForm->rectlMargins.yTop );
      pSetForm->rectlMargins.yBottom =
                                     LMTOMM( pSetForm->rectlMargins.yBottom );
   } /* endif */


// --------------------------------------------------------------------------
// set the text for the entry fields
// --------------------------------------------------------------------------
   SetEntryField( hwnd, CID_MAR_LEFT,
                       (USHORT)pSetForm->rectlMargins.xLeft, ulUnits );
   SetEntryField( hwnd, CID_MAR_TOP,
                       (USHORT)pSetForm->rectlMargins.yTop, ulUnits );
   SetEntryField( hwnd, CID_MAR_RIGHT,
                       (USHORT)pSetForm->rectlMargins.xRight, ulUnits );
   SetEntryField( hwnd, CID_MAR_BOTTOM,
                       (USHORT)pSetForm->rectlMargins.yBottom, ulUnits );

// --------------------------------------------------------------------------
// save off the internal structure pointer in the dialog instance data
// --------------------------------------------------------------------------
   WinSetWindowULong( hwnd, QWL_USER, (ULONG)pSetForm );

   return MRFROMLONG(FALSE);
}
예제 #21
0
// Callback function - handles messages sent to the dialog box
MRESULT EXPENTRY vncConnDialog::vncConnDlgProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
    // This is a static method, so we don't know which instantiation we're
    // dealing with. But we can get a pseudo-this from the parameter to
    // WM_INITDIALOG, which we therafter store with the window and retrieve
    // as follows:
    vncConnDialog *_this = (vncConnDialog *)WinQueryWindowULong(hwnd, QWL_USER);

    switch (msg) {

    // Dialog has just been created
    case WM_INITDLG:
    {
        // Save the lParam into our user data so that subsequent calls have
        // access to the parent C++ object
        WinSetWindowULong(hwnd, QWL_USER, (ULONG)mp2);
        vncConnDialog *_this = (vncConnDialog *)mp2;

        // Make the text entry box active
        WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, IDC_HOSTNAME));

        WinSendDlgItemMsg( hwnd, IDC_HOSTNAME, EM_SETTEXTLIMIT, MPFROMSHORT( 256 ) , MPVOID );
        // Return success!
        return (MRESULT)FALSE;
    }

    // Dialog has just received a command
    case WM_COMMAND:
        switch (SHORT1FROMMP(mp1))
        {

        // User clicked OK or pressed return
        case DID_OK:
        {
            char viewer[256];
            char hostname[256];
            VCard display_or_port;

            // Get the viewer to connect to
            WinQueryDlgItemText(hwnd, IDC_HOSTNAME, 256, (PSZ)viewer);

            // Process the supplied viewer address
            int result = sscanf(viewer, "%255[^:]:%u", hostname, &display_or_port);
            if (result == 1) {
                display_or_port = 0;
                result = 2;
            }
            if (result == 2) {
                // Correct a display number to a port number if required
                if (display_or_port < 100) {
                    display_or_port += INCOMING_PORT_OFFSET;
                }

                addClntThrdCD *t = new addClntThrdCD( _this->m_server , hostname , display_or_port );
                t->start();
                WinDismissDlg( hwnd , 0 );
            } else {
                // We couldn't process the machine specification
                WinMessageBox( HWND_DESKTOP , HWND_DESKTOP ,
                               (PSZ)"Unable to process specified hostname and display/port",
                               (PSZ)"Outgoing Connection", 10001, MB_OK | MB_ICONEXCLAMATION);
            }
        }
        return (MRESULT)FALSE;

        // Cancel the dialog
        case DID_CANCEL:
            WinDismissDlg( hwnd , 0 );
            return (MRESULT)FALSE;
        };
        break;
    }
    return WinDefDlgProc( hwnd , msg , mp1 , mp2 );
}
예제 #22
0
파일: kva.c 프로젝트: fabsther/vlc-mort
static void PMThread( void *arg )
{
    vout_display_t *vd = ( vout_display_t * )arg;
    vout_display_sys_t * sys = vd->sys;
    ULONG i_frame_flags;
    QMSG qm;
    char *psz_mode;
    ULONG i_kva_mode;

    /* */
    video_format_t fmt = vd->fmt;

    /* */
    vout_display_info_t info = vd->info;
    info.is_slow = false;
    info.has_double_click = true;
    info.has_hide_mouse = false;
    info.has_pictures_invalid = false;

    MorphToPM();

    sys->hab = WinInitialize( 0 );
    sys->hmq = WinCreateMsgQueue( sys->hab, 0);

    WinRegisterClass( sys->hab,
                      WC_VLC_KVA,
                      WndProc,
                      CS_SIZEREDRAW | CS_MOVENOTIFY,
                      sizeof( PVOID ));

    sys->b_fixt23 = var_CreateGetBool( vd, "kva-fixt23");

    if( !sys->b_fixt23 )
    {
        vout_window_cfg_t wnd_cfg;

        wnd_cfg.is_standalone = false;
        wnd_cfg.type          = VOUT_WINDOW_TYPE_HWND;
        wnd_cfg.x             = var_InheritInteger(vd, "video-x");
        wnd_cfg.y             = var_InheritInteger(vd, "video-y");
        wnd_cfg.width         = vd->cfg->display.width;
        wnd_cfg.height        = vd->cfg->display.height;

        /* If an external window was specified, we'll draw in it. */
        sys->parent_window =
            vout_display_NewWindow( vd, &wnd_cfg );
    }

    if( sys->parent_window )
    {
        sys->parent = ( HWND )sys->parent_window->handle.hwnd;

        /* Workaround :
         * When an embedded window opened first, it is not positioned
         * correctly. So reposition it here, again.
         */
        WinSetWindowPos( WinQueryWindow( sys->parent, QW_PARENT ),
                         HWND_TOP, 0, 0, 0, 0, SWP_MOVE );

        ULONG i_style = WinQueryWindowULong( sys->parent, QWL_STYLE );
        WinSetWindowULong( sys->parent, QWL_STYLE,
                           i_style | WS_CLIPCHILDREN );

        i_frame_flags = FCF_TITLEBAR;
    }
    else
    {
        sys->parent = HWND_DESKTOP;

        i_frame_flags = FCF_SYSMENU    | FCF_TITLEBAR | FCF_MINMAX |
                        FCF_SIZEBORDER | FCF_TASKLIST;
    }

    sys->frame =
        WinCreateStdWindow( sys->parent,      /* parent window handle */
                            WS_VISIBLE,       /* frame window style */
                            &i_frame_flags,   /* window style */
                            WC_VLC_KVA,       /* class name */
                            "",               /* window title */
                            0L,               /* default client style */
                            NULLHANDLE,       /* resource in exe file */
                            1,                /* frame window id */
                            &sys->client );   /* client window handle */

    if( sys->frame == NULLHANDLE )
    {
        msg_Err( vd, "cannot create a frame window");

        goto exit_frame;
    }

    WinSetWindowPtr( sys->client, 0, vd );

    if( sys->b_fixt23 )
    {
        WinSetWindowPtr( sys->frame, 0, vd );
        sys->p_old_frame = WinSubclassWindow( sys->frame, MyFrameWndProc );
    }

    psz_mode = var_CreateGetString( vd, "kva-video-mode" );

    i_kva_mode = KVAM_AUTO;
    if( strcmp( psz_mode, "snap" ) == 0 )
        i_kva_mode = KVAM_SNAP;
    else if( strcmp( psz_mode, "wo" ) == 0 )
        i_kva_mode = KVAM_WO;
    else if( strcmp( psz_mode, "vman" ) == 0 )
        i_kva_mode = KVAM_VMAN;
    else if( strcmp( psz_mode, "dive" ) == 0 )
        i_kva_mode = KVAM_DIVE;

    free( psz_mode );

    if( kvaInit( i_kva_mode, sys->client, COLOR_KEY ))
    {
        msg_Err( vd, "cannot initialize KVA");

        goto exit_kva_init;
    }

    kvaCaps( &sys->kvac );

    msg_Dbg( vd, "selected video mode = %s",
             psz_video_mode[ sys->kvac.ulMode - 1 ]);

    if( OpenDisplay( vd, &fmt ) )
    {
        msg_Err( vd, "cannot open display");

        goto exit_open_display;
    }

    if( vd->cfg->is_fullscreen )
    {
        if( sys->parent_window )
            vout_window_SetFullScreen(sys->parent_window, true);
        else
            WinPostMsg( sys->client, WM_VLC_FULLSCREEN_CHANGE,
                        MPFROMLONG( true ), 0 );
    }

    kvaDisableScreenSaver();

    /* Setup vout_display now that everything is fine */
    vd->fmt     = fmt;
    vd->info    = info;

    vd->pool    = Pool;
    vd->prepare = NULL;
    vd->display = Display;
    vd->control = Control;
    vd->manage  = Manage;

    /* Prevent SIG_FPE */
    _control87(MCW_EM, MCW_EM);

    sys->i_result = VLC_SUCCESS;
    DosPostEventSem( sys->ack_event );

    while( WinGetMsg( sys->hab, &qm, NULLHANDLE, 0, 0 ))
        WinDispatchMsg( sys->hab, &qm );

    kvaEnableScreenSaver();

    CloseDisplay( vd );

    /* fall through */

exit_open_display :
    kvaDone();

exit_kva_init :
    if( sys->b_fixt23 )
        WinSubclassWindow( sys->frame, sys->p_old_frame );

    WinDestroyWindow( sys->frame );

exit_frame :
    vout_display_DeleteWindow( vd, sys->parent_window );

    if( sys->is_mouse_hidden )
        WinShowPointer( HWND_DESKTOP, TRUE );

    WinDestroyMsgQueue( sys->hmq );
    WinTerminate( sys->hab );

    sys->i_result = VLC_EGENERIC;
    DosPostEventSem( sys->ack_event );
}
예제 #23
0
MRESULT EXPENTRY tButProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  HWND hwndFly = WinQueryWindowULong( hwnd, QWL_USER );

  switch( msg )
  {
    case WM_MOUSEMOVE:
    {
      if( !hwndFly && useBubbles )
        WinStartTimer( 0, hwnd, 1 /* unused id */, 500 );
      return ( *oldButProc )( hwnd, msg, mp1, mp2 );
    }
    break;

    case WM_TIMER:
    {
      RGB rgb;
      HPS hps;
      HAB hab;
      RECTL rectl;
      ULONG breite, hoehe;
      POINTL p;
      char str[200];

      if( hwndFly )
        break;

      hab = WinQueryAnchorBlock( hwnd );

      WinLoadString( hab, NULLHANDLE, WinQueryWindowUShort( hwnd, QWS_ID ),
                     sizeof( str ), str );

      hwndFly = WinCreateWindow( HWND_DESKTOP, WC_STATIC, str,
                                 SS_TEXT | DT_VCENTER | DT_CENTER,
                                 0, 0, 0, 0, hwnd, HWND_TOP, 0, 0, NULL );

      rgb.bBlue  = 0;
      rgb.bGreen = 254;
      rgb.bRed   = 254;
      WinSetPresParam( hwndFly, PP_BACKGROUNDCOLOR, sizeof( RGB ), &rgb );

      rgb.bBlue  = 0;
      rgb.bGreen = 0;
      rgb.bRed   = 0;
      WinSetPresParam( hwndFly, PP_FOREGROUNDCOLOR, sizeof( RGB ), &rgb );

      WinSetPresParam( hwndFly, PP_FONTNAMESIZE, sizeof( DefCntrFont ),
                       DefCntrFont );

      queryDimensions( hwndFly, str, &breite, &hoehe );

      WinQueryPointerPos( HWND_DESKTOP, &p );
      p.y -= WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR );
      p.y -= hoehe/2;
      p.x += 5;

      WinSetWindowPos( hwndFly, HWND_TOP, p.x, p.y, breite+4, hoehe+2,
                       SWP_SHOW | SWP_MOVE | SWP_SIZE );

      WinSetWindowULong( hwnd, QWL_USER, (ULONG) hwndFly );
    }
    break;

    case UM_FLYOVER_BEGIN:
      useBubbles = 1;
      break;

    case UM_FLYOVER_END:
      WinStopTimer( 0, hwnd, 1 /* unused id */ );
      if( hwndFly )
        WinDestroyWindow( hwndFly );
      WinSetWindowULong( hwnd, QWL_USER, 0 );
      break;

    default:
      return ( *oldButProc )( hwnd, msg, mp1, mp2 );
  }

  return FALSE;
}
예제 #24
0
//************************************************************************************************
// The allmighty StartupThread
//************************************************************************************************
void _Optlink StartupThread(void *pArg)
{
   AnchorBlock    ab;
   MessageQueue   mq(ab);
   PINITDATA      pinit = (PINITDATA)pArg;
   int            i;
   USHORT         usDeviceIndex = 0;     // default use default deviceindex
   USHORT         usVolume = 75;         // default 75% volume
   ULONG          ulError = 0;           // mci error
   MCI_OPEN_PARMS mciOpenParms;
   BOOL           fDeviceOpen = FALSE;

   //*********************************************************************************************
   // Set the lowest posible priority to make us systemfriendly
   //*********************************************************************************************
   DosSetPriority(PRTYS_THREAD, PRTYC_IDLETIME, PRTYD_MINIMUM, 0);


   //*********************************************************************************************
   // Clear some evetual garbage, just in case....
   //*********************************************************************************************
   WinSetWindowPtr(pinit->hWnd, QWP_PLAYLIST, NULL);
   WinSetWindowPtr(pinit->hWnd, QWP_CURRENTENTRY, NULL);
   WinSetWindowULong(pinit->hWnd, QWL_PLAYLISTENTRIES, 0);
   WinSetWindowUShort(pinit->hWnd, QWS_DEVICEID, 0);
   WinSetWindowULong(pinit->hWnd, QWL_LOOP, 0);   // do not loop by default


   //*********************************************************************************************
   // Parse the commandline
   //*********************************************************************************************
   for(i = 1; i < pinit->argc; i++)
   {
      switch(pinit->argv[i][0])
      {
         case '/':
         case '-':
            switch(pinit->argv[i][1])
            {
               case 'i':
               case 'I':
                  usDeviceIndex = (USHORT)atoi(&pinit->argv[i][2]);
                  break;

               case 'l':
               case 'L':
                  WinSetWindowULong(pinit->hWnd, QWL_LOOP, 1);
                  break;

               case 'v':
               case 'V':
                  usVolume = (USHORT)atoi(&pinit->argv[i][2]);
                  break;
            }
            break;

         default:
            AddToPlaylist(pinit->hWnd, pinit->argv[i]);
            break;
      }
   }

   // make sure we're at the first entry of the playlist
   WinSetWindowPtr(pinit->hWnd, QWP_CURRENTENTRY, WinQueryWindowPtr(pinit->hWnd, QWP_PLAYLIST));


   //*********************************************************************************************
   // open the waveaudio device
   //*********************************************************************************************
   memset((void*)&mciOpenParms, 0, sizeof(mciOpenParms));

   mciOpenParms.pszDeviceType = (PSZ)MAKEULONG(MCI_DEVTYPE_WAVEFORM_AUDIO, usDeviceIndex);
   ulError = mciSendCommand((USHORT)0, MCI_OPEN, MCI_WAIT | MCI_OPEN_TYPE_ID, (PVOID)&mciOpenParms, 0);

   if(LOUSHORT(ulError) == MCIERR_SUCCESS)
   {
      fDeviceOpen = TRUE;
      WinSetWindowUShort(pinit->hWnd, QWS_DEVICEID, mciOpenParms.usDeviceID);
   }

   if((fDeviceOpen == TRUE) && (WinQueryWindowULong(pinit->hWnd, QWL_PLAYLISTENTRIES) != 0))
   {
      MCI_SET_PARMS        msp;

      msp.ulLevel = usVolume;
      msp.ulAudio = MCI_SET_AUDIO_ALL;
      ulError = mciSendCommand(mciOpenParms.usDeviceID, MCI_SET, MCI_WAIT | MCI_SET_AUDIO | MCI_SET_VOLUME, (PVOID)&msp, 0);

      if(LOUSHORT(ulError) == MCIERR_SUCCESS)
      {
         WinSendMsg(WinWindowFromID(pinit->hWnd, SLRD_VOLUME), SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), MPFROMSHORT(usVolume));
         WinEnableWindow(WinWindowFromID(pinit->hWnd, SLRD_VOLUME), TRUE);
      }

      if((BOOL)WinSendMsg(pinit->hWnd, WMU_LOAD, NULL, NULL))
      {
         WinSendMsg(pinit->hWnd, WMU_PLAY, NULL, NULL);
      }
   }


   //*********************************************************************************************
   // free the initdata buffer
   //*********************************************************************************************
   delete pinit;

   // show the window
   SWP   swp;
   ULONG pulBufferMax = sizeof(swp);
   if(PrfQueryProfileData(HINI_USERPROFILE, "WavePlayer", "WindowPosition", (PVOID)&swp, &pulBufferMax))
      WinSetWindowPos(WinQueryWindow(pinit->hWnd, QW_PARENT), HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_SHOW | SWP_MOVE | SWP_SIZE);
   else
      WinShowWindow(WinQueryWindow(pinit->hWnd, QW_PARENT), TRUE);

   // bye, bye!
   _endthread();
}
VOID main()
{

  if ( (hab = WinInitialize( 0L )) == (HAB) NULL ){
     printf( "ToolBar Error:  WinInitialize failed \n" );
     return;
  }
  else {
     if ( (hmq = WinCreateMsgQueue( hab, 0 )) == (HMQ) NULL ){
        printf( "ToolBar Error:  WinCreateMsgQueue failed \n" );
        return;
     }
     else {

       ULONG fulCreate= FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
                        FCF_MINMAX | FCF_SHELLPOSITION | FCF_ICON  ;
               /*
                *  Note: no menu was specificed in create flags
                */

        WinSetPointer( HWND_DESKTOP,
                       WinQuerySysPointer(HWND_DESKTOP,SPTR_WAIT,TRUE));

        WinRegisterClass(hab, szClassName, (PFNWP)MainWindowProc, CS_SIZEREDRAW, 0);

        hwndFrame = WinCreateStdWindow(HWND_DESKTOP,
                                       0L,
                                       (PULONG)&fulCreate,
                                       szClassName ,
                                       szMainTitle,
                                       0L,
                                       (HMODULE)NULL,
                                       ID_MAIN_WIN,
                                       &hwndClient);
        if ( hwndFrame == NULLHANDLE ) {
           ShowErrorWindow( "Error creating Main window !", TRUE );
        }
        else {
           PFNWP     pfnwpOldFrameProc ;

             /* ---------  subclass frame proc  ------------------ */
           pfnwpOldFrameProc = WinSubclassWindow( hwndFrame,
                                                  (PFNWP) NewFrameProc );
           if ( pfnwpOldFrameProc == (PFNWP)0L ){
               ShowErrorWindow( "Error subclassing frame window !", TRUE );
           }
           else {
              PID       pid ;
              SWCNTRL   swCntrl;
              HSWITCH   hSwitch ;
              LONG      lRGB;

                /* -------  store old frame proc with handle  ------- */
              WinSetWindowULong( hwndFrame,
                                 QWL_USER,
                                 (ULONG) pfnwpOldFrameProc );

                /* ------------------ load menus  ------------------- */
              hwndMenuBar = WinLoadMenu( hwndFrame,
                                         (HMODULE)NULL,
                                         MID_MENUBAR );

              hwndToolBar = WinLoadMenu( hwndFrame,
                                         (HMODULE)NULL,
                                         MID_TOOLBAR );
                /*
                 *  Note that the last menu loaded, the toolbar, is the
                 *  one that is associated with the frame as "the" menu.
                 *  this means that hwndMenuBar is the only link to the
                 *  regular action bar, so hang onto it tightly
                 */

                /* ---------- set toolbar background color ---------- */
              lRGB =  WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0L );
              WinSetPresParam( hwndToolBar,
                               PP_BACKGROUNDCOLOR,
                               4L,
                               (PVOID)lRGB );

                /* ---------  set window size and pos  -------------- */
              WinSetWindowPos( hwndFrame,
                               HWND_TOP,
                               0, 0, 370, 300, 
                               SWP_SIZE | SWP_SHOW | SWP_ACTIVATE );

               /* ----------- add program to tasklist  --------------- */
              WinQueryWindowProcess( hwndFrame, &pid, NULL );
              swCntrl.hwnd = hwndFrame ;
              swCntrl.hwndIcon = (HWND) NULL ;
              swCntrl.hprog = (HPROGRAM) NULL ;
              swCntrl.idProcess = pid ;
              swCntrl.idSession = (LONG) NULL ;
              swCntrl.uchVisibility = SWL_VISIBLE ;
              swCntrl.fbJump = SWL_JUMPABLE ;
              sprintf( swCntrl.szSwtitle, szMainTitle );
              hSwitch = WinAddSwitchEntry((PSWCNTRL)&swCntrl);


              WinSetPointer(HWND_DESKTOP,
                            WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE));

                 /* ---------- start the main processing loop ----------- */
              while (WinGetMsg(hab, &qmsg,NULLHANDLE,0,0)){
                  WinDispatchMsg(hab, &qmsg);
              }

              WinRemoveSwitchEntry( hSwitch );
           } /* end of else ( pfnwpOldFrameProc ) */

           WinSetPointer(HWND_DESKTOP,
                         WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE));
           WinDestroyWindow(hwndFrame);
        }  /* end of else (hwndFrame == NULLHANDLE) */

        WinSetPointer(HWND_DESKTOP,
                      WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE));
        WinDestroyMsgQueue(hmq);
     }  /* end of else ( ...WinCreateMsgQueue() */

   WinTerminate(hab);
   }  /* end of else (...WinInitialize(NULL) */
}  /*  end of main() */
예제 #26
0
void Window::createWindow( Window *parent, Window *owner, char *text, 
                           char *windowClass,
                           Window *behind, ULONG windowStyle, int x, int y,
                           int width, int height )
{
  char str[50], *wClass;

  mouseButtonDown = FALSE;

  this->parent = parent;

  if( parent->getType() == DIALOG)
  	behind = (Window *)parent->getLastControl();

  type = WINDOW;
  this->id = Iterator::getNext();

  Application::tempthis = this;

  oldWndProc = NULL;

  if( windowClass == 0L )
  {
    currentPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE );

		strcpy( str, "KONBASEWINDOW" );
		if( !baseClassRegistered )
		{
			baseClassRegistered = TRUE;
			if( !WinRegisterClass( Application::hab, (PSZ)str, //(PSZ)itoa( id, str, 10),
												WndProc, CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT,
												sizeof(Window *) ) )
			{
				exit( 1 );
			}
		}
    wClass = str;
  }
  else
  {
    currentPointer = NULLHANDLE;
    wClass = windowClass;
  }

	if( windowStyle & WS_DISABLED )
	{
		windowStyle &= ~WS_DISABLED;
		isPopupWin = TRUE;
	}

  hWndFrame = hWndClient = WinCreateWindow( (isPopupWin) ? HWND_DESKTOP : parent->getHWND(), wClass, text,
                                            windowStyle, x, y, width, height,
                                            owner->getHWND(),
                                            (behind == NULL) ? HWND_TOP : behind->getHWND(),
                                            id, 0L, 0L );

  // Subclass window

  if( wClass == windowClass )
  {
    WinSetWindowULong(hWndFrame,0,(ULONG)this);
    oldWndProc = WinSubclassWindow( hWndFrame, (PFNWP)WndProc );
  }

  if( hWndFrame == NULLHANDLE )
  {
    DosBeep( 1000, 100 );
    char wText[501];
    WinQueryWindowText( parent->getHWNDFrame(), 500, wText );
  }

  graphics = new Graphics( WinGetPS( hWndClient ) );
}
/*---------------------------------------------------
 * Process dialog messages
 *--------------------------------------------------*/
MRESULT _System KLSetupHKeys::dlg_proc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
  switch ( msg )
  {
    case WM_INITDLG:
    {
      KLSetupHKeys* instance = (KLSetupHKeys*)mp2;

      SET_TEXT( hwnd, ID_KEY_TEXT, MSG_KEYPROMPT );
      KLApp::do_warpsans( hwnd, ID_KEY_TEXT );
      WinSetWindowULong( hwnd, QWL_USER, (ULONG)instance );
      instance->hk_exclude = hkey_exclude( hwnd );
      break;
    }

    case WM_DESTROY:
    {
      KLSetupHKeys* instance = (KLSetupHKeys*)WinQueryWindowULong( hwnd, QWL_USER );

      hkey_exclude( instance->hk_exclude );
      instance->hk_exclude = NULLHANDLE;
    }

    case WM_COMMAND:
      if( SHORT1FROMMP(mp1) == DID_CANCEL )
        WinDismissDlg( hwnd, FALSE );

      return MRFROMLONG(TRUE);

    case WM_CLOSE:
      WinDismissDlg( hwnd, FALSE );
      return MRFROMLONG(TRUE);

    case WM_CHAR:
      if( !( CHARMSG(&msg)->fs & KC_KEYUP )
          && CHARMSG(&msg)->vkey != VK_NUMLOCK
          && CHARMSG(&msg)->vkey != VK_ESC
          && CHARMSG(&msg)->vkey != VK_PRINTSCRN
          && CHARMSG(&msg)->vkey != VK_PAUSE
          && CHARMSG(&msg)->vkey != VK_SHIFT
          && CHARMSG(&msg)->vkey != VK_CTRL
          && CHARMSG(&msg)->vkey != VK_ALT
          && CHARMSG(&msg)->vkey != VK_CAPSLOCK
          && CHARMSG(&msg)->vkey != VK_SCRLLOCK
          && CHARMSG(&msg)->scancode
        )
      {
        KLSetupHKeys* instance = (KLSetupHKeys*)WinQueryWindowULong( hwnd, QWL_USER );

        if( instance )
        {
          instance->hk_state    = 0;
          instance->hk_scancode = CHARMSG(&msg)->scancode;

          if( CHARMSG(&msg)->fs & KC_CTRL  ) instance->hk_state |= KLHotkey::control;
          if( CHARMSG(&msg)->fs & KC_ALT   ) instance->hk_state |= KLHotkey::alt;
          if( CHARMSG(&msg)->fs & KC_SHIFT ) instance->hk_state |= KLHotkey::shift;

          instance->hk_assigned->assign( instance->hk_scancode, instance->hk_state );
        }

        WinDismissDlg( hwnd, TRUE );
        return MRFROMLONG(TRUE);
      }
      break;
  }

  return WinDefDlgProc( hwnd, msg, mp1, mp2 );
}
예제 #28
0
MRESULT EXPENTRY EDImgWinProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
   // alla creazione estrae dal testo del controllo il nome della libreria
   // e l'ID della risorsa da cui ricavare l'immagine
   switch (msg) {
      case WM_CREATE: {
         LHANDLE himg;        // handle immagine
         PSZ psz;             // per ricavare nome modulo e id risorsa
         ULONG idres;         // id risorsa
         HLIB hlib;
         HAB hab;
         SIZEL szl;
   
         hab = WinQueryAnchorBlock(hwnd);
         // cerca primo tab lo cambia in 0 e carica lib
         if (!(psz = memchr((PVOID)((PCREATESTRUCT)mp2)->pszText, '\t', 9)))
            goto error0;
         *psz = 0;                          
         if (!(hlib = WinLoadLibrary(hab, ((PCREATESTRUCT)mp2)->pszText)))
            goto error0;
         // ottiene handle e dimensione immagine
         if (!(idres = strtoul(++psz, NULL, 10))) goto error1;
         if (((PCREATESTRUCT)mp2)->flStyle & (ESI_PTR | ESI_ICON | ESI_MINI)) {
            if (!(himg = WinLoadPointer(HWND_DESKTOP, hlib, idres)))
               goto error1;
            if (((PCREATESTRUCT)mp2)->flStyle & ESI_PTR) {          // pointer
               szl.cx = WgetSysValue(SV_CXPOINTER);
               szl.cy = WgetSysValue(SV_CYPOINTER);
            } else if (((PCREATESTRUCT)mp2)->flStyle & ESI_ICON) {  // icona
               szl.cx = WgetSysValue(SV_CXICON);
               szl.cy = WgetSysValue(SV_CYICON);
            } else {                               // minicona
               szl.cx = WgetSysValue(SV_CXICON) / 2;
               szl.cy = WgetSysValue(SV_CYICON) / 2;
            } // end if
         } else {                                  // bitmap
            if (!(himg = WloadBitmap(hwnd, hlib, idres)))
               goto error1;                                   
            if (!WqueryBitmapSize(himg, &szl))
               goto error2;
         } // end if
         WinDeleteLibrary(hab, hlib);
         // memorizza handle immagine
         WinSetWindowULong(hwnd, cbWCstc, (ULONG)himg);
         *((PCREATESTRUCT)mp2)->pszText = 0;
         //break;
         WinSetWindowPos(hwnd, 0, 0, 0, szl.cx, szl.cy, SWP_SIZE|SWP_NOADJUST);
         break;
         
         error2: GpiDeleteBitmap(himg);
         error1: WinDeleteLibrary(hab, hlib);
         error0: return (MRESULT)TRUE;
      } // end case WM_CREATE
      case WM_ADJUSTWINDOWPOS:    // default window processing
         return WinDefWindowProc(hwnd, msg, mp1, mp2);
      case WM_PAINT: {
         LHANDLE himg = (LHANDLE)WinQueryWindowULong(hwnd, cbWCstc);
         ULONG flStyle = WinQueryWindowULong(hwnd, QWL_STYLE);
         HPS hps;
         hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
         if (flStyle & (ESI_PTR | ESI_ICON | ESI_MINI)) {
            WinDrawPointer(hps, 0, 0, himg,
                           (flStyle & ESI_MINI? DP_MINI: DP_NORMAL));
         } else {
            POINTL ptl = {0,0};
            WinDrawBitmap(hps, himg, NULL, &ptl, 0, 0, DBM_NORMAL);
         } // end if
         WinEndPaint(hps);
         return (MRESULT)FALSE;
      }  // end case WM_PAINT
      // restituisce handle immagine corrente
      case SM_QUERYHANDLE:
         return (MPARAM)WinQueryWindowULong(hwnd, cbWCstc);
      // memorizza nuovo handle immagine, forza repaint e restituisce
      // handle precedente immagine
      case SM_SETHANDLE: {
         LHANDLE himg = (LHANDLE)WinQueryWindowULong(hwnd, cbWCstc);
         if (!WinSetWindowULong(hwnd, cbWCstc, (ULONG)mp1))
            return NULLHANDLE;
         WinRefreshWin(hwnd);
         return (MRESULT)himg;
      } // end case SM_SETHANDLE
      case WM_MATCHMNEMONIC:
         return (MRESULT)FALSE;
      case WM_DESTROY: {
         LHANDLE himg = (LHANDLE)WinQueryWindowULong(hwnd, cbWCstc);
         if (WinQueryWindowULong(hwnd, QWL_STYLE) &
                                (ESI_PTR | ESI_ICON | ESI_MINI)) {
            WinDestroyPointer(himg);
         } else {
            GpiDeleteBitmap(himg);
         } // end if
      }  break;
   } /* endswitch */
   return pfnwpWCstc(hwnd, msg, mp1, mp2); // default static controls processing
}
예제 #29
0
MRESULT EXPENTRY fnConfigDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  HWND hwndOwner;
  SWP swpDlg, swpOwner;
  POINTL ptlTemp;
  ConfigDlgInitParams_p pCfgDlgInit;

  switch (msg)
  {
    case WM_INITDLG:
      // Store window instance data pointer in window words
      WinSetWindowULong(hwnd, QWL_USER, (ULONG) mp2);
      pCfgDlgInit = (ConfigDlgInitParams_p) mp2;

      // Set dialog control texts and fonts based on
      // current language
      internal_SetPageFont(hwnd);
      internal_SetConfigDialogText(hwnd, pCfgDlgInit->pchHomeDirectory);

      // Set initial position of dialog window and show it
      WinQueryWindowPos(hwnd, &swpDlg);
      hwndOwner = WinQueryWindow(hwnd, QW_OWNER);
      WinQueryWindowPos(hwndOwner, &swpOwner);
      ptlTemp.x = swpOwner.x; ptlTemp.y = swpOwner.y;
      WinMapWindowPoints(WinQueryWindow(hwndOwner, QW_PARENT), HWND_DESKTOP, &ptlTemp, 1);
      WinSetWindowPos(hwnd, HWND_TOP,
            ptlTemp.x + (swpOwner.cx - swpDlg.cx)/2,
            ptlTemp.y + (swpOwner.cy - swpDlg.cy)/2,
            0, 0, SWP_MOVE | SWP_SHOW);
      //setup the dialog
      WinSendDlgItemMsg(hwnd, EF_TEXT, EM_SETTEXTLIMIT, MPFROMSHORT(256), NULL);
      WinSetWindowText(WinWindowFromID(hwnd, EF_TEXT), pCfgDlgInit->pchText);
      internal_AdjustConfigDialogControls(hwnd);
     return (MRESULT) FALSE;

    case WM_COMMAND:
        switch (SHORT1FROMMP(mp1)) {
          case PB_CONFOK:
            pCfgDlgInit = (ConfigDlgInitParams_p) WinQueryWindowULong(hwnd, QWL_USER);
            if (pCfgDlgInit) {
               char buff[255];
               buff[0]= '\0';
               WinQueryWindowText(WinWindowFromID(hwnd, EF_TEXT), 248, &buff);
               strcpy(pCfgDlgInit->pchText, buff);
               /*AddLog(buff);
               AddLog(pCfgDlgInit->pchText);*/

            }
          break;

          case PB_CONFCANCEL:
            // restore the old image
            pCfgDlgInit = (ConfigDlgInitParams_p) WinQueryWindowULong(hwnd, QWL_USER);
            if (pCfgDlgInit) {
            }
          break;
        }
    break;

    default:
      break;
  }
  return WinDefDlgProc(hwnd, msg, mp1, mp2);
}
예제 #30
-1
//==============================================================================
// WndProc - this function vectors WndProc (window processing) message handling
//           requests to the correct message handler
//==============================================================================
MRESULT EXPENTRY _export WndProc(HWND hWnd, ULONG iMessage, MPARAM mParam1, MPARAM mParam2)
{
    Window *pWindow = (Window *)WinQueryWindowULong(hWnd,0);
    if  (pWindow == 0) {
        if (iMessage == WM_CREATE) {
            pWindow = Main::tempthis;
            WinSetWindowULong(hWnd,0,(ULONG)pWindow);
            return pWindow->WndProc(hWnd,iMessage,mParam1,mParam2);
            }
        else return WinDefWindowProc(hWnd,iMessage,mParam1,mParam2);
        }
    else return pWindow->WndProc(hWnd,iMessage,mParam1,mParam2);
}