#ifdef __GNUG__
#pragma implementation "profesional.cpp"
#endif
#include "ftpro.h"
wxGauge *HarborDialog::transfer_gauges[12];
LocalList *HarborDialog::local_list;
RemoteList *HarborDialog::remote_list;
TransferList *HarborDialog::transfer_list;
wxTextCtrl *HarborDialog::harbor_text;
BEGIN_EVENT_TABLE(TransferList,wxListCtrl)
EVT_RIGHT_DOWN(TransferList::OnRightDown)
EVT_MENU(ID_TRANSFER_ABORT_RC,TransferList::OnAbort)
EVT_MENU(ID_TRANSFER_RESUME_RC,TransferList::OnResume)
EVT_MENU(ID_TRANSFER_CLEAR_RC,TransferList::OnClear)
EVT_MENU(ID_TRANSFER_CLEARALL_RC,TransferList::OnClearAll)
END_EVENT_TABLE()
void TransferList::OnRightDown(wxMouseEvent &event)
{
MyPopupMenu menu("Transfers");
menu.Append( ID_TRANSFER_ABORT_RC, "Abort", "" );
menu.Append( ID_TRANSFER_RESUME_RC, "Resume", "" );
menu.AppendSeparator();
menu.Append( ID_TRANSFER_CLEAR_RC, "Clear", "" );
menu.Append( ID_TRANSFER_CLEARALL_RC, "Clear All", "" );
PopupMenu(&menu,event.GetX(),event.GetY());
}
void TransferList::OnAbort()
{}
void TransferList::OnResume()
{}
void TransferList::OnClear()
{}
void TransferList::OnClearAll()
{}
MyPopupMenu::MyPopupMenu(const wxString &title)
: wxMenu(title)
{
}
BEGIN_EVENT_TABLE(HtmlDialog,wxDialog)
EVT_BUTTON( ID_HTLM_GET, HtmlDialog::OnGet )
END_EVENT_TABLE()
HtmlDialog::HtmlDialog( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxDialog( parent, id, title, position, size, style )
{
html_dialog( this, TRUE );
}
void HtmlDialog::OnGet( wxCommandEvent &event )
{
wxMessageDialog dialog(this, "This is similar to wget's functionallity\nalso only available in the full version ;)","Promo mode",wxOK | wxICON_INFORMATION);
dialog.ShowModal();
}
BEGIN_EVENT_TABLE(HelpDialog,wxDialog)
EVT_BUTTON(ID_HELP_OK, HelpDialog::OnOk)
END_EVENT_TABLE()
HelpDialog::HelpDialog( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxDialog( parent, id, title, position, size, style )
{
help_dialog( this, TRUE );
}
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
EVT_MENU(ID_FILE_QC,MyFrame::OnQuickConnect)
EVT_MENU(ID_FILE_C, MyFrame::OnConnect)
EVT_MENU(ID_FILE_HTML, MyFrame::OnHtml)
EVT_MENU(ID_FILE_BEAMMEUP, MyFrame::OnBeam)
EVT_MENU(ID_FILE_EXIT,MyFrame::OnQuit)
EVT_MENU(ID_SETTINGS_SETTINGS, MyFrame::OnSettingsSettings)
EVT_MENU(ID_SETTINGS_HELP, MyFrame::OnSettingsHelp)
EVT_MENU(ID_SETTINGS_ABOUT, MyFrame::OnAbout)
END_EVENT_TABLE()
MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &position, const wxSize& size, long style ) :
wxFrame( parent, id, title, position, size, style )
{
CreateMyMenuBar();
CreateMyToolBar();
CreateStatusBar(1);
wxHtmlWindow* html = new wxHtmlWindow(this, -1, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html -> SetBorders(0);
html -> LoadPage("C:\\Program files\\Ftpro\\ftitle.html");
html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
html -> GetInternalRepresentation() -> GetHeight());
SetStatusText( "Welcome!" );
SetIcon(wxICON(logo));
// insert main window here
}
void MyFrame::CreateMyMenuBar()
{
#ifdef __WXMAC__
wxApp::s_macAboutMenuItemId = ID_ABOUT;
#endif
SetMenuBar( main_menu() );
}
void MyFrame::CreateMyToolBar()
{
// wxToolBar *tb = CreateToolBar( wxTB_HORIZONTAL|wxNO_BORDER /* |wxTB_FLAT */ );
// MyToolBarFunc( tb );
}
void MyFrame::OnQuit()
{
Close(TRUE);
}
void MyFrame::OnConnect( )
{
ConnectionDialog CD(this, -1, "Connect");
CD.ShowModal();
}
void MyFrame::OnQuickConnect( )
{
}
void MyFrame::OnAbout( )
{
wxBoxSizer *topsizer;
wxHtmlWindow *html;
wxDialog dlg(this, -1, wxString("About"));
topsizer = new wxBoxSizer(wxVERTICAL);
html = new wxHtmlWindow(&dlg, -1, wxDefaultPosition, wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html -> SetBorders(0);
html -> LoadPage("C:\\Program Files\\Ftpro\\about.html");
html -> SetSize(html -> GetInternalRepresentation() -> GetWidth(),
html -> GetInternalRepresentation() -> GetHeight());
topsizer -> Add(html, 1, wxALL, 10);
topsizer -> Add(new wxStaticLine(&dlg, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
wxButton *bu1 = new wxButton(&dlg, wxID_OK, "Okay");
bu1 -> SetDefault();
topsizer -> Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
dlg.SetAutoLayout(TRUE);
dlg.SetSizer(topsizer);
topsizer -> Fit(&dlg);
dlg.ShowModal();
}
void MyFrame::OnHtml()
{
HtmlDialog html(this, -1, "HTML");
html.ShowModal();
}
void MyFrame::OnBeam()
{
wxExecute("C:\\WINDOWS\\explorer.exe \"http:\\ftpro.sf.net\"");
}
void MyFrame::OnSettingsSettings()
{
SetupDialog setup(this, -1, "Setup");
setup.ShowModal();
}
void MyFrame::OnSettingsHelp()
{
HelpDialog help(this, -1, "Help");
help.ShowModal();
}
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
wxBitmap bitmap("C:\\Program Files\\Ftpro\\new.bmp", wxBITMAP_TYPE_BMP);
wxSplashScreen* splash = new wxSplashScreen(bitmap,
wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
3000, NULL, -1, wxDefaultPosition, wxDefaultSize,
wxSIMPLE_BORDER|wxSTAY_ON_TOP);
wxYield();
MyFrame *frame = new MyFrame( NULL, -1, "FTPro", wxPoint(20,20), wxSize(570,300) );
frame->Show( TRUE );
return TRUE;
}