1. wxFileDataObject fixes from Ricky Gonzales - seems to work, so demo added
to the dnd sample and documented 2. wxLogTextCtrl gets status messages too (were just eaten) 3. wxWindow::Enable() goes down recursively 4. attempts at fixing wxButton::SetBackgroundColour() - didn't work :-( git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,10 +1,16 @@
|
|||||||
\section{\class{wxFileDataObject}}\label{wxfiledataobject}
|
\section{\class{wxFileDataObject}}\label{wxfiledataobject}
|
||||||
|
|
||||||
wxFileDataObject is a specialization of \helpref{wxDataObject}{wxdataobject}
|
wxFileDataObject is a specialization of \helpref{wxDataObject}{wxdataobject}
|
||||||
for file names. Unlike other predefined wxDataObject derivations, it only works
|
for file names. The program works with it just as if it were a list of file
|
||||||
in one direction - the one of setting the data, i.e. the program can only
|
names (absolutep aths always), but internally it uses the same format as
|
||||||
receive files dropped on it using it and there is no way (currently) to
|
Explorer and other compatible programs under Windows or GNOME/KDE filemanager
|
||||||
initiate a drag and drop file operation.
|
under Unix which makes it possible to receive files from them using this
|
||||||
|
class.
|
||||||
|
|
||||||
|
{\bf Warning:} Under all non-Windows platforms this class is currently
|
||||||
|
"input-only", i.e. you can receieve the files from another application, but
|
||||||
|
copying (or dragging) file(s) from a wxWindows application is not currently
|
||||||
|
supported.
|
||||||
|
|
||||||
\wxheading{Virtual functions to override}
|
\wxheading{Virtual functions to override}
|
||||||
|
|
||||||
@@ -35,6 +41,12 @@ None.
|
|||||||
|
|
||||||
Constructor.
|
Constructor.
|
||||||
|
|
||||||
|
\membersection{wxFileDataObject::AddFile}\label{wxfiledataobjectaddfile}
|
||||||
|
|
||||||
|
\func{virtual void}{AddFile}{\param{const wxString\& }{file}}
|
||||||
|
|
||||||
|
{\bf MSW only:} adds a file to the file list represented by this data object.
|
||||||
|
|
||||||
\membersection{wxFileDataObject::GetFilenames}\label{wxfiledataobjectgetfilenames}
|
\membersection{wxFileDataObject::GetFilenames}\label{wxfiledataobjectgetfilenames}
|
||||||
|
|
||||||
\constfunc{const wxArrayString\& }{GetFilenames}{\void}
|
\constfunc{const wxArrayString\& }{GetFilenames}{\void}
|
||||||
|
@@ -320,8 +320,8 @@ private:
|
|||||||
// virtual function hiding supression
|
// virtual function hiding supression
|
||||||
size_t GetDataSize(const wxDataFormat& format) const
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
bool GetDataHere(const wxDataFormat& WXUNUSED(format), void *pBuf) const
|
bool GetDataHere(const wxDataFormat& format, void *pBuf) const
|
||||||
{ return(wxDataObjectSimple::GetDataHere(pBuf)); }
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||||
};
|
};
|
||||||
@@ -376,8 +376,8 @@ private:
|
|||||||
// Virtual function hiding supression
|
// Virtual function hiding supression
|
||||||
size_t GetDataSize(const wxDataFormat& format) const
|
size_t GetDataSize(const wxDataFormat& format) const
|
||||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||||
bool GetDataHere(const wxDataFormat& WXUNUSED(format), void* pBuf) const
|
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||||
{ return(wxDataObjectSimple::GetDataHere(pBuf)); }
|
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -109,6 +109,9 @@ public:
|
|||||||
void OnSpinCtrl(wxSpinEvent& event);
|
void OnSpinCtrl(wxSpinEvent& event);
|
||||||
#endif // wxUSE_SPINCTRL
|
#endif // wxUSE_SPINCTRL
|
||||||
|
|
||||||
|
void OnEnableAll(wxCommandEvent& event);
|
||||||
|
void OnChangeColour(wxCommandEvent& event);
|
||||||
|
|
||||||
wxListBox *m_listbox,
|
wxListBox *m_listbox,
|
||||||
*m_listboxSorted;
|
*m_listboxSorted;
|
||||||
wxChoice *m_choice,
|
wxChoice *m_choice,
|
||||||
@@ -148,14 +151,20 @@ public:
|
|||||||
|
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
void OnSetTooltipDelay(wxCommandEvent& event);
|
void OnSetTooltipDelay(wxCommandEvent& event);
|
||||||
void OnToggleTooltips(wxCommandEvent& event);
|
void OnToggleTooltips(wxCommandEvent& event);
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
void OnEnableAll(wxCommandEvent& event);
|
||||||
|
|
||||||
void OnIdle( wxIdleEvent& event );
|
void OnIdle( wxIdleEvent& event );
|
||||||
void OnSize( wxSizeEvent& event );
|
void OnSize( wxSizeEvent& event );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
wxPanel *m_panel;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -180,7 +189,10 @@ enum
|
|||||||
|
|
||||||
// tooltip menu
|
// tooltip menu
|
||||||
MINIMAL_SET_TOOLTIP_DELAY = 200,
|
MINIMAL_SET_TOOLTIP_DELAY = 200,
|
||||||
MINIMAL_ENABLE_TOOLTIPS
|
MINIMAL_ENABLE_TOOLTIPS,
|
||||||
|
|
||||||
|
// panel menu
|
||||||
|
MINIMAL_ENABLE_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
@@ -198,6 +210,7 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
wxMenu *file_menu = new wxMenu("", wxMENU_TEAROFF );
|
wxMenu *file_menu = new wxMenu("", wxMENU_TEAROFF );
|
||||||
file_menu->Append(MINIMAL_ABOUT, "&About\tF1");
|
file_menu->Append(MINIMAL_ABOUT, "&About\tF1");
|
||||||
|
file_menu->AppendSeparator();
|
||||||
file_menu->Append(MINIMAL_QUIT, "E&xit\tAlt-X", "Quit controls sample");
|
file_menu->Append(MINIMAL_QUIT, "E&xit\tAlt-X", "Quit controls sample");
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
@@ -213,6 +226,11 @@ bool MyApp::OnInit()
|
|||||||
menu_bar->Append(tooltip_menu, "&Tooltips");
|
menu_bar->Append(tooltip_menu, "&Tooltips");
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
wxMenu *panel_menu = new wxMenu;
|
||||||
|
panel_menu->Append(MINIMAL_ENABLE_ALL, "&Disable all\tCtrl-E",
|
||||||
|
"Enable/disable all panel controls", TRUE);
|
||||||
|
menu_bar->Append(panel_menu, "&Panel");
|
||||||
|
|
||||||
frame->SetMenuBar(menu_bar);
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
frame->Show(TRUE);
|
frame->Show(TRUE);
|
||||||
@@ -277,6 +295,8 @@ const int ID_BTNPROGRESS = 183;
|
|||||||
const int ID_BUTTON_LABEL = 184;
|
const int ID_BUTTON_LABEL = 184;
|
||||||
const int ID_SPINCTRL = 185;
|
const int ID_SPINCTRL = 185;
|
||||||
|
|
||||||
|
const int ID_CHANGE_COLOUR = 200;
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
||||||
EVT_SIZE ( MyPanel::OnSize)
|
EVT_SIZE ( MyPanel::OnSize)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging)
|
EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging)
|
||||||
@@ -326,14 +346,13 @@ EVT_BUTTON (ID_BTNPROGRESS, MyPanel::OnShowProgress)
|
|||||||
EVT_SPIN (ID_SPINCTRL, MyPanel::OnSpinCtrl)
|
EVT_SPIN (ID_SPINCTRL, MyPanel::OnSpinCtrl)
|
||||||
#endif // wxUSE_SPINCTRL
|
#endif // wxUSE_SPINCTRL
|
||||||
EVT_BUTTON (ID_BUTTON_LABEL, MyPanel::OnUpdateLabel)
|
EVT_BUTTON (ID_BUTTON_LABEL, MyPanel::OnUpdateLabel)
|
||||||
|
EVT_CHECKBOX (ID_CHANGE_COLOUR, MyPanel::OnChangeColour)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||||
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
|
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ),
|
||||||
m_text(NULL), m_notebook(NULL)
|
m_text(NULL), m_notebook(NULL)
|
||||||
{
|
{
|
||||||
// SetBackgroundColour("cadet blue");
|
|
||||||
|
|
||||||
m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE );
|
m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE );
|
||||||
// m_text->SetBackgroundColour("wheat");
|
// m_text->SetBackgroundColour("wheat");
|
||||||
|
|
||||||
@@ -435,6 +454,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
m_checkbox->SetToolTip( "Click here to disable the listbox" );
|
m_checkbox->SetToolTip( "Click here to disable the listbox" );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
(void)new wxCheckBox( panel, ID_CHANGE_COLOUR, "&Toggle colour",
|
||||||
|
wxPoint(110,170) );
|
||||||
m_notebook->AddPage(panel, "wxListBox", TRUE, Image_List);
|
m_notebook->AddPage(panel, "wxListBox", TRUE, Image_List);
|
||||||
|
|
||||||
panel = new wxPanel(m_notebook);
|
panel = new wxPanel(m_notebook);
|
||||||
@@ -642,6 +663,30 @@ void MyPanel::OnPageChanged( wxNotebookEvent &event )
|
|||||||
*m_text << "Notebook selection is " << event.GetSelection() << "\n";
|
*m_text << "Notebook selection is " << event.GetSelection() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyPanel::OnChangeColour(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
static wxColour s_colOld;
|
||||||
|
|
||||||
|
// test panel colour changing and propagation to the subcontrols
|
||||||
|
if ( s_colOld.Ok() )
|
||||||
|
{
|
||||||
|
SetBackgroundColour(s_colOld);
|
||||||
|
s_colOld = wxNullColour;
|
||||||
|
|
||||||
|
m_lbSelectThis->SetBackgroundColour("blue");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_colOld = GetBackgroundColour();
|
||||||
|
SetBackgroundColour("green");
|
||||||
|
|
||||||
|
m_lbSelectThis->SetBackgroundColour("red");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_lbSelectThis->Refresh();
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
void MyPanel::OnListBox( wxCommandEvent &event )
|
void MyPanel::OnListBox( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox
|
wxListBox *listbox = event.GetId() == ID_LISTBOX ? m_listbox
|
||||||
@@ -1035,6 +1080,9 @@ EVT_MENU(MINIMAL_ABOUT, MyFrame::OnAbout)
|
|||||||
EVT_MENU(MINIMAL_SET_TOOLTIP_DELAY, MyFrame::OnSetTooltipDelay)
|
EVT_MENU(MINIMAL_SET_TOOLTIP_DELAY, MyFrame::OnSetTooltipDelay)
|
||||||
EVT_MENU(MINIMAL_ENABLE_TOOLTIPS, MyFrame::OnToggleTooltips)
|
EVT_MENU(MINIMAL_ENABLE_TOOLTIPS, MyFrame::OnToggleTooltips)
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
EVT_MENU(MINIMAL_ENABLE_ALL, MyFrame::OnEnableAll)
|
||||||
|
|
||||||
EVT_SIZE(MyFrame::OnSize)
|
EVT_SIZE(MyFrame::OnSize)
|
||||||
EVT_IDLE(MyFrame::OnIdle)
|
EVT_IDLE(MyFrame::OnIdle)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
@@ -1044,7 +1092,7 @@ MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
|
|||||||
{
|
{
|
||||||
CreateStatusBar(2);
|
CreateStatusBar(2);
|
||||||
|
|
||||||
(void)new MyPanel( this, 10, 10, 300, 100 );
|
m_panel = new MyPanel( this, 10, 10, 300, 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -1096,6 +1144,14 @@ void MyFrame::OnToggleTooltips(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
#endif // tooltips
|
#endif // tooltips
|
||||||
|
|
||||||
|
void MyFrame::OnEnableAll(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
static bool s_enable = TRUE;
|
||||||
|
|
||||||
|
s_enable = !s_enable;
|
||||||
|
m_panel->Enable(s_enable);
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnSize( wxSizeEvent& event )
|
void MyFrame::OnSize( wxSizeEvent& event )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@@ -320,12 +320,9 @@ void wxLog::DoLog(wxLogLevel level, const wxChar *szString, time_t t)
|
|||||||
case wxLOG_Info:
|
case wxLOG_Info:
|
||||||
if ( GetVerbose() )
|
if ( GetVerbose() )
|
||||||
case wxLOG_Message:
|
case wxLOG_Message:
|
||||||
|
case wxLOG_Status:
|
||||||
default: // log unknown log levels too
|
default: // log unknown log levels too
|
||||||
DoLogString(szString, t);
|
DoLogString(szString, t);
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxLOG_Status:
|
|
||||||
// nothing to do
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxLOG_Trace:
|
case wxLOG_Trace:
|
||||||
|
@@ -226,6 +226,8 @@ bool wxApp::Initialize()
|
|||||||
|
|
||||||
g_globalCursor = new wxCursor;
|
g_globalCursor = new wxCursor;
|
||||||
|
|
||||||
|
// VZ: these icons are not in wx.rc anyhow (but should they?)!
|
||||||
|
#if 0
|
||||||
wxSTD_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_FRAME"));
|
wxSTD_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_FRAME"));
|
||||||
wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDIPARENTFRAME"));
|
wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDIPARENTFRAME"));
|
||||||
wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDICHILDFRAME"));
|
wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxSTD_MDICHILDFRAME"));
|
||||||
@@ -233,6 +235,7 @@ bool wxApp::Initialize()
|
|||||||
wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_FRAME"));
|
wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_FRAME"));
|
||||||
wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDIPARENTFRAME"));
|
wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDIPARENTFRAME"));
|
||||||
wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDICHILDFRAME"));
|
wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, wxT("wxDEFAULT_MDICHILDFRAME"));
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
RegisterWindowClasses();
|
RegisterWindowClasses();
|
||||||
|
|
||||||
|
@@ -249,8 +249,19 @@ WXHBRUSH wxButton::OnCtlColor(WXHDC pDC,
|
|||||||
WXWPARAM wParam,
|
WXWPARAM wParam,
|
||||||
WXLPARAM lParam)
|
WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
const HDC& hdc = (HDC)pDC;
|
||||||
|
|
||||||
|
const wxColour& colBack = GetBackgroundColour();
|
||||||
|
::SetBkColor(hdc, RGB(colBack.Red(), colBack.Green(), colBack.Blue()));
|
||||||
|
|
||||||
|
const wxColour& colFor = GetForegroundColour();
|
||||||
|
::SetTextColor(hdc, RGB(colFor.Red(), colFor.Green(), colFor.Blue()));
|
||||||
|
|
||||||
|
::SetBkMode(hdc, OPAQUE);
|
||||||
|
|
||||||
|
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(colBack,
|
||||||
|
wxSOLID);
|
||||||
|
backgroundBrush->RealizeResource();
|
||||||
return (WXHBRUSH)backgroundBrush->GetResourceHandle();
|
return (WXHBRUSH)backgroundBrush->GetResourceHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -260,7 +260,7 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
|
|||||||
|
|
||||||
// and now it has the data
|
// and now it has the data
|
||||||
wxDragResult rc = ConvertDragEffectToResult(GetDropEffect(grfKeyState));
|
wxDragResult rc = ConvertDragEffectToResult(GetDropEffect(grfKeyState));
|
||||||
m_pTarget->OnData(pt.x, pt.y, rc);
|
rc = m_pTarget->OnData(pt.x, pt.y, rc);
|
||||||
if ( wxIsDragResultOk(rc) ) {
|
if ( wxIsDragResultOk(rc) ) {
|
||||||
// operation succeeded
|
// operation succeeded
|
||||||
*pdwEffect = ConvertDragResultToEffect(rc);
|
*pdwEffect = ConvertDragResultToEffect(rc);
|
||||||
|
@@ -372,6 +372,15 @@ bool wxWindow::Enable(bool enable)
|
|||||||
if ( hWnd )
|
if ( hWnd )
|
||||||
::EnableWindow(hWnd, (BOOL)enable);
|
::EnableWindow(hWnd, (BOOL)enable);
|
||||||
|
|
||||||
|
wxWindowList::Node *node = GetChildren().GetFirst();
|
||||||
|
while ( node )
|
||||||
|
{
|
||||||
|
wxWindow *child = node->GetData();
|
||||||
|
child->Enable(enable);
|
||||||
|
|
||||||
|
node = node->GetNext();
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user