Merge in from trunk r64802 - r68625

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/SOC2011_WEBVIEW@68626 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Steve Lamerton
2011-08-10 18:10:42 +00:00
97 changed files with 2524 additions and 1712 deletions

View File

@@ -648,6 +648,24 @@ MyFrame::MyFrame(const wxString& title)
// covers our entire client area to avoid jarring colour jumps
SetOwnBackgroundColour(m_canvas->GetBackgroundColour());
#endif // wxUSE_INFOBAR
#ifdef __WXMSW__
// Test MSW-specific function allowing to access the "system" menu.
wxMenu * const menu = MSWGetSystemMenu();
if ( menu )
{
menu->AppendSeparator();
// The ids of the menu commands in MSW system menu must be multiple of
// 16 so we can't use DIALOGS_ABOUTDLG_SIMPLE here because it might not
// satisfy this condition and need to define and connect a separate id.
static const int DIALOGS_SYSTEM_ABOUT = 0x4010;
menu->Append(DIALOGS_SYSTEM_ABOUT, "&About...");
Connect(DIALOGS_SYSTEM_ABOUT, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MyFrame::ShowSimpleAboutDialog));
}
#endif // __WXMSW__
}
MyFrame::~MyFrame()
@@ -2669,6 +2687,7 @@ const TestMessageBoxDialog::BtnInfo TestMessageBoxDialog::ms_btnInfo[] =
{ wxNO, "&No" },
{ wxOK, "&Ok" },
{ wxCANCEL, "&Cancel" },
{ wxHELP, "&Help" },
};
BEGIN_EVENT_TABLE(TestMessageBoxDialog, wxDialog)
@@ -2889,6 +2908,11 @@ void TestMessageBoxDialog::PrepareMessageDialog(wxMessageDialogBase &dlg)
dlg.SetOKLabel(m_labels[Btn_Ok]->GetValue());
}
}
if ( style & wxHELP )
{
dlg.SetHelpLabel(m_labels[Btn_Help]->GetValue());
}
}
void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
@@ -2896,7 +2920,34 @@ void TestMessageBoxDialog::OnApply(wxCommandEvent& WXUNUSED(event))
wxMessageDialog dlg(this, GetMessage(), "Test Message Box", GetStyle());
PrepareMessageDialog(dlg);
dlg.ShowModal();
wxString btnName;
switch ( dlg.ShowModal() )
{
case wxID_OK:
btnName = "OK";
break;
case wxID_CANCEL:
// Avoid the extra message box if the dialog was cancelled.
return;
case wxID_YES:
btnName = "Yes";
break;
case wxID_NO:
btnName = "No";
break;
case wxID_HELP:
btnName = "Help";
break;
default:
btnName = "Unknown";
}
wxLogMessage("Dialog was closed with the \"%s\" button.", btnName);
}
void TestMessageBoxDialog::OnClose(wxCommandEvent& WXUNUSED(event))

View File

@@ -228,6 +228,7 @@ private:
Btn_No,
Btn_Ok,
Btn_Cancel,
Btn_Help,
Btn_Max
};

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: printing.cpp
// Name: helpview.cpp
// Purpose: wxHtml sample: help browser
// Author: ?
// Modified by:

View File

@@ -143,7 +143,7 @@ class wxMediaPlayerApp : public wxApp
{
public:
#ifdef __WXMAC__
virtual void MacOpenFile(const wxString & fileName );
virtual void MacOpenFiles(const wxArrayString & fileNames );
#endif
virtual bool OnInit();
@@ -463,10 +463,10 @@ bool wxMediaPlayerApp::OnInit()
#ifdef __WXMAC__
void wxMediaPlayerApp::MacOpenFile(const wxString & fileName )
void wxMediaPlayerApp::MacOpenFiles(const wxArrayString & fileNames )
{
// Called when a user drags a file over our app
m_frame->DoOpenFile(fileName, true /* new page */);
// Called when a user drags files over our app
m_frame->DoOpenFile(fileNames[0], true /* new page */);
}
#endif // __WXMAC__

View File

@@ -128,6 +128,7 @@ public:
void DoSelectText();
void DoMoveToEndOfText();
void DoMoveToEndOfEntry();
void DoGetWindowCoordinates();
// return true if currently text control has any selection
bool HasSelection() const
@@ -217,6 +218,10 @@ public:
void OnMoveToEndOfText( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoMoveToEndOfText(); }
void OnGetWindowCoordinates( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoGetWindowCoordinates(); }
void OnMoveToEndOfEntry( wxCommandEvent& WXUNUSED(event) )
{ m_panel->DoMoveToEndOfEntry(); }
@@ -415,6 +420,7 @@ enum
TEXT_ADD_FREEZE,
TEXT_ADD_LINE,
TEXT_MOVE_ENDTEXT,
TEXT_GET_WINDOW_COORD,
TEXT_MOVE_ENDENTRY,
TEXT_SET_EDITABLE,
TEXT_SET_ENABLED,
@@ -513,6 +519,7 @@ bool MyApp::OnInit()
menuText->Append(TEXT_LINE_UP, wxT("Scroll text one line up"));
menuText->Append(TEXT_PAGE_DOWN, wxT("Scroll text one page down"));
menuText->Append(TEXT_PAGE_UP, wxT("Scroll text one page up"));
menuText->Append(TEXT_GET_WINDOW_COORD, wxT("Get window coordinates"));
menuText->AppendSeparator();
menuText->Append(TEXT_GET_LINE, wxT("Get the text of a line of the tabbed multiline"));
menuText->Append(TEXT_GET_LINELENGTH, wxT("Get the length of a line of the tabbed multiline"));
@@ -1318,6 +1325,18 @@ void MyPanel::DoMoveToEndOfText()
m_multitext->SetFocus();
}
void MyPanel::DoGetWindowCoordinates()
{
wxTextCtrl * const text = GetFocusedText();
const wxPoint pt0 = text->PositionToCoords(0);
const wxPoint ptCur = text->PositionToCoords(text->GetInsertionPoint());
*m_log << "Current position coordinates: "
"(" << ptCur.x << ", " << ptCur.y << "), "
"first position coordinates: "
"(" << pt0.x << ", " << pt0.y << ")\n";
}
void MyPanel::DoMoveToEndOfEntry()
{
m_text->SetInsertionPointEnd();
@@ -1380,6 +1399,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(TEXT_ADD_FREEZE, MyFrame::OnAddTextFreeze)
EVT_MENU(TEXT_ADD_LINE, MyFrame::OnAddTextLine)
EVT_MENU(TEXT_MOVE_ENDTEXT, MyFrame::OnMoveToEndOfText)
EVT_MENU(TEXT_GET_WINDOW_COORD, MyFrame::OnGetWindowCoordinates)
EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry)
EVT_MENU(TEXT_SET_EDITABLE, MyFrame::OnSetEditable)