Example #1
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;

    InitMenu(IDR_MAINFRAME);
    InitToolBar(IDR_MAINFRAME);
    InitStatusBar(indicators,sizeof(indicators)/sizeof(UINT));
    // TODO: Delete these three lines if you don't want the toolbar to
    //  be dockable

    m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
    EnableDocking(CBRS_ALIGN_ANY);
    m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
    m_wndMenuBar.SetSaveHistory("MyHistory1",TRUE);
    m_wndMenuBar.CreateCombo(&m_combMenu,IDC_COMBOMENU,150);

    DockControlBar(&m_wndMenuBar,m_dockTop);
    DockControlBar(&m_wndToolBar,m_dockTop);
    m_wndStatusBar.SetStyle(CGuiStatusBar::OFFICE);

    DockControlBar(&m_wndToolBar);
    sProfile = _T("GuiTabbedDemo");
    LoadBars();
    InitMDITabbed();
    m_MdiTabbed.SetTabsMenu(IDR_MENUTABS);
    SetTimer(1,150,0);
    return 0;
}
Example #2
0
// Call all functions to initialise UI
// @input:
// @output:
void MainWindow::InitUI()
{
	ui->setupUi(this);

	InitSettings();
	InitStatusBar();
	InitImgsLabels();
}
Example #3
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	InitMenu(IDR_MAINFRAME);
	InitToolBar(IDR_MAINFRAME);
	InitStatusBar(indicators,sizeof(indicators)/sizeof(UINT));
	if(!m_OfficeBar.Create(_T("Office Panel"),WS_CHILD | WS_VISIBLE, this, 125))
    {
        TRACE0("Failed to create mybar\n");
        return -1;      // fail to create
	}
	if(!m_tb.Create(_T("Panel de Revisiones"),WS_CHILD | WS_VISIBLE, this, 125))
    {
        TRACE0("Failed to create mybar\n");
        return -1;      // fail to create
	}

	m_tb.SetBarStyle(m_tb.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	m_OfficeBar.SetBarStyle(m_OfficeBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	
	m_wndMenuBar.SetSaveHistory("MyHistory1",TRUE);
	m_wndMenuBar.CreateCombo(&m_combMenu,IDC_COMBOMENU,150);
	
	CFont m_Font;
	m_Font.CreateStockObject (DEFAULT_GUI_FONT);
	
	m_wndToolBar.CreateCombo(&m_comboZoom,ID_COMBOBOX,80);
	m_comboZoom.AddString("400%");
	m_comboZoom.AddString("300%");
	m_comboZoom.AddString("200%");
	m_comboZoom.AddString("150%");
	m_comboZoom.AddString("100%");
	m_comboZoom.AddString("85%");
	m_comboZoom.SetFont (&m_Font);
	

	m_tb.EnableDocking(CBRS_ALIGN_ANY);
	m_OfficeBar.EnableDocking(CBRS_ALIGN_ANY);
	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);	
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndMenuBar,m_dockTop);
	DockControlBar(&m_wndToolBar,m_dockTop);
	DockControlBar(&m_tb,AFX_IDW_DOCKBAR_RIGHT);
	DockControlBar(&m_OfficeBar,AFX_IDW_DOCKBAR_RIGHT);
	sProfile = _T("DevStudio");
	LoadBars();
	return 0;
}
Example #4
0
//-------------------------------------------------------------------
//void static FlipStyleFlag (LPDWORD dwStyle, DWORD flag)
//     {
//     if (*dwStyle & flag)  // Flag on -- turn off
//          {
//          *dwStyle &= (~flag) ;
//          }
//     else                  // Flag off -- turn on
//          {
//          *dwStyle |= flag ;
//          }
//     }
//-------------------------------------------------------------------
HWND RebuildStatusBar (HWND hwndParent, WORD /*wFlag*/)
     {
     HWND hwndSB ;
     RECT r ;

     hwndSB = InitStatusBar (hwndParent) ;

     // Post parent a WM_SIZE message to resize children
     GetClientRect (hwndParent, &r) ;
     PostMessage (hwndParent, WM_SIZE, 0, 
                  MAKELPARAM (r.right, r.bottom)) ;

     return hwndSB ;
     }
