Subversion Repositories Aucun

Rev

Rev 193 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
113 ixe013 1
// MainFrm.cpp : implmentation of the CMainFrame class
2
//
3
/////////////////////////////////////////////////////////////////////////////
4
 
5
#include "stdafx.h"
6
#include "resource.h"
7
 
123 ixe013 8
#include "shellieView.h"
113 ixe013 9
#include "MainFrm.h"
10
#include "RESHelper.h"
120 ixe013 11
#include "Settings.h"
193 ixe013 12
#include "BrowserLockDown.h"
113 ixe013 13
 
14
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
15
{
16
    //if(CFrameWindowImpl<CMainFrame>::PreTranslateMessage(pMsg))
17
    if(baseFrameClass::PreTranslateMessage(pMsg))
18
        return TRUE;
19
 
20
    return m_view.PreTranslateMessage(pMsg);
21
}
22
 
23
BOOL CMainFrame::OnIdle()
24
{
25
    UIUpdateToolBar();
26
    return FALSE;
27
}
28
 
29
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
30
{
31
    SetMenu(NULL);
32
 
33
    TCHAR resurl[MAX_PATH+5];
120 ixe013 34
 
125 ixe013 35
   if((GetSettingText(L"SOFTWARE\\Paralint.com\\Shellie\\Shell", L"URL", resurl, sizeof resurl / sizeof *resurl) != S_OK)
120 ixe013 36
       || !*resurl)
37
    {
38
        CRESHelper::GetURLForID(IDR_HTMLDEFAULT, resurl, MAX_PATH+5);
39
    }
40
 
113 ixe013 41
    m_hWndClient = m_view.Create(m_hWnd, rcDefault, resurl, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_HSCROLL | WS_VSCROLL, 0/*WS_EX_CLIENTEDGE*/);
42
 
120 ixe013 43
    //TODO: Install right click menu handler
44
    //TODO : Register CTRL-P hotkey, tied to printing
45
 
113 ixe013 46
    // register object for message filtering and idle updates
47
    CMessageLoop* pLoop = _Module.GetMessageLoop();
48
    ATLASSERT(pLoop != NULL);
49
    pLoop->AddMessageFilter(this);
50
    pLoop->AddIdleHandler(this);
51
 
196 ixe013 52
    CComObject<CBrowserLockDown> *pUIH = NULL;
53
    HRESULT hr = CComObject<CBrowserLockDown>::CreateInstance (&pUIH);
54
    if (SUCCEEDED(hr))
55
    {
56
        // Make our custom DocHostUIHandler the window.external handler
57
        CComQIPtr<IDocHostUIHandlerDispatch> pIUIH = pUIH;
58
        hr = m_view.SetExternalUIHandler(pIUIH) ;
59
    }
60
    ATLASSERT(SUCCEEDED(hr)) ;
61
 
113 ixe013 62
    SetWindowPos(0, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_NOZORDER|SWP_SHOWWINDOW);
63
 
64
    return 0;
65
}
66
 
67
LRESULT CMainFrame::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
68
{
69
    // unregister message filtering and idle updates
70
    CMessageLoop* pLoop = _Module.GetMessageLoop();
71
    ATLASSERT(pLoop != NULL);
72
    pLoop->RemoveMessageFilter(this);
73
    pLoop->RemoveIdleHandler(this);
74
 
75
    bHandled = FALSE;
76
 
77
    PostQuitMessage(0);
78
 
79
    return 1;
80
}
81
 
133 ixe013 82