NOT PART OF BUILD. Add prototypes of editor & chat windows. Create GeckoFrame subclass that does the common functionality for all frames. Cleanup mail window.

git-svn-id: svn://10.0.0.236/trunk@144200 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
locka%iol.ie
2003-06-26 21:31:10 +00:00
parent d6ad0f6e54
commit 3aff27fdb5
16 changed files with 543 additions and 158 deletions

View File

@@ -35,7 +35,7 @@
#include "nsIURI.h"
BEGIN_EVENT_TABLE(BrowserFrame, wxFrame)
BEGIN_EVENT_TABLE(BrowserFrame, GeckoFrame)
EVT_MENU(XRCID("browse_back"), BrowserFrame::OnBrowserBack)
EVT_UPDATE_UI(XRCID("browse_back"), BrowserFrame::OnUpdateBrowserBack)
EVT_MENU(XRCID("browse_fwd"), BrowserFrame::OnBrowserForward)
@@ -48,38 +48,13 @@ BEGIN_EVENT_TABLE(BrowserFrame, wxFrame)
EVT_TEXT_ENTER(XRCID("url"), BrowserFrame::OnBrowserUrl)
END_EVENT_TABLE()
BrowserFrame::BrowserFrame(wxWindow* aParent) :
mGeckoWnd(NULL)
BrowserFrame::BrowserFrame(wxWindow* aParent)
{
wxXmlResource::Get()->LoadFrame(this, aParent, wxT("browser_frame"));
SetIcon(wxICON(appicon));
mGeckoWnd = (GeckoWindow *) FindWindowById(XRCID("gecko"), this);
if (mGeckoWnd)
{
// Note we pass in 'browser' as the role so that when the content
// wants to open a popup the window creator can say okay but deny it
// for other roles such as 'mail' or whatever.
GeckoContainer *geckoContainer = new GeckoContainer(this, "browser");
if (geckoContainer)
{
mGeckoWnd->SetGeckoContainer(geckoContainer);
PRUint32 aChromeFlags = nsIWebBrowserChrome::CHROME_ALL;
geckoContainer->SetChromeFlags(aChromeFlags);
geckoContainer->SetParent(nsnull);
wxSize size = mGeckoWnd->GetClientSize();
// Insert the browser
geckoContainer->CreateBrowser(0, 0, size.GetWidth(), size.GetHeight(),
(nativeWindow) mGeckoWnd->GetHWND(), getter_AddRefs(mWebbrowser));
GeckoContainerUI::ShowWindow(PR_TRUE);
}
}
SetupDefaultGeckoWindow();
CreateStatusBar();
}
@@ -91,13 +66,13 @@ BrowserFrame::BrowserFrame(wxWindow* aParent) :
void BrowserFrame::OnBrowserGo(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
wxTextCtrl *txtCtrl = (wxTextCtrl *) FindWindowById(XRCID("url"), this);
wxString url = txtCtrl->GetValue();
if (!url.IsEmpty())
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->LoadURI(NS_ConvertASCIItoUCS2(url.c_str()).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
@@ -114,9 +89,9 @@ void BrowserFrame::OnBrowserUrl(wxCommandEvent & event)
void BrowserFrame::OnBrowserBack(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->GoBack();
}
}
@@ -124,9 +99,9 @@ void BrowserFrame::OnBrowserBack(wxCommandEvent & WXUNUSED(event))
void BrowserFrame::OnUpdateBrowserBack(wxUpdateUIEvent &event)
{
PRBool canGoBack = PR_FALSE;
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->GetCanGoBack(&canGoBack);
}
event.Enable(canGoBack);
@@ -134,9 +109,9 @@ void BrowserFrame::OnUpdateBrowserBack(wxUpdateUIEvent &event)
void BrowserFrame::OnBrowserForward(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->GoForward();
}
}
@@ -144,9 +119,9 @@ void BrowserFrame::OnBrowserForward(wxCommandEvent & WXUNUSED(event))
void BrowserFrame::OnUpdateBrowserForward(wxUpdateUIEvent &event)
{
PRBool canGoForward = PR_FALSE;
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->GetCanGoForward(&canGoForward);
}
event.Enable(canGoForward);
@@ -154,18 +129,18 @@ void BrowserFrame::OnUpdateBrowserForward(wxUpdateUIEvent &event)
void BrowserFrame::OnBrowserReload(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->Reload(nsIWebNavigation::LOAD_FLAGS_NONE);
}
}
void BrowserFrame::OnBrowserStop(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->Stop(nsIWebNavigation::STOP_ALL);
}
}
@@ -177,9 +152,9 @@ void BrowserFrame::OnUpdateBrowserStop(wxUpdateUIEvent &event)
void BrowserFrame::OnBrowserHome(wxCommandEvent & WXUNUSED(event))
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->LoadURI(NS_ConvertASCIItoUCS2("http://www.mozilla.org/projects/embedding/").get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,
@@ -211,9 +186,9 @@ void BrowserFrame::UpdateStatusBarText(const PRUnichar* aStatusText)
void BrowserFrame::UpdateCurrentURI()
{
if (mWebbrowser)
if (mWebBrowser)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
nsCOMPtr<nsIURI> currentURI;
webNav->GetCurrentURI(getter_AddRefs(currentURI));
nsCAutoString spec;

View File

@@ -32,12 +32,10 @@
#ifndef BROWSERFRAME_H
#define BROWSERFRAME_H
#include "GeckoContainer.h"
#include "GeckoWindow.h"
#include "GeckoFrame.h"
class BrowserFrame :
public wxFrame,
public GeckoContainerUI
public GeckoFrame
{
public :
BrowserFrame(wxWindow* aParent);
@@ -55,9 +53,6 @@ public :
void OnUpdateBrowserForward(wxUpdateUIEvent &event);
void OnUpdateBrowserStop(wxUpdateUIEvent &event);
GeckoWindow *mGeckoWnd;
nsCOMPtr<nsIWebBrowser> mWebbrowser;
// GeckoContainerUI overrides
virtual nsresult CreateBrowserWindow(PRUint32 aChromeFlags,
nsIWebBrowserChrome *aParent, nsIWebBrowserChrome **aNewWindow);

View File

@@ -29,17 +29,47 @@
*
* ***** END LICENSE BLOCK ***** */
#include "global.h"
#include "global.h"
#include "ChatFrame.h"
#include "nsIWebNavigation.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "ChatFrame.h"
BEGIN_EVENT_TABLE(ChatFrame, wxFrame)
// EVT_LIST_ITEM_SELECTED(XRCID("articles"), ChatFrame::OnArticleClick)
BEGIN_EVENT_TABLE(ChatFrame, GeckoFrame)
EVT_TEXT_ENTER(XRCID("chat"), ChatFrame::OnChat)
END_EVENT_TABLE()
ChatFrame::ChatFrame(wxWindow* aParent) :
mGeckoWnd(NULL)
ChatFrame::ChatFrame(wxWindow* aParent)
{
wxXmlResource::Get()->LoadFrame(this, aParent, wxT("chat_frame"));
}
SetIcon(wxICON(appicon));
SetupDefaultGeckoWindow();
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->LoadURI(NS_ConvertASCIItoUCS2("about:blank").get(),
nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
}
void ChatFrame::OnChat(wxCommandEvent &event)
{
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
nsCOMPtr<nsIDOMDocument> doc;
webNav->GetDocument(getter_AddRefs(doc));
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
// doc->CreateElement(getter_AddRefs(element));
wxTextCtrl *chatCtrl = (wxTextCtrl *) FindWindowById(XRCID("chat"), this);
if (chatCtrl)
{
wxString txt = chatCtrl->GetValue();
nsAutoString htmlFragment(NS_LITERAL_STRING("<p>Foo: "));
htmlFragment.AppendWithConversion(txt.c_str());
htmlDoc->Writeln(htmlFragment);
chatCtrl->SetValue("");
}
}

View File

@@ -31,20 +31,17 @@
#ifndef CHATFRAME_H
#include "GeckoContainer.h"
#include "GeckoWindow.h"
#include "GeckoFrame.h"
class ChatFrame :
public wxFrame,
public GeckoContainerUI
public GeckoFrame
{
public :
ChatFrame(wxWindow* aParent);
DECLARE_EVENT_TABLE()
GeckoWindow *mGeckoWnd;
nsCOMPtr<nsIWebBrowser> mWebbrowser;
void OnChat(wxCommandEvent &event);
};
#endif

View File

@@ -0,0 +1,68 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#include "global.h"
#include "nsIWebNavigation.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMWindow.h"
#include "nsIEditingSession.h"
#include "EditorFrame.h"
BEGIN_EVENT_TABLE(EditorFrame, GeckoFrame)
//EVT_TEXT_ENTER(XRCID("chat"), ChatFrame::OnChat)
END_EVENT_TABLE()
EditorFrame::EditorFrame(wxWindow* aParent)
{
wxXmlResource::Get()->LoadFrame(this, aParent, wxT("editor_frame"));
SetIcon(wxICON(appicon));
SetupDefaultGeckoWindow();
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->LoadURI(NS_ConvertASCIItoUCS2("www.mozilla.org").get(),
nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
nsCOMPtr<nsIDOMWindow> domWindow;
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
nsCOMPtr<nsIEditingSession> editingSession = do_GetInterface(mWebBrowser);
if (!editingSession)
return;// NS_ERROR_FAILURE;
editingSession->MakeWindowEditable(domWindow, NULL, PR_TRUE);
}

View File

@@ -0,0 +1,46 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#ifndef EDITORFRAME_H
#define EDITORFRAME_H
#include "GeckoFrame.h"
class EditorFrame :
public GeckoFrame
{
public :
EditorFrame(wxWindow* aParent);
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -38,6 +38,7 @@
#include "BrowserFrame.h"
#include "MailFrame.h"
#include "ChatFrame.h"
#include "EditorFrame.h"
#include "GeckoProtocolHandler.h"
#include "GeckoWindowCreator.h"
@@ -80,13 +81,15 @@ class EmbedApp : public wxApp
void OnAbout(wxCommandEvent &event);
void OnMail(wxCommandEvent &event);
void OnChat(wxCommandEvent &event);
void OnEditor(wxCommandEvent &event);
};
BEGIN_EVENT_TABLE(EmbedApp, wxApp)
EVT_MENU(XRCID("menu_quit"), EmbedApp::OnQuit)
EVT_MENU(XRCID("menu_about"), EmbedApp::OnAbout)
EVT_MENU(XRCID("menu_mail"), EmbedApp::OnMail)
EVT_MENU(XRCID("menu_chat"), EmbedApp::OnChat)
EVT_MENU(XRCID("menu_quit"), EmbedApp::OnQuit)
EVT_MENU(XRCID("menu_about"), EmbedApp::OnAbout)
EVT_MENU(XRCID("menu_mail"), EmbedApp::OnMail)
EVT_MENU(XRCID("menu_chat"), EmbedApp::OnChat)
EVT_MENU(XRCID("menu_editor"), EmbedApp::OnEditor)
END_EVENT_TABLE()
///////////////////////////////////////////////////////////////////////////////
@@ -166,12 +169,27 @@ void EmbedApp::OnAbout(wxCommandEvent & WXUNUSED(event))
void EmbedApp::OnMail(wxCommandEvent & WXUNUSED(event))
{
// Create the mail frame window
MailFrame * frame = new MailFrame(NULL);
frame->Show(TRUE);
static MailFrame * frame = NULL;
if (!frame)
frame = new MailFrame(NULL);
if (frame)
frame->Show(TRUE);
}
void EmbedApp::OnChat(wxCommandEvent & WXUNUSED(event))
{
ChatFrame * frame = new ChatFrame(NULL);
frame->Show(TRUE);
}
static ChatFrame * frame = NULL;
if (!frame)
frame = new ChatFrame(NULL);
if (frame)
frame->Show(TRUE);
}
void EmbedApp::OnEditor(wxCommandEvent & WXUNUSED(event))
{
static EditorFrame * frame = NULL;
if (!frame)
frame = new EditorFrame(NULL);
if (frame)
frame->Show(TRUE);
}

View File

@@ -0,0 +1,74 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#include "global.h"
#include "GeckoFrame.h"
#include "GeckoContainer.h"
GeckoFrame::GeckoFrame() :
mGeckoWnd(NULL)
{
}
bool GeckoFrame::SetupDefaultGeckoWindow()
{
mGeckoWnd = (GeckoWindow *) FindWindowById(XRCID("gecko"), this);
if (!mGeckoWnd)
return FALSE;
return SetupGeckoWindow(mGeckoWnd, this, getter_AddRefs(mWebBrowser));
}
bool GeckoFrame::SetupGeckoWindow(GeckoWindow *aGeckoWindow, GeckoContainerUI *aUI, nsIWebBrowser **aWebBrowser) const
{
if (!aGeckoWindow || !aUI)
return FALSE;
GeckoContainer *geckoContainer = new GeckoContainer(aUI);
if (!geckoContainer)
return FALSE;
mGeckoWnd->SetGeckoContainer(geckoContainer);
PRUint32 aChromeFlags = nsIWebBrowserChrome::CHROME_ALL;
geckoContainer->SetChromeFlags(aChromeFlags);
geckoContainer->SetParent(nsnull);
wxSize size = mGeckoWnd->GetClientSize();
// Insert the browser
geckoContainer->CreateBrowser(0, 0, size.GetWidth(), size.GetHeight(),
(nativeWindow) aGeckoWindow->GetHWND(), aWebBrowser);
aUI->ShowWindow(PR_TRUE);
return TRUE;
}

View File

@@ -0,0 +1,59 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: Mozilla-sample-code 1.0
*
* Copyright (c) 2002 Netscape Communications Corporation and
* other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this Mozilla sample software and associated documentation files
* (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit
* persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Contributor(s):
*
* Adam Lock <adamlock@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
#ifndef GECKOFRAME_H
#define GECKOFRAME_H
#include "nsIWebBrowser.h"
#include "GeckoWindow.h"
#include "GeckoContainer.h"
class GeckoFrame :
public wxFrame,
public GeckoContainerUI
{
protected:
GeckoWindow *mGeckoWnd;
nsCOMPtr<nsIWebBrowser> mWebBrowser;
public:
GeckoFrame();
// This method searches for a "gecko" wxWindow and sets it up with the frame
// as the container UI. The results are stored in the mGeckoWnd and mWebBrowser
// member variables.
bool SetupDefaultGeckoWindow();
// This method sets up the specified window with the specified container UI
// and returns the nsIWebBrowser interface to it.
bool SetupGeckoWindow(GeckoWindow *aGeckoWindow, GeckoContainerUI *aUI, nsIWebBrowser **aWebBrowser) const;
};
#endif

View File

@@ -36,40 +36,70 @@
#include "nsIURI.h"
const char msg1[] =
"<html><body>"
"Attention: Sir,<br>\n"
"Good day. I am ALEXANDER NENE, Solicitor and Notary Public, The Personal Attorney<br>"
"to MR HENRI CARLTON, The president of DIAMOND SAFARIESCO.LTD.ACCRA-GHANA who is a<br>"
"National of your country. On the 21st of April 2000, my client, his wife and their <br>"
"only son were Involved in a car accident along ACCRA/KUMASI Express Road.<br>\n"
"Unfortunately, they all lost their lives in the event of the accident, since then<br>"
"I have made several enquiries to locate any of my clients extended relatives and<br>"
"this has also proved unsuccessful.After these several unsuccessful attempts, I decided<br>"
"to trace his Relatives over the Internet, to locate any member of his family but of<br>"
"no avail, hence I contacted youI contacted you to assist in repatriating the money and<br>"
"property left Behind before they get confiscated or declare unserviceable by the bank<br>"
"where my client lodged this huge deposits. Particularly, the Bank where the deceased had<br>"
"an account valued at about 28.3 million dollars.Conseqently, the bank issued me a notice<br>"
"to provide the next of kin or Have the account confiscated within a short time. Since<br>"
"I have been Unsuccessful in locating the relatives for over some years now, I seek your<br>"
"consent to present you as the next of kin of the deceased since you share the same surname<br>"
" so that the proceeds of this account valued at 48.3 million dollars can be paid to you<br>"
"for both of us to share the money; 70% to me and 25% to you, while 5% should be for<br>"
"expenses or tax as your government may require. I have all necessary legal documents that<br>"
"can be used to backup the claim.All I require is your honest cooperation to enable us see<br>"
"this deal Through. I guarantee that this will be executed under a legitimate arrangement<br>"
"that will protect you from any breach of the law. Please get in touch with me through my<br>"
"email to enable us discuss further.<br><br> \n"
"Thanks for you kind co-operation<br><br> \n"
"ALEXANDER NENE<br><br><br></body></html>";
struct MailMsg
{
char *mSubject;
char *mSender;
char *mDate;
char *mBody;
};
const char msg2[] =
"<html><body>The network will be going down tonight so please log off your computers before going home.</body></html>";
const char msg3[] =
"<html><body>Please submit expense reports ASAP if you want to see payment in your accounts this month!</body></html>";
MailMsg gSampleMessages[] =
{
{
"URGENT ASSITANCE PLS",
"alexander nene",
"09/06/2003 14:38",
"<html><body>"
"<p>Attention: Sir,<br>\n"
"<p>Good day. I am ALEXANDER NENE, Solicitor and Notary Public, The Personal Attorney"
"to MR HENRI CARLTON, The president of DIAMOND SAFARIESCO.LTD.ACCRA-GHANA who is a"
"National of your country. On the 21st of April 2000, my client, his wife and their "
"only son were Involved in a car accident along ACCRA/KUMASI Express Road."
"<p>Unfortunately, they all lost their lives in the event of the accident, since then "
"I have made several enquiries to locate any of my clients extended relatives and"
"this has also proved unsuccessful.After these several unsuccessful attempts, I decided"
"to trace his Relatives over the Internet, to locate any member of his family but of"
"no avail, hence I contacted youI contacted you to assist in repatriating the money and"
"property left Behind before they get confiscated or declare unserviceable by the bank"
"where my client lodged this huge deposits. Particularly, the Bank where the deceased had"
"an account valued at about 28.3 million dollars.Conseqently, the bank issued me a notice "
"to provide the next of kin or Have the account confiscated within a short time. Since "
"I have been Unsuccessful in locating the relatives for over some years now, I seek your "
"consent to present you as the next of kin of the deceased since you share the same surname "
"so that the proceeds of this account valued at 48.3 million dollars can be paid to you "
"for both of us to share the money; 70% to me and 25% to you, while 5% should be for "
"expenses or tax as your government may require. I have all necessary legal documents that"
"can be used to backup the claim.All I require is your honest cooperation to enable us see"
"this deal Through. "
"<p>I guarantee that this will be executed under a legitimate arrangement"
"that will protect you from any breach of the law. Please get in touch with me through my"
"email to enable us discuss further.<br><br> \n"
"<p>Thanks for you kind co-operation<br><br> \n"
"<p>ALEXANDER NENE<br><br><br></body></html>"
},
{
"Reminder: Network Outage Tonight",
"IT Dept",
"09/06/2003 15:22",
"<html><body>The network will be going down tonight so please log off "
"your computers before going home.</body></html>"
},
{
"Expense Reports Due",
"Finance Dept",
"09/06/2003 15:40",
"<html><body>Please submit expense reports ASAP if you want to see payment "
"in your accounts this month!</body></html>"
},
{
"Flight confirmation",
"Expediocity",
"12/06/2003 12:31",
"<html><body>Thank you for booking with Expediocity, Your flight reservation has been "
"confirmed and details may be found online <a href=\"http://www.mozilla.org\">here</a>.</body></html>"
}
};
static bool gMailChannelCallbackRegistered = FALSE;
@@ -88,12 +118,16 @@ public:
nsCAutoString path;
aURI->GetPath(path);
if (path.Equals("//0"))
txt = msg1;
else if (path.Equals("//1"))
txt = msg2;
long i;
if (sscanf(path.get(), "//%ld", &i) == 1)
{
txt = gSampleMessages[i].mBody;
}
else
txt = msg3;
{
return NS_ERROR_FAILURE;
}
size_t size = txt.Length();
*aData = (void *) nsMemory::Alloc(size + 1);
@@ -106,12 +140,11 @@ public:
}
};
BEGIN_EVENT_TABLE(MailFrame, wxFrame)
BEGIN_EVENT_TABLE(MailFrame, GeckoFrame)
EVT_LIST_ITEM_SELECTED(XRCID("articles"), MailFrame::OnArticleClick)
END_EVENT_TABLE()
MailFrame::MailFrame(wxWindow* aParent) :
mGeckoWnd(NULL)
MailFrame::MailFrame(wxWindow* aParent)
{
wxXmlResource::Get()->LoadFrame(this, aParent, wxT("mail_frame"));
@@ -130,41 +163,17 @@ MailFrame::MailFrame(wxWindow* aParent) :
articleListCtrl->InsertColumn(0, "Subject", wxLIST_FORMAT_LEFT, 200);
articleListCtrl->InsertColumn(1, "Sender", wxLIST_FORMAT_LEFT, 100);
articleListCtrl->InsertColumn(2, "Date", wxLIST_FORMAT_LEFT, 100);
long idx;
idx = articleListCtrl->InsertItem(0, "URGENT ASSITANCE PLS");
articleListCtrl->SetItem(idx, 1, "alexander nene");
articleListCtrl->SetItem(idx, 2, "09/06/2003 14:38");
idx = articleListCtrl->InsertItem(1, "Reminder: Network Outage Tonight");
articleListCtrl->SetItem(idx, 1, "IT Dept");
articleListCtrl->SetItem(idx, 2, "09/06/2003 15:22");
idx = articleListCtrl->InsertItem(2, "Expense Reports Due");
articleListCtrl->SetItem(idx, 1, "Finance Dept");
articleListCtrl->SetItem(idx, 2, "09/06/2003 15:40");
}
mGeckoWnd = (GeckoWindow *) FindWindowById(XRCID("gecko"), this);
if (mGeckoWnd)
{
GeckoContainer *geckoContainer = new GeckoContainer(this);
if (geckoContainer)
for (long i = 0; i < sizeof(gSampleMessages) / sizeof(gSampleMessages[0]); i++)
{
mGeckoWnd->SetGeckoContainer(geckoContainer);
PRUint32 aChromeFlags = nsIWebBrowserChrome::CHROME_ALL;
geckoContainer->SetChromeFlags(aChromeFlags);
geckoContainer->SetParent(nsnull);
wxSize size = mGeckoWnd->GetClientSize();
// Insert the browser
geckoContainer->CreateBrowser(0, 0, size.GetWidth(), size.GetHeight(),
(nativeWindow) mGeckoWnd->GetHWND(), getter_AddRefs(mWebbrowser));
GeckoContainerUI::ShowWindow(PR_TRUE);
articleListCtrl->InsertItem(i, gSampleMessages[i].mSubject);
articleListCtrl->SetItem(i, 1, gSampleMessages[i].mSender);
articleListCtrl->SetItem(i, 2, gSampleMessages[i].mDate);
}
}
SetupDefaultGeckoWindow();
wxWindow *hdrPanel = FindWindowById(XRCID("mail_header_panel"), this);
if (hdrPanel)
{
@@ -177,18 +186,27 @@ MailFrame::MailFrame(wxWindow* aParent) :
void MailFrame::OnArticleClick(wxListEvent &event)
{
if (mWebbrowser)
if (mWebBrowser)
{
wxString url = wxString::Format("wxmail://%ld", event.GetIndex());
long idx = event.GetIndex();
wxString url = wxString::Format("wxmail://%ld", idx);
if (!url.IsEmpty())
{
wxStaticText *txtFrom = (wxStaticText *) FindWindowById(XRCID("mail_from"), this);
if (txtFrom)
txtFrom->SetLabel(gSampleMessages[idx].mSender);
wxStaticText *txtDate = (wxStaticText *) FindWindowById(XRCID("mail_date"), this);
if (txtDate)
txtDate->SetLabel(gSampleMessages[idx].mDate);
wxStaticText *txtSubject = (wxStaticText *) FindWindowById(XRCID("mail_subject"), this);
if (txtSubject)
txtSubject->SetLabel(gSampleMessages[idx].mSubject);
wxWindow *hdrPanel = FindWindowById(XRCID("mail_header_panel"), this);
if (hdrPanel)
{
hdrPanel->Show(TRUE);
}
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebbrowser);
nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(mWebBrowser);
webNav->LoadURI(NS_ConvertASCIItoUCS2(url.c_str()).get(),
nsIWebNavigation::LOAD_FLAGS_NONE,
nsnull,

View File

@@ -32,12 +32,10 @@
#ifndef MAILFRAME_H
#define MAILFRAME_H
#include "GeckoContainer.h"
#include "GeckoWindow.h"
#include "GeckoFrame.h"
class MailFrame :
public wxFrame,
public GeckoContainerUI
public GeckoFrame
{
public :
MailFrame(wxWindow* aParent);
@@ -46,8 +44,6 @@ public :
void OnArticleClick(wxListEvent &event);
GeckoWindow *mGeckoWnd;
nsCOMPtr<nsIWebBrowser> mWebbrowser;
};
#endif

View File

@@ -10,8 +10,10 @@ OBJECTS = \
BrowserFrame.obj \
MailFrame.obj \
ChatFrame.obj \
EditorFrame.obj \
GeckoContainer.obj \
GeckoContainerUI.obj \
GeckoFrame.obj \
GeckoWindow.obj \
GeckoWindowCreator.obj \
GeckoProtocolHandler.obj \
@@ -22,6 +24,7 @@ XRC = \
rc\browser.xrc \
rc\mail.xrc \
rc\chat.xrc \
rc\editor.xrc \
$(NULL)
# Needing to include this big long list of includes STINKS!!!
@@ -41,6 +44,7 @@ MOZINC = \
-I$(MOZSDK)\include\webbrwsr \
-I$(MOZSDK)\include\embed_base \
-I$(MOZSDK)\include\windowwatcher \
-I$(MOZSDK)\include\composer \
$(NULL)
# This isn't much better either!

View File

@@ -72,6 +72,9 @@
<object class="wxMenuItem" name="menu_chat">
<label>_Chat</label>
</object>
<object class="wxMenuItem" name="menu_editor">
<label>_Editor</label>
</object>
</object>
</object>

View File

@@ -33,7 +33,7 @@
</object>
<object class="sizeritem">
<flag>wxGROW|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
<object class="wxTextCtrl" name="url">
<object class="wxTextCtrl" name="chat">
<style>wxTE_PROCESS_ENTER</style>
</object>
</object>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<resource version="2.3.0.1">
<object class="wxFrame" name="editor_frame">
<title>wxEmbed Mail</title>
<size>300,300</size>
<style>wxCAPTION|wxSYSTEM_MENU|wxRESIZE_BORDER|wxRESIZE_BOX|wxCLIP_CHILDREN</style>
<pos>-1,-1</pos>
<!-- Editor menu -->
<object class="wxMenuBar" name="mainmenu">
<style>wxMB_DOCKABLE</style>
<object_ref ref="menu_file"/>
</object>
<!-- Editor tool bar -->
<object class="wxToolBar" name="toolbar">
<style>wxTB_FLAT|wxTB_DOCKABLE</style>
<margins>2,2</margins>
<bitmapsize>20,18</bitmapsize>
<object class="tool" name="edit_bold">
<bitmap>home.gif</bitmap>
<tooltip>Bold</tooltip>
</object>
<object class="tool" name="browse_italic">
<bitmap>home.gif</bitmap>
<tooltip>Italic</tooltip>
</object>
<object class="separator"/>
<object class="tool" name="browse_underline">
<bitmap>home.gif</bitmap>
<tooltip>Underline</tooltip>
</object>
<object class="separator"/>
<object class="tool" name="browse_indent">
<bitmap>home.gif</bitmap>
<tooltip>Indent paragraph</tooltip>
</object>
<object class="tool" name="browse_outdent">
<bitmap>home.gif</bitmap>
<tooltip>Outdent paragraph</tooltip>
</object>
</object>
<object class="wxFlexGridSizer">
<cols>1</cols>
<rows>1</rows>
<vgap>0</vgap>
<hgap>0</hgap>
<growablecols>0</growablecols>
<growablerows>0</growablerows>
<!-- Gecko Window -->
<object class="sizeritem">
<flag>wxGROW|wxALL</flag>
<object class="wxPanel" name="gecko" subclass="GeckoWindow">
<style>wxCLIP_CHILDREN|wxSUNKEN_BORDER</style>
<size>500,280</size>
</object>
</object>
</object>
</object>
</resource>

View File

@@ -90,6 +90,14 @@ SOURCE=.\BrowserFrame.cpp
# End Source File
# Begin Source File
SOURCE=.\ChatFrame.cpp
# End Source File
# Begin Source File
SOURCE=.\EditorFrame.cpp
# End Source File
# Begin Source File
SOURCE=.\EmbedApp.cpp
# End Source File
# Begin Source File
@@ -102,6 +110,10 @@ SOURCE=.\GeckoContainerUI.cpp
# End Source File
# Begin Source File
SOURCE=.\GeckoFrame.cpp
# End Source File
# Begin Source File
SOURCE=.\GeckoProtocolHandler.cpp
# End Source File
# Begin Source File
@@ -126,10 +138,22 @@ SOURCE=.\BrowserFrame.h
# End Source File
# Begin Source File
SOURCE=.\ChatFrame.h
# End Source File
# Begin Source File
SOURCE=.\EditorFrame.h
# End Source File
# Begin Source File
SOURCE=.\GeckoContainer.h
# End Source File
# Begin Source File
SOURCE=.\GeckoFrame.h
# End Source File
# Begin Source File
SOURCE=.\GeckoProtocolHandler.h
# End Source File
# Begin Source File
@@ -162,6 +186,14 @@ SOURCE=.\rc\browser.xrc
# End Source File
# Begin Source File
SOURCE=.\rc\chat.xrc
# End Source File
# Begin Source File
SOURCE=.\rc\editor.xrc
# End Source File
# Begin Source File
SOURCE=.\rc\forward.gif
# End Source File
# Begin Source File