Example #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    strPathQssFile(":/QSS/QSS/StyleSheet.qss"),
    clrBKApp(QColor(205,215,230))
{
    ui->setupUi(this);

    CreateActions();
    CreateMenus();
    ui->mainToolBar->hide();
    InitMainWindow();
    InitStatusBar();

    BeautifyUI();
}
/*
=========================================================
UpdateClientData

resends any changed player HUD info to the client.
Called every frame by PlayerPreThink
Also called at start of demo recording and playback by
ForceClientDllUpdate to ensure the demo gets messages
reflecting all of the HUD state info.
=========================================================
*/
void CBasePlayer::UpdateClientData()
{
	if( m_bNeedsNewConnectTime )
	{
		m_bNeedsNewConnectTime = false;

		m_flConnectTime = gpGlobals->time;
	}

	if( !m_bWeaponValidationReceived && m_flConnectTime + WEAPON_VALIDATION_GRACE_TIME < gpGlobals->time )
	{
		//If the client didn't send the message in time, drop the client. - Solokiller

		//Set it to true to avoid running this multiple times. - Solokiller
		m_bWeaponValidationReceived = true;

		UTIL_LogPrintf( "Player \"%s\" didn't send weapon validation in time, disconnecting\n", GetNetName() );

		if( !IS_DEDICATED_SERVER() )
		{
			//Listen server hosts usually don't have logging enabled, so echo to console unconditionally for them. - Solokiller
			UTIL_ServerPrintf( "Player \"%s\" didn't send weapon validation in time, disconnecting\n", GetNetName() );
		}

		if( IS_DEDICATED_SERVER() || entindex() != 1 )
		{
			SERVER_COMMAND( UTIL_VarArgs( "kick \"%s\" \"No weapon validation received\"\n", GetNetName() ) );
		}
		else
		{
			//The local player can't be kicked, so terminate the session instead - Solokiller
			CLIENT_COMMAND( edict(), "disconnect\n" );
		}
	}

	//The engine will not call ClientPutInServer after transitions, so we'll have to catch this event every map change. - Solokiller
	if( !m_bSentInitData )
	{
		m_bSentInitData = true;

		//Update Hud colors. - Solokiller
		CMap::GetInstance()->SendHudColors( this, true );
	}

	if( m_fInitHUD )
	{
		m_fInitHUD = false;
		gInitHUD = false;

		MESSAGE_BEGIN( MSG_ONE, gmsgResetHUD, NULL, this );
			WRITE_BYTE( 0 );
		MESSAGE_END();

		if( !m_fGameHUDInitialized )
		{
			MESSAGE_BEGIN( MSG_ONE, gmsgInitHUD, NULL, this );
			MESSAGE_END();

			g_pGameRules->InitHUD( this );
			m_fGameHUDInitialized = true;

			m_iObserverLastMode = OBS_ROAMING;

			if( g_pGameRules->IsMultiplayer() )
			{
				FireTargets( "game_playerjoin", this, this, USE_TOGGLE, 0 );
			}
		}

		FireTargets( "game_playerspawn", this, this, USE_TOGGLE, 0 );

		InitStatusBar();

		SendWeatherUpdate();
	}

	if( m_iHideHUD != m_iClientHideHUD )
	{
		MESSAGE_BEGIN( MSG_ONE, gmsgHideWeapon, NULL, this );
			WRITE_BYTE( m_iHideHUD );
		MESSAGE_END();

		m_iClientHideHUD = m_iHideHUD;
	}

	if( m_iFOV != m_iClientFOV )
	{
		MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, this );
			WRITE_BYTE( m_iFOV );
		MESSAGE_END();

		// cache FOV change at end of function, so weapon updates can see that FOV has changed
	}

	// HACKHACK -- send the message to display the game title
	if( gDisplayTitle )
	{
		MESSAGE_BEGIN( MSG_ONE, gmsgShowGameTitle, NULL, this );
			WRITE_BYTE( 0 );
		MESSAGE_END();
		gDisplayTitle = false;
	}

	if( pev->health != m_iClientHealth )
	{
		int iHealth = clamp( static_cast<int>( pev->health ), 0, 255 );  // make sure that no negative health values are sent
		if( pev->health > 0.0f && pev->health <= 1.0f )
			iHealth = 1;

		// send "health" update message
		MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, this );
			WRITE_BYTE( iHealth );
		MESSAGE_END();

		m_iClientHealth = pev->health;
	}


	if( pev->armorvalue != m_iClientBattery )
	{
		m_iClientBattery = pev->armorvalue;

		ASSERT( gmsgBattery > 0 );
		// send "health" update message
		MESSAGE_BEGIN( MSG_ONE, gmsgBattery, NULL, this );
			WRITE_SHORT( ( int ) pev->armorvalue );
		MESSAGE_END();
	}

	if( pev->dmg_take || pev->dmg_save || m_bitsHUDDamage != m_bitsDamageType )
	{
		// Comes from inside me if not set
		Vector damageOrigin = GetAbsOrigin();
		// send "damage" message
		// causes screen to flash, and pain compass to show direction of damage
		edict_t *other = pev->dmg_inflictor;
		if( other )
		{
			CBaseEntity *pEntity = CBaseEntity::Instance( other );
			if( pEntity )
				damageOrigin = pEntity->Center();
		}

		// only send down damage type that have hud art
		int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD;

		MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, this );
			WRITE_BYTE( pev->dmg_save );
			WRITE_BYTE( pev->dmg_take );
			WRITE_LONG( visibleDamageBits );
			WRITE_COORD( damageOrigin.x );
			WRITE_COORD( damageOrigin.y );
			WRITE_COORD( damageOrigin.z );
		MESSAGE_END();

		//TODO: both of these can probably be removed. - Solokiller
		pev->dmg_take = 0;
		pev->dmg_save = 0;
		m_bitsHUDDamage = m_bitsDamageType;

		// Clear off non-time-based damage indicators
		m_bitsDamageType &= DMG_TIMEBASED;
	}

	// Update Flashlight
	if( ( m_flFlashLightTime ) && ( m_flFlashLightTime <= gpGlobals->time ) )
	{
		if( FlashlightIsOn() )
		{
			if( m_iFlashBattery )
			{
				m_flFlashLightTime = FLASH_DRAIN_TIME + gpGlobals->time;
				m_iFlashBattery--;

				if( !m_iFlashBattery )
					FlashlightTurnOff();
			}
		}
		else
		{
			if( m_iFlashBattery < 100 )
			{
				m_flFlashLightTime = FLASH_CHARGE_TIME + gpGlobals->time;
				m_iFlashBattery++;
			}
			else
				m_flFlashLightTime = 0;
		}

		MESSAGE_BEGIN( MSG_ONE, gmsgFlashBattery, NULL, this );
			WRITE_BYTE( m_iFlashBattery );
		MESSAGE_END();
	}

	if( m_iTrain & TRAIN_NEW )
	{
		ASSERT( gmsgTrain > 0 );
		// send "health" update message
		MESSAGE_BEGIN( MSG_ONE, gmsgTrain, NULL, this );
			WRITE_BYTE( m_iTrain & 0xF );
		MESSAGE_END();

		m_iTrain &= ~TRAIN_NEW;
	}

	SendAmmoUpdate();

	// Update all the items
	for( int i = 0; i < MAX_WEAPON_SLOTS; i++ )
	{
		if( m_rgpPlayerItems[ i ] )  // each item updates it's successors
			m_rgpPlayerItems[ i ]->UpdateClientData( this );
	}

	// Cache and client weapon change
	m_pClientActiveItem = m_pActiveItem;
	m_iClientFOV = m_iFOV;

	// Update Status Bar
	if( m_flNextSBarUpdateTime < gpGlobals->time )
	{
		UpdateStatusBar();
		m_flNextSBarUpdateTime = gpGlobals->time + 0.2;
	}
}
Example #7
0
/**
 * @brief Initializes main window.
 */
MainFrame::MainFrame()
    :wxFrame(NULL,wxID_ANY,wxT("UltraDefrag"))
{
    g_mainFrame = this;
    m_vList = NULL;
    m_cMap = NULL;
    m_currentJob = NULL;
    m_busy = false;
    m_paused = false;

    // set main window icon
    SetIcons(wxICON(appicon));

    // read configuration
    ReadAppConfiguration();
    ProcessCommandEvent(ID_ReadUserPreferences);

    // set main window title
    wxString *instdir = new wxString();
    //genBTC re-arranged the below, A LOT.
    wxStandardPaths stdpaths;
    wxFileName exepath(stdpaths.GetExecutablePath());
    wxString cd = exepath.GetPath();
    if((wxGetEnv(wxT("UD_INSTALL_DIR"),instdir))&&(cd.CmpNoCase(*instdir) == 0)) {
        itrace("current directory matches installation location, so it isn't portable");
        itrace("installation location: %ls",instdir->wc_str());
        m_title = new wxString(wxT(VERSIONINTITLE));
    } else {
        itrace("current directory differs from installation location, so it is portable");
        itrace("current directory: %ls",cd.wc_str());
        wxSetEnv(wxT("UD_IS_PORTABLE"),wxT("1"));
        m_title = new wxString(wxT(VERSIONINTITLE_PORTABLE));
    }
    //genBTC re-arranged the above, A LOT.
    ProcessCommandEvent(ID_SetWindowTitle);
    delete instdir;

    // set main window size and position
    SetSize(m_width,m_height);
    if(!m_saved){
        CenterOnScreen();
        GetPosition(&m_x,&m_y);
    }
    Move(m_x,m_y);
    if(m_maximized) Maximize(true);

    SetMinSize(wxSize(DPI(MAIN_WINDOW_MIN_WIDTH),DPI(MAIN_WINDOW_MIN_HEIGHT)));

    // create menu, tool and status bars
    InitMenu(); InitToolbar(); InitStatusBar();

	//make sizer1 to hold the the tabbed "notebook". And make the notebook
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );
	m_notebook1 = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

	//make a panel inside the notebook to hold the m_splitter
	m_panel1 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

    // create list of volumes and cluster map (with splitter as parent)
    m_splitter = new wxSplitterWindow(m_panel1,wxID_ANY, wxDefaultPosition,wxDefaultSize, 
                                      wxSP_3D | wxCLIP_CHILDREN);
    m_splitter->SetMinimumPaneSize(DPI(MIN_PANEL_HEIGHT));

    m_vList = new DrivesList(m_splitter,wxLC_REPORT | wxLC_NO_SORT_HEADER | 
                             wxLC_HRULES | wxLC_VRULES | wxBORDER_NONE);

    m_cMap = new ClusterMap(m_splitter);

    m_splitter->SplitHorizontally(m_vList,m_cMap);

    int height = GetClientSize().GetHeight();
    int maxPanelHeight = height - DPI(MIN_PANEL_HEIGHT) - m_splitter->GetSashSize();
    if(m_separatorPosition < DPI(MIN_PANEL_HEIGHT)) m_separatorPosition = DPI(MIN_PANEL_HEIGHT);
    else if(m_separatorPosition > maxPanelHeight) m_separatorPosition = maxPanelHeight;
    m_splitter->SetSashPosition(m_separatorPosition);

    // update frame layout so we'll be able to initialize
    // list of volumes and cluster map properly
    wxSizeEvent evt(wxSize(m_width,m_height));
    ProcessEvent(evt); m_splitter->UpdateSize();

    InitVolList();
    m_vList->SetFocus();

    // populate list of volumes
    m_listThread = new ListThread();

    //make sizer2 to Fit the splitter, and initialize it.
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxVERTICAL );
	bSizer2->Add( m_splitter, 1, wxEXPAND, 1 );
	m_panel1->SetSizer( bSizer2 );

	//Finish Tab1 - Add the Panel1(Splitter+sizer2) to the notebook.
	m_notebook1->AddPage( m_panel1, wxT("Drives"), false );

	//make a 2nd panel inside the notebook to hold the 2nd page(a grid)
	m_panel2 = new wxPanel( m_notebook1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );

    m_filesList = new FilesList(m_panel2,wxLC_REPORT /* | wxLC_SINGLE_SEL  | wxLC_NO_SORT_HEADER*/ \
                                        | wxLC_VIRTUAL | wxLC_HRULES | wxLC_VRULES | wxBORDER_NONE);
    InitFilesList();

	//make sizer3 to Fit the page2list, and initialize it.
	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxVERTICAL );
	bSizer3->Add( m_filesList, 1, wxEXPAND, 1 );
	m_panel2->SetSizer( bSizer3 );
    bSizer3->Fit( m_panel2 );

	//Finish Tab 2 - Add the Panel2(page2list+sizer3) to the notebook.
	m_notebook1->AddPage( m_panel2, wxT("Files"), false );

    //Finish Notebook & initialize
	bSizer1->Add( m_notebook1, 1, wxEXPAND, 1 );
	this->SetSizer( bSizer1 );

    // check the boot time defragmenter presence
    wxFileName btdFile(wxT("%SystemRoot%\\system32\\defrag_native.exe"));
    btdFile.Normalize();
    bool btd = btdFile.FileExists();
    m_menuBar->FindItem(ID_BootEnable)->Enable(btd);
    m_menuBar->FindItem(ID_BootScript)->Enable(btd);
    m_toolBar->EnableTool(ID_BootEnable,btd);
    m_toolBar->EnableTool(ID_BootScript,btd);
    if(btd && ::winx_bootex_check(L"defrag_native") > 0){
        m_menuBar->FindItem(ID_BootEnable)->Check(true);
        m_toolBar->ToggleTool(ID_BootEnable,true);
        m_btdEnabled = true;
    } else {
        m_btdEnabled = false;
    }

    // launch threads for time consuming operations
    m_btdThread = btd ? new BtdThread() : NULL;
    m_configThread = new ConfigThread();
    m_crashInfoThread = new CrashInfoThread();

    wxConfigBase *cfg = wxConfigBase::Get();
    int ulevel = (int)cfg->Read(wxT("/Upgrade/Level"),1);
    wxMenuItem *item = m_menuBar->FindItem(ID_HelpUpgradeNone + ulevel);
    if(item) item->Check();

    m_upgradeThread = new UpgradeThread(ulevel);

    // set system tray icon
    m_systemTrayIcon = new SystemTrayIcon();
    if(!m_systemTrayIcon->IsOk()){
        etrace("system tray icon initialization failed");
        wxSetEnv(wxT("UD_MINIMIZE_TO_SYSTEM_TRAY"),wxT("0"));
    }
    SetSystemTrayIcon(wxT("tray"),wxT("UltraDefrag"));

    // set localized text
    ProcessCommandEvent(ID_LocaleChange + g_locale->GetLanguage());

    // allow disk processing
    m_jobThread = new JobThread();

    //create query thread to perform queries without blocking the GUI
    //(sort of like jobs) - may not be good to have both possibly running at once.
    //Create Query Tab, Tab #3.
    InitQueryMenu();
    
    UD_DisableTool(ID_Stop);    //change stop icon to be not always enabled.
}
Example #8
0
BOOL CLogViewDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 将“关于...”菜单项添加到系统菜单中。

	// IDM_ABOUTBOX 必须在系统命令范围内。
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		BOOL bNameValid;
		CString strAboutMenu;
		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
		ASSERT(bNameValid);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

    // TODO: 在此添加额外的初始化代码

    SetWindowPos(NULL, 0, 0, 800, 600, SWP_NOZORDER | SWP_NOMOVE);
    CenterWindow(NULL);

    InitStatusBar();
    InitLogList();
    InitPanel();

    {
        ColumnTypeVector vctColumn;
        CConfig::GetConfig().GetShowType(vctColumn);
        FilterColumn(vctColumn);

        CMenu* pPanelMenu = GetMenu()->GetSubMenu(3);

        BOOL bTopMost = CConfig::GetConfig().GetTopMost();
        SetWindowPos(bTopMost ? &wndTopMost : &wndNoTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
        pPanelMenu->CheckMenuItem(ID_OPTION_TOPMOST, MF_BYCOMMAND | (bTopMost ? MF_CHECKED : MF_UNCHECKED));

        BOOL bAutoScroll = CConfig::GetConfig().GetAutoScroll();
        pPanelMenu->CheckMenuItem(ID_OPTION_AUTOSCROLL, MF_BYCOMMAND | (bAutoScroll ? MF_CHECKED : MF_UNCHECKED));

        BOOL bEnableRegex = CConfig::GetConfig().IsRegexEnabled();
        pPanelMenu->CheckMenuItem(ID_OPTION_ENABLE_REGEX, MF_BYCOMMAND | (bEnableRegex ? MF_CHECKED : MF_UNCHECKED));

        BOOL bEnableWildcard = CConfig::GetConfig().IsWildcardEnabled();
        pPanelMenu->CheckMenuItem(ID_OPTION_ENABLE_WILDCARD, MF_BYCOMMAND | (bEnableWildcard ? MF_CHECKED : MF_UNCHECKED));

        LPCTSTR szFilterText = _T("Te&xt Filter:");
        if(bEnableRegex)
            szFilterText = _T("Rege&x Filter:");
        else if(bEnableWildcard)
            szFilterText = _T("&Wildcard Filter:");
        SetDlgItemText(IDC_LABEL_TEXT_FILTER, szFilterText);
    }

	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Example #9
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	// CG: This line was added by the Palette Support component
	CDockState dockstate;

	if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7));
	CDockingManager::SetDockingMode(DT_SMART);
#if 0
	if (!m_wndMenuBar.Create(this))
	{
		TRACE0("Failed to create menubar\n");
		return -1;      // fail to create
	}

	m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | 
                          CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY );

	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
	DockPane(&m_wndMenuBar);
#endif

	// prevent the menu bar from taking the focus on activation
	CMFCPopupMenu::SetForceMenuFocus(FALSE);

	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_MAINFRAME_TOOLBAR1) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME_TOOLBAR1))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
	m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
	
	int nOrigSize = sizeof(indicators) / sizeof(UINT);

	UINT* pIndicators = new UINT[nOrigSize + 2];
	memcpy(pIndicators, indicators, sizeof(indicators));

	// Call the Status Bar Component's status bar creation function
	if (!InitStatusBar(pIndicators, nOrigSize, 60))
	{
		TRACE0("Failed to initialize Status Bar\n");
		return -1;
	}
	delete[] pIndicators;

	// TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);

	if (!m_wndLoadFileBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR2) ||
		!m_wndLoadFileBar.LoadToolBar(IDR_TOOLBAR2))
	{
		TRACE0("Failed to create dialog bar m_wndLoadFileBar\n");
		return -1;		// fail to create
	}
	m_wndLoadFileBar.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);

	if (!m_wndGPS_HTMEAS.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR3) ||
		!m_wndGPS_HTMEAS.LoadToolBar(IDR_TOOLBAR3))
	{
		TRACE0("Failed to create dialog bar m_wndGPS_HTMEAS\n");
		return -1;		// fail to create
	}
		
	m_wndGPS_HTMEAS.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);

	if (!m_wndISOLDE_PROTONS.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, CRect(1,1,1,1), IDR_TOOLBAR4) ||
		!m_wndISOLDE_PROTONS.LoadToolBar(IDR_TOOLBAR4))
	{
		TRACE0("Failed to create dialog bar m_wndISOLDE_PROTONS\n");
		return -1;		// fail to create
	}

	m_wndISOLDE_PROTONS.EnableDocking(CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM);
	EnableDocking(CBRS_ALIGN_ANY);

	// dock all panes in desired right to left order
	DockPane(&m_wndLoadFileBar);
	DockPaneLeftOf(&m_wndISOLDE_PROTONS,&m_wndLoadFileBar);
	DockPaneLeftOf(&m_wndGPS_HTMEAS,&m_wndISOLDE_PROTONS);
	DockPaneLeftOf(&m_wndToolBar,&m_wndGPS_HTMEAS);

	dockstate.LoadState("Dockbars");
	SetDockState(dockstate);

	CSplashWnd::ShowSplashScreen(this);

	mytimer = SetTimer(TimerID,1000,NULL);

	return 0;
}
Example #10
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	InitMenu(IDR_MAINFRAME);
	InitToolBar(IDR_MAINFRAME);
	InitStatusBar(indicators,sizeof(indicators)/sizeof(UINT));
	EnableDocking(CBRS_ALIGN_ANY);
//	m_wndToolBar.SetTextButton(0,"&New"); 
//	m_wndToolBar.SetTextButton(1,"&Send/Receiver"); 
	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);	
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);

	
	DockControlBar(&m_wndMenuBar,m_dockTop);
	DockControlBar(&m_wndToolBar,m_dockTop);
	
	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	
	if (!m_CapOutBar.Create (WS_CHILD | WS_VISIBLE , 
			this,ID_VIEWCAPTION))
	{
		TRACE0("Failed to create caption bar\n");
		return FALSE;
	}

	if (!m_CapOutBar.SetSplitter(&m_MiniSplitter))
		return FALSE;

	m_MiniSplitter.AddMiniToolLeft(&m_guiMiniToolLeft);
	m_MiniSplitter.AddMiniToolRight(&m_guiMiniToolRight);
	m_guiMiniToolLeft.SetImageList(IDB_BITMAP2,16,11,RGB (255, 0, 0));
	m_guiMiniToolRight.SetImageList(IDB_BITMAP2,16,11,RGB (255, 0, 0));
	
	//Left MiniTool 
	m_guiMiniToolLeft.AddButton(11,IDT_BACK,NULL,"Back ","Back");
	m_guiMiniToolLeft.AddButton(12,IDT_FORW,NULL,"Forward","Forward");
	m_guiMiniToolLeft.AddButton(0,IDT_STANDAR,NULL,"OutLook Today","OutLook Today");
	CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
	pBtn->SetFontColor(RGB(0,0,0));

	//Right MiniTool
	m_guiMiniToolRight.CreateCombo(&m_cb,333,100);
	m_guiMiniToolRight.AddButton(13,IDT_GO,NULL,"Go  ","Go  ");
	m_guiMiniToolRight.AddButton(15,IDT_UNDO,NULL,"Undo  ","Undo  ");
	//m_MiniSplitter.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style),GuiDrawLayer::GetRGBColorBTNHigh());
	m_guiMiniToolRight.SetCaption("&Direccion:",CGuiMiniTool::ALIGN_LEFT);
	m_guiMiniToolRight.SetColorCaption(GuiDrawLayer::GetRGBColorBTNHigh());
	m_guiMiniToolRight.AutoSize(TRUE);
	
	m_cb.AddString("outlook:Tareas");
	m_cb.AddString("outlook:Notas");
	m_cb.AddString("Toolbar Combobox item four");
	m_cb.AddString("Toolbar Combobox item five");
	m_cb.AddString("Toolbar Combobox item six");
	
	m_guiMiniToolLeft.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
	m_guiMiniToolRight.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
	m_cb.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
	
//	On2003();
	sProfile = _T("DevOutLook");
	//LoadBars();
	//active las las siguientes lineas para ver la etiqueta a la derecha
	//m_guiMiniToolLeft.SetCaption("Fecha del dia de hoy",CGuiMiniTool::ALIGN_RIGHT);
	//m_guiMiniToolLeft.SetColorCaption(GuiDrawLayer::GetRGBColorBTNHigh());
	return 0;
}
Example #11
0
//-------------------------------------------------------------------
LRESULT CALLBACK
WndProc (HWND hwnd, UINT mMsg, WPARAM wParam, LPARAM lParam) 
     {
     switch (mMsg)
          {
          case WM_CREATE :
               {
			   pophwnd(hwnd);

               // Create toolbar (source resides in toolbar.c).
               hwndToolBar = InitToolBar (hwnd,hInst) ;

               // Create status bar (source resides in statbar.c).
               hwndStatusBar = InitStatusBar (hwnd) ;

			   if (flg_toolbar==0) ShowWindow (hwndToolBar, SW_HIDE) ;
			   if (flg_statbar==0) ShowWindow (hwndStatusBar, SW_HIDE) ;

               // Create client window (contains notify list).
               hwndClient = CreateWindowEx (WS_EX_CLIENTEDGE,
                                 "ClientWndProc", NULL,
                                 WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
                                 hwnd, (HMENU) 4, hInst, NULL) ;

			   return 0 ;
               }

		  case WM_INITMENUPOPUP :
				return poppad_menupop( wParam,lParam );

          case WM_SETFOCUS :
               SetFocus (hwndClient) ;
               return 0 ;

          case WM_COMMAND :
               {
               // Menu item commands
               switch (LOWORD (wParam))
                    {
                     // Toggle display of toolbar
                    case IDM_VIEW_TOOLBAR :
                         {
                         RECT r ;

                         if (hwndToolBar && IsWindowVisible (hwndToolBar))
                              {
                              ShowWindow (hwndToolBar, SW_HIDE) ;
							  flg_toolbar=0;
                              }
                         else
                              {
                              ShowWindow (hwndToolBar, SW_SHOW) ;
							  flg_toolbar=1;
                              }

                         // Resize other windows.
                         GetClientRect (hwnd, &r) ;
                         PostMessage (hwnd, WM_SIZE, 0, 
                                      MAKELPARAM (r.right, r.bottom)) ;

                         break;
                         }

                    // Toggle display of status bar
                    case IDM_VIEW_STATUS :
                         {
                         RECT r;

                         if (hwndStatusBar && IsWindowVisible (hwndStatusBar))
                              {
                              ShowWindow (hwndStatusBar, SW_HIDE) ;
							  flg_statbar=0;
                              }
                         else
                              {
                              ShowWindow (hwndStatusBar, SW_SHOW) ;
							  flg_statbar=1;
                              }

                         // Resize other windows.
                         GetClientRect (hwnd, &r) ;
                         PostMessage (hwnd, WM_SIZE, 0, 
                                      MAKELPARAM (r.right, r.bottom)) ;

                         break;
                         }

					case IDM_HSCROLL:
						poppad_setsb(2);
						break;

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

                     }

               return 0;
               }

          case WM_INITMENU :
               {
               BOOL bCheck ;
               HMENU hmenu = (HMENU) wParam ;

               // View menu items.
               bCheck = IsWindowVisible (hwndToolBar) ;
               MenuCheckMark (hmenu, IDM_VIEW_TOOLBAR, bCheck) ;
            
               bCheck = IsWindowVisible (hwndStatusBar) ;
               MenuCheckMark (hmenu, IDM_VIEW_STATUS, bCheck) ;

				bCheck=poppad_setsb(-1);
				MenuCheckMark (hmenu, IDM_HSCROLL, bCheck) ;

               return 0 ;
               }

          case WM_CLOSE :
          case WM_QUERYENDSESSION :
			   return poppad_term( mMsg );

          case WM_MENUSELECT :
               return Statusbar_MenuSelect (hwnd, wParam, lParam) ;

          case WM_DESTROY :
			   RemoveProp(hwnd, PROP_NAME);
               PostQuitMessage (0) ;
               return 0 ;

          case WM_NOTIFY :
               {
               LPNMHDR pnmh = (LPNMHDR) lParam ;
//               int idCtrl = (int) wParam ;

               // Display notification details in notify window
               //DisplayNotificationDetails (wParam, lParam) ;

               // Toolbar notifications
               if ((pnmh->code >= TBN_LAST) &&
                   (pnmh->code <= TBN_FIRST))
                    {
                    return ToolBarNotify (hwnd, wParam, lParam) ;
                    }
            
               // Fetch tooltip text
               if (pnmh->code == TTN_NEEDTEXT)
                    {
                    LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT) lParam ;
                    CopyToolTipText (lpttt) ;
                    }

               return 0 ;
               }

          case WM_WINDOWPOSCHANGING :
               {
			   WINDOWPOS *wp;
				   wp=(WINDOWPOS *)lParam;
				   if ((wp->cy)&&(wp->cy)) {
					  posx=wp->x;posy=wp->y;
					  winx=wp->cx;winy=wp->cy;
				   }
			   }
			   break;

          case WM_SIZE :
               {
               int cx = LOWORD (lParam) ;
               int cy = HIWORD (lParam) ;
               int cyStatus ;
               int cyTB ;
               int x, y ;
               DWORD dwStyle ;
               RECT rWindow ;

               // Ignore size message to allow auto-move and auto-size
               // features to be more clearly seen.
               if (bIgnoreSize)
                    return 0 ;

               // Adjust toolbar size.
               if (IsWindowVisible (hwndToolBar))
                    {
                    dwStyle = GetWindowLong (hwndToolBar, GWL_STYLE) ;
                    if (dwStyle & CCS_NORESIZE)
                         {
                         MoveWindow (hwndToolBar, 
                                     0, 0, cx, cyToolBar, FALSE) ;
                         }
                    else
                         {
                         ToolBar_AutoSize (hwndToolBar) ;
                         }
					InvalidateRect (hwndToolBar, NULL, TRUE) ;
                    GetWindowRect (hwndToolBar, &rWindow) ;
                    ScreenToClient (hwnd, (LPPOINT) &rWindow.left) ;
                    ScreenToClient (hwnd, (LPPOINT) &rWindow.right) ;
                    cyTB = rWindow.bottom - rWindow.top ;
                    } 
               else
                    {
                    cyTB = 0 ;
                    }

               // Adjust status bar size.
               if (IsWindowVisible (hwndStatusBar))
                    {
                    GetWindowRect (hwndStatusBar, &rWindow) ;
                    cyStatus = rWindow.bottom - rWindow.top ;
                    MoveWindow (hwndStatusBar, 0, cy - cyStatus, 
                                              cx, cyStatus, TRUE) ;
                    }
               else
                    {
                    cyStatus = 0 ;
                    }

               // Adjust client window size.
               x = 0 ;
               y = cyTB ;
               cy -= cyStatus + cyTB;
               MoveWindow (hwndClient, x, y, cx, cy, TRUE) ;
               return 0;
               }

		  case WM_COPYDATA:
			  {
                  COPYDATASTRUCT *pcds = (COPYDATASTRUCT*)lParam;
				  LoadFromCommandLine((char *)pcds->lpData);
                  return 0;
			  }

          default:
               return (EditDefProc (hwnd, mMsg, wParam, lParam)) ;
          }
     return DefWindowProc (hwnd, mMsg, wParam, lParam) ;
     }
Example #12
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CGuiFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	InitMenu(IDR_MAINFRAME);
	InitToolBar(IDR_MAINFRAME);
	InitStatusBar(indicators,sizeof(indicators)/sizeof(UINT));
	m_wndToolBar.SetWindowText("ToolBar");

	// Create systray icon.
	// Get Icon, two methods: 
	// hIcon = ::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_MYICON));
	// hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
	m_BHSystray.Create(this, IDI_SYSTRAY, 
					   WM_RBUTTONDOWN | WM_LBUTTONDOWN
					   | WM_RBUTTONUP | WM_LBUTTONUP
					   | WM_LBUTTONDBLCLK,
					   AfxGetApp()->LoadIcon(IDI_SYSTRAY),
					   _T("BrowserHooker in systray."));

	// Load systray menu
	// 这里使用CMenu menu初始化变量会失败, 必须使用指针然后new的方式
	CMenu *pMenu = new CMenu;
	pMenu->LoadMenu(IDR_MENUSYSTRAY);
	m_BHSystray.SetSysMenu(pMenu);

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	// for control panel.
	if (!m_BHNavigator.Create(_T("Control Panel"),WS_CHILD | WS_VISIBLE, this, 0x999))
    {
        TRACE0("Failed to create m_BHNavigator\n");
        return -1;
	}

//	if(!m_BHSettingWnd.Create(_T("Setting"), WS_CHILD | WS_VISIBLE, this, 0x1000))
//	{
//		TRACE0("Failed to create m_BHSettingWnd\n");
//		return -1;
//	}

	m_BHNavigator.SetBarStyle(m_BHNavigator.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

//	m_BHSettingWnd.SetBarStyle(m_BHSettingWnd.GetBarStyle() |
//		CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	// side bar create
	m_wndToolBar.SetButtonDropDown(ID_BT_CONTROLPANEL, 8, IDR_FLOATMENU);
	m_wndToolBar.SetMenuContext(IDR_FLOATMENU);

	EnableDocking(CBRS_ALIGN_ANY);
	m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	m_BHNavigator.EnableDocking(CBRS_ALIGN_ANY);
//	m_BHSettingWnd.EnableDocking(CBRS_ALIGN_ANY);

	// register the menu bar.
	m_BHNavigator.SetMenuContext(IDR_FLOATMENU);
//	m_BHSettingWnd.SetMenuContext(IDR_FLOATMENU);
	m_wndMenuBar.SetMenuContext(IDR_FLOATMENU);

	// set the control to be dockable.
	DockControlBar(&m_wndMenuBar, m_dockTop);
	DockControlBar(&m_wndToolBar, m_dockLeft);
	DockControlBar(&m_BHNavigator, AFX_IDW_DOCKBAR_LEFT);
//	DockControlBar(&m_BHSettingWnd, AFX_IDW_DOCKBAR_BOTTOM);

	// here sProfile standards for App name.
	sProfile = _T("BrowserHooker");
	LoadBars();
	
	#define _countof(array) (sizeof(array)/sizeof(array[0]))
	m_wndCool.LoadToolbars(Toolbars, _countof(Toolbars));

	RecalcLayout();
	if(m_StyleDisplay == GUISTYLE_2003)
		OnViewLook2003();
	else
		OnViewLookXp();

	return 0;
}