Ejemplo n.º 1
0
Archivo: GUI.c Proyecto: byterj/IRW_1.4
void AddTab(HWND TabWnd, const char *Name, int Resizeable)
{
	RECT TabRect;
	TCITEM tci;

	GetClientRect(TabWnd, &TabRect);
	Tabs[TabCount].Wnd = TabWnd;
	Tabs[TabCount].Name = Name;
	Tabs[TabCount].Resizeable = Resizeable;
	Tabs[TabCount].Width = TabRect.right;
	Tabs[TabCount].Height = TabRect.bottom;

	ShowWindow(TabWnd, SW_HIDE);

	tci.mask = TCIF_TEXT;
	tci.iImage = -1;
	tci.pszText = (LPSTR)Name;
	TabCtrl_InsertItem(MainTabWnd, TabCount, &tci);
	TabCount++;

	/* activate the first tab */
	if(TabCount == 1)
		ActivateTab(0);

	return;
}
Ejemplo n.º 2
0
/**
 * WM_CREATE handler. Creates the tab window as child window. Installs
 * ourselves as context menu owner. Adds one custom pane and activates
 * this pane.
 *
 * @param           lpCreateStruct: creation information
 * @return          0 on success, -1 on failure
 * @exception       -
 * @see             
*/
int CWatchWindow::OnCreate (LPCREATESTRUCT lpCreateStruct) 
{
    if (SECControlBar::OnCreate (lpCreateStruct) == -1)
        return (-1);

    DWORD style = GetExBarStyle();
    style |= CBRS_EX_STDCONTEXTMENU;
    style |= CBRS_EX_ALLOW_MDI_FLOAT;
    SetExBarStyle(style);

    if (m_pTabWindow == NULL)
        return (-1);

    if (!m_pTabWindow->Create (this, WS_CHILD | WS_VISIBLE | TWS_FULLSCROLL | TWS_TABS_ON_BOTTOM | TWS_NOACTIVE_TAB_ENLARGED | TWS_DYNAMIC_ARRANGE_TABS))
        return (-1);

    m_pTabWindow->SetContextMenuOwner (this);

    if(AddCustomPane() == -1)
    {
        return -1;
    }

    ActivateTab(0);
    
    return (0);
}
Ejemplo n.º 3
0
void CNavPaneWnd::ActivateTab(CWnd* pTabContent, bool bExpand)
{
	int nTab = GetTabIndex(pTabContent);
	if (nTab == -1)
		return;

	ActivateTab(nTab, bExpand);
}
Ejemplo n.º 4
0
void CDockableDataViews::SetTabSelection(const std::_tstring & label, int row, int col)
{
    StringSourceMap::const_iterator itr = m_sourceTabs.find(label);
    if (itr != m_sourceTabs.end())
    {
        itr->second->SelectLine(row, col);
        ActivateTab(itr->second);
    }
}
Ejemplo n.º 5
0
void CDockableDataViews::SetTabSelection(const std::_tstring & label, const roxie::CSearchRowVector & searchResults)
{
    StringResultMap::iterator itr = m_dataTabs.find(label);
    if (itr != m_dataTabs.end())
    {
        itr->second->SetTabSelection(searchResults);
        ActivateTab(itr->second);
    }
}
Ejemplo n.º 6
0
void CDockableDataViews::SetTabData(const std::_tstring & label, const ITable * data, bool hasRowNum, const roxie::CSearchRowVector & searchResults)
{
    StringResultMap::iterator itr = m_dataTabs.find(label);
    if (itr == m_dataTabs.end())
    {
        m_dataTabs[label] = new CDataView();
        m_dataTabs[label]->Create(NULL, label.c_str(), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndTab, 1);
        m_dataTabs[label]->SetFont(&afxGlobalData.fontRegular);
        m_wndTab.InsertTab(m_dataTabs[label], label.c_str(), 0, 0, FALSE);
    }
    m_dataTabs[label]->SetData(data, hasRowNum, searchResults);
    ActivateTab(m_dataTabs[label]);
}
Ejemplo n.º 7
0
void
TZNoteBook::EndPaint( )
{
   if ( mIs_hWnd( m_hWnd ) )
   {
      CString cs = "Sel." + m_csTag;
      zLONG lCurrSel = GetProfileNbr( m_pPainterWindow->m_vDialog, "Design",
                                      m_pPainterWindow->m_csDlgTag,
                                      m_pPainterWindow->m_csWndTag, cs );
#ifdef DEBUG_ALL
      TraceLineI( "TZNoteBook::EndPaint: ", lCurrSel );
#endif

      m_bInitialized = TRUE;
      SetCurSel( 0 );
      PostMoveCtrl( );

      SetVisibility( 0x0100, -1, 1 );  // set all children invisible
      SetVisibility( 0x0101, 0, -1 );  // set self (only) visible/selectable

      if ( m_pCtrlCover )
         m_pCtrlCover->SetWindowPos( 0, 0, 0, 0, 0,
                                     SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW |
                                       SWP_NOZORDER | SWP_HIDEWINDOW );

      Invalidate( );
      if ( lCurrSel > 0 )
         ActivateTab( (zSHORT) lCurrSel );
      else
         ActivateTab( 1 );

      UpdateWindow( );
   }

// if ( m_pCtrlCover )
//    m_pCtrlCover->SetWindowPos( 0, 0, 0, 0, 0,
//                                SWP_NOSIZE | SWP_NOMOVE | SWP_NOREDRAW |
//                                   SWP_NOZORDER | SWP_SHOWWINDOW );
}
Ejemplo n.º 8
0
void CNavPaneWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
	CSize szClient = ::GetClientSize(this);
	if (szClient.cx > 70)
	{
		if (m_rcClose.PtInRect(point))
		{
			m_bDragging = true;
			UpdateButtons();
			SetCapture();
			return;
		}
		else if (m_rcSettings.PtInRect(point))
		{
			m_bSettingsPressed = true;
			InvalidateRect(m_rcSettings);
			UpdateWindow();

			CRect rcButton = m_rcSettings;
			ClientToScreen(rcButton);
			if (m_nActiveTab != -1)
				m_tabs[m_nActiveTab].pWnd->SendMessage(WM_SHOW_SETTINGS, 0, (LPARAM)(LPRECT) rcButton);

			// Eat mouse messages during popupmenu
			MSG msg;
			if (::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_NOREMOVE))
			{
				if (rcButton.PtInRect(msg.pt))
					::PeekMessage(&msg, m_hWnd, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE);
			}

			m_bSettingsPressed = false;
			m_bSettingsActive = false;
			InvalidateRect(m_rcSettings);
			UpdateWindow();
			return;
		}
	}

	int nTabClicked = GetTabFromPoint(point);
	if (nTabClicked != -1)
	{
		if (GetParent()->SendMessage(WM_CLICKED_NAV_TAB, 0, (LPARAM) m_tabs[nTabClicked].pWnd))
			ActivateTab(nTabClicked, true);
	}

	UpdateButtons();
	CWnd::OnLButtonDown(nFlags, point);
}
Ejemplo n.º 9
0
/**
 * Show the "Forced" pane.
 *
 * @param           -
 * @return          -
 * @exception       -
 * @see             
*/
void CWatchWindow::ShowForcedPane ()
{

    // Should have a "Forced" pane to make it visible.
    //////////////////////////////////////////////////

    ASSERT (m_iForcedPaneTab != -1);
    if (m_iForcedPaneTab == -1)
        return;


    // Activate the "Forced" pane's tab.
    ////////////////////////////////////

    ActivateTab (m_iForcedPaneTab);
}
Ejemplo n.º 10
0
/**
 * Shows a custom pane
 *
 * @param           iCustomPane: index of custom pane to show
 *                               (0..number of custom panes - 1)
 * @return          -
 * @exception       -
 * @see             
*/
void CWatchWindow::ShowCustomPane (int iCustomPane)
{

    // Must be given the index of a custom pane tab.
    // Otherwise our caller did something wrong.
    ////////////////////////////////////////////////

    ASSERT (iCustomPane >= 0 && iCustomPane < m_iCustomPaneCount);
    if (iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount)
        return;


    // Activate the custom pane's tab.
    //////////////////////////////////

    ActivateTab (iCustomPane);
}
Ejemplo n.º 11
0
void
TZNoteBook::SelChange( NMHDR *pNMHDR, LRESULT *pResult )
{
// Default( );

   zSHORT nCurrIdx = GetCurSel( );
#ifdef DEBUG_ALL
   TraceLineI( "TZNoteBook::SelChange: ", nCurrIdx );
#endif

   *pResult = 0;
   TZNotePage *pCurrNotePage = GetActivePage( );
   if ( pCurrNotePage )
   {
      ActivateTab( pCurrNotePage->m_nTabNbr );
   }
}
Ejemplo n.º 12
0
/**
 * load settings.
 *
 * @param           [in] pWatchSettings: pointer to watch settings
 * @return          -
 * @exception       -
 * @see             -
*/
void CWatchWindow::LoadSettings(CWatchSettings& rtWatchSettings)
{
    HRESULT hr;
    CWatchControlWrapper *pWrapper;
    CString strName;
    CString strXMLString;
    int     iTmp;

    //run over all panes of watch settings
    int iNumPanes = rtWatchSettings.GetPaneCount();

    rtWatchSettings.GetPaneInfo(0, strName, strXMLString);
    pWrapper = GetCustomPaneWrapper(0);
    hr = pWrapper->LoadFromXMLString(strXMLString);
    if(hr != S_OK)
    {
        return;
    }
    if(!strName.IsEmpty())
    {
        SetTabType(0, eImportExport);
        SetTabLabel(0, strName);
    }

    for(int iPane = 1; iPane < iNumPanes; ++iPane)
    {
        rtWatchSettings.GetPaneInfo(iPane, strName, strXMLString);
        iTmp = AddCustomPane(strName);
        pWrapper = GetCustomPaneWrapper(iPane);
        hr = pWrapper->LoadFromXMLString(strXMLString);
        if(hr != S_OK)
        {
            break;
        }
    }
    int iActiveTab = rtWatchSettings.GetActiveTab();
    if(iActiveTab >= 0 && iActiveTab < m_iCustomPaneCount)
    {
        ActivateTab(iActiveTab);
    }

    // now delete all panes
    rtWatchSettings.Reset();
}
void CGraphicTabControl::ChangeTabClient( int iTab, CWnd* pClient )
{
	if( m_bChangingClient )
		return;
	ASSERT_RETURN( iTab >= 0 && iTab < GetTabCount() && pClient != NULL );

	if( TabExists( pClient ) ) {
		// make sure window is shown and update tab bar layout
		pClient->ShowWindow(SW_SHOW);
		RecalcLayout();
		UpdateWindow();
		return;  // nothing to do
	}

	SECTab* ptab = GetTabPtr(iTab);
	ASSERT_RETURN( ptab );
	CWnd* pOldClient = (CWnd*)ptab->m_pClient;
	// check to see if we really need to do anything
	if( pOldClient == pClient ) {
		pClient->ShowWindow( SW_SHOW );
		return;
	} 
	m_bChangingClient = true;
	// hide both windows
	pClient->ShowWindow(SW_HIDE);
	pOldClient->ShowWindow(SW_HIDE);
	CString tabName = ptab->m_csLabel;
	InsertTab( iTab, tabName, pClient, NULL, NULL );
	// remove old tab
	ActivateTab( iTab );
	DeleteTab( iTab + 1 );
	pClient->ShowWindow(SW_SHOW);
	RecalcLayout();
	UpdateWindow();
	m_bChangingClient = false;
	return;
}
Ejemplo n.º 14
0
Archivo: GUI.c Proyecto: byterj/IRW_1.4
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	NMHDR *nmptr = NULL;

	switch(uMsg)
	{
		case WM_SIZE:
		{
			MoveWindow(MainTabWnd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);

			if(FixTabSize() == 0)
				MoveWindow(Tabs[TabCtrl_GetCurSel(MainTabWnd)].Wnd, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
		}break;
		case WM_NOTIFY:
		{
			nmptr = (NMHDR*)lParam;
			if(nmptr->code == TCN_SELCHANGE)
				ActivateTab(TabCtrl_GetCurSel(MainTabWnd));
		}
		break;
	}

	return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
Ejemplo n.º 15
0
/**
 * Loads Active X Control in a custom pane with file content.
 *
 * @param           iCustomPane: index of custom pane to load
 *                               (0..number of custom panes - 1)
 *                               if index is -1, the context index is used
 *                               if this is not valid, a new pane will be added
 *                               and the index is set to this pane.
 *                  strPath    : File path
 *                               if File path is empty, a file selection box appears
 * @return          Error code
 * @exception       -
 * @see             
*/
HRESULT CWatchWindow::LoadCustomPane (int iCustomPane /*=-1*/, CString strPath /*=_T("")*/)
{
    HRESULT hr;
    CWatchControlWrapper *pWrapper;
    BOOL    bAddedPane = FALSE;

    if(iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount)
    {
        iCustomPane = m_iContextMenuTab;
        if(iCustomPane < 0 || iCustomPane >= m_iCustomPaneCount)
        {
            iCustomPane = AddCustomPane();
            ActivateTab(iCustomPane);
            bAddedPane = TRUE;
        }
    }

    if(strPath.IsEmpty())
    {
        strPath = QueryWatchFile(false);
        // if user pressed cancel -> return S_FALSE
        // if pane was added -> remove it
        if(strPath.IsEmpty())
        {
            if(bAddedPane)
            {
                RemoveCustomPane(iCustomPane);
            }
            return S_FALSE;
        }
    }

    // Get Active X Control wrapper of custom pane.
    ///////////////////////////////////////////////

    pWrapper = GetCustomPaneWrapper (iCustomPane);
    if (pWrapper == NULL)
        return (E_UNEXPECTED);


    // Tell wrapper to load file content into Active X Control.
    ///////////////////////////////////////////////////////////

    hr = pWrapper->Load (strPath);
    if(hr == S_OK)
    {
        CString strFileName;
        CString strTabName;
        int     iFound = strPath.ReverseFind(_T('\\'));

        strFileName = strPath.Mid(iFound+1);
        iFound = strFileName.ReverseFind(_T('.'));
        if(iFound > 0)
        {
            strTabName = strFileName.Left(iFound);
        }
//        if(GetTabType(iCustomPane) < eManual)   // eAutomatic or eImportExport
//        {
            m_pTabWindow->RenameTab(iCustomPane, strTabName);
            SetTabType(iCustomPane, eImportExport);
//        }
    }
    return S_OK;
}
Ejemplo n.º 16
0
LRESULT CALLBACK 
ClientWndProc (HWND hwnd, UINT mMsg, WPARAM wParam, LPARAM lParam)
     {
	RECT rect;

     switch (mMsg)
          {
          case WM_CREATE :
			   poppad_ini( hwnd,lParam );
               return 0 ;

          case WM_DESTROY :
               //DeleteObject (hbr) ;
			   DestroyMenu(hMenu) ;
			   poppad_bye();
               return 0 ;

		  case WM_INITMENUPOPUP :
			   return poppad_menupop( (WPARAM)hSubMenu, -1 );

//          case WM_CTLCOLOREDIT :
//               {
//               DefWindowProc (hwnd, mMsg, wParam, lParam) ;
//               SetBkColor ((HDC) wParam, crBack) ;
//               //SetBkMode ((HDC) wParam, TRANSPARENT) ;
//			   SetTextColor( (HDC) wParam, crText );
//               return (LRESULT) (HBRUSH) hbr ;
//               }

          case WM_SETFOCUS :
//               hwndNotify = GetWindow (hwnd, GW_CHILD) ;
//               SetFocus (hwndNotify) ;
			   Footy2SetFocus(activeFootyID, 0);
               return 0 ;

          case WM_SIZE :
               {
//               hwndNotify = GetWindow (hwnd, GW_CHILD) ;
               int cx = LOWORD (lParam) ;
               int cy = HIWORD (lParam) ;

               // Ignore if notification window is absent.
//               if (hwndNotify != NULL)
//                    {
//                    MoveWindow (hwndNotify, 0, 0, cx, cy, TRUE) ;
//                    }
			   MoveWindow(hwndTab, 0, 0, cx, cy, TRUE);
			   GetClientRect(hwndTab, &rect);
			   TabCtrl_AdjustRect(hwndTab, FALSE, &rect);
			   Footy2Move(activeFootyID, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top);
			   poppad_setsb_current(activeFootyID);

			   return 0 ;
               }

          case WM_NOTIFY:
			  switch (((NMHDR *)lParam)->code){
				   case TCN_SELCHANGE:
				   {
					   int presID = activeID, newID = TabCtrl_GetCurSel(hwndTab);
					   ActivateTab(presID, newID);
					   ChangeZOrder(presID, newID);
					   return 0;
				   }

				   case NM_RCLICK:
					   POINT pt, cpt;
					   int i;

					   GetCursorPos(&pt);
					   cpt = pt;
					   ScreenToClient(hwndTab, &cpt);

					   for(i = 0; TabCtrl_GetItemCount(hwndTab); i++){
						   TabCtrl_GetItemRect(hwndTab, i, &rect);
						   if(rect.left <= cpt.x && cpt.x <= rect.right && rect.top <= cpt.y && cpt.y <= rect.bottom){
							   TrackPopupMenu(hSubMenu2, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwndClient, NULL);
							   ClickID = i;
							   break;
						   }

					   }
 					   return 0;
			  }
			  return 0;

          default :
               return (EditProc (hwnd, mMsg, wParam, lParam)) ;
               //return (DefWindowProc (hwnd, mMsg, wParam, lParam)) ;
          }
     }