Changed a few #include <xxx.h> to #include "xxx.h"
Added endl operator to wxTextStream Corrrected a few misbehaviours in wxFileDialog, Corrected tab traversal a bit Corrected wxImage::SetData() to not copy, but take the data and care for ref couting as well git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -300,7 +300,20 @@ void wxImage::SetData( char unsigned *data )
|
||||
{
|
||||
wxCHECK_RET( Ok(), _T("invalid image") );
|
||||
|
||||
memcpy(M_IMGDATA->m_data, data, M_IMGDATA->m_width * M_IMGDATA->m_height * 3);
|
||||
wxImageRefData *newRefData = new wxImageRefData();
|
||||
|
||||
newRefData->m_width = M_IMGDATA->m_width;
|
||||
newRefData->m_height = M_IMGDATA->m_height;
|
||||
newRefData->m_data = data;
|
||||
newRefData->m_ok = TRUE;
|
||||
newRefData->m_maskRed = M_IMGDATA->m_maskRed;
|
||||
newRefData->m_maskGreen = M_IMGDATA->m_maskGreen;
|
||||
newRefData->m_maskBlue = M_IMGDATA->m_maskBlue;
|
||||
newRefData->m_hasMask = M_IMGDATA->m_hasMask;
|
||||
|
||||
UnRef();
|
||||
|
||||
m_refData = newRefData;
|
||||
}
|
||||
|
||||
void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
|
||||
|
@@ -40,6 +40,7 @@
|
||||
#include "wx/intl.h"
|
||||
#include "wx/file.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/debug.h"
|
||||
#include "wx/utils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -337,20 +338,22 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName0)
|
||||
// not yet be loaded (and it's normal)
|
||||
//
|
||||
// (we're using an object because we have several return paths)
|
||||
|
||||
NoTransErr noTransErr;
|
||||
// Then why do you translate at all? Just use _T() and not _(). RR.
|
||||
|
||||
wxLogVerbose(_("looking for catalog '%s' in path '%s'."),
|
||||
szName, searchPath.c_str());
|
||||
szName.c_str, searchPath.c_str());
|
||||
|
||||
wxString strFullName;
|
||||
if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) {
|
||||
wxLogWarning(_("catalog file for domain '%s' not found."), szName);
|
||||
wxLogWarning(_("catalog file for domain '%s' not found."), szName.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// open file
|
||||
wxLogVerbose(_("using catalog '%s' from '%s'."),
|
||||
szName, strFullName.c_str());
|
||||
szName.c_str(), strFullName.c_str());
|
||||
|
||||
wxFile fileMsg(strFullName);
|
||||
if ( !fileMsg.IsOpened() )
|
||||
|
@@ -477,5 +477,10 @@ wxTextOutputStream& wxTextOutputStream::operator<<(float f)
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxTextOutputStream &endl( wxTextOutputStream &stream )
|
||||
{
|
||||
return stream << _T('\n');
|
||||
}
|
||||
|
||||
#endif
|
||||
// wxUSE_STREAMS
|
||||
|
@@ -670,8 +670,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
|
||||
mainsizer->SetSizeHints( this );
|
||||
|
||||
Centre( wxBOTH );
|
||||
|
||||
m_list->SetFocus();
|
||||
|
||||
if (m_fileName.IsEmpty())
|
||||
m_list->SetFocus();
|
||||
else
|
||||
m_text->SetFocus();
|
||||
|
||||
wxEndBusyCursor();
|
||||
}
|
||||
@@ -723,6 +726,24 @@ void wxFileDialog::OnListOk( wxCommandEvent &event )
|
||||
return;
|
||||
}
|
||||
|
||||
if (filename == _T("~"))
|
||||
{
|
||||
m_list->GoToHomeDir();
|
||||
m_list->SetFocus();
|
||||
m_list->GetDir( dir );
|
||||
m_static->SetLabel( dir );
|
||||
return;
|
||||
}
|
||||
|
||||
if (filename[0] == _T('~'))
|
||||
{
|
||||
filename.Remove( 0, 1 );
|
||||
wxString tmp( wxGetUserHome() );
|
||||
tmp += _T('/');
|
||||
tmp += filename;
|
||||
filename = tmp;
|
||||
}
|
||||
|
||||
if ((filename.Find(_T('*')) != wxNOT_FOUND) ||
|
||||
(filename.Find(_T('?')) != wxNOT_FOUND))
|
||||
{
|
||||
@@ -736,13 +757,19 @@ void wxFileDialog::OnListOk( wxCommandEvent &event )
|
||||
}
|
||||
|
||||
if (dir != _T("/")) dir += _T("/");
|
||||
dir += filename;
|
||||
filename = dir;
|
||||
if (filename[0] != _T('/'))
|
||||
{
|
||||
dir += filename;
|
||||
filename = dir;
|
||||
}
|
||||
|
||||
if (wxDirExists(filename))
|
||||
{
|
||||
m_list->GoToDir( filename );
|
||||
m_text->SetValue( _T("..") );
|
||||
if (filename == _T("/"))
|
||||
m_text->SetValue( _T("") );
|
||||
else
|
||||
m_text->SetValue( _T("..") );
|
||||
m_list->GetDir( dir );
|
||||
m_static->SetLabel( dir );
|
||||
return;
|
||||
|
@@ -27,12 +27,12 @@
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/generic/imaglist.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/dcclient.h>
|
||||
#include "wx/string.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/generic/imaglist.h"
|
||||
#include "wx/notebook.h"
|
||||
#include "wx/dcclient.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
|
@@ -101,7 +101,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
||||
wxWindow *winFocus = event.GetCurrentFocus();
|
||||
if (!winFocus)
|
||||
winFocus = wxWindow::FindFocus();
|
||||
|
||||
|
||||
if (!winFocus)
|
||||
{
|
||||
event.Skip();
|
||||
@@ -126,14 +126,16 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
||||
// so give them the chance to process it instead of looping inside
|
||||
// this panel (normally, the focus will go to the next/previous
|
||||
// item after this panel in the parent panel)
|
||||
wxWindow *focussed_child_of_p = this;
|
||||
for ( wxWindow *p = GetParent(); p; p = p->GetParent() )
|
||||
{
|
||||
if ( wxDynamicCast(p, wxPanel) )
|
||||
{
|
||||
event.Skip();
|
||||
|
||||
return;
|
||||
event.SetCurrentFocus( focussed_child_of_p );
|
||||
if (p->GetEventHandler()->ProcessEvent( event ))
|
||||
return;
|
||||
}
|
||||
focussed_child_of_p = p;
|
||||
}
|
||||
|
||||
// no, we are not inside another panel so process this ourself
|
||||
|
@@ -127,43 +127,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
if (win->GetAutoLayout()) win->Layout();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "key_press_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static gint
|
||||
gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
if (!notebook->m_hasVMT) return FALSE;
|
||||
|
||||
/* this code makes jumping down from the handles of the notebooks
|
||||
to the actual items in the visible notebook page possible with
|
||||
the down-arrow key */
|
||||
|
||||
if (gdk_event->keyval != GDK_Down) return FALSE;
|
||||
|
||||
if (notebook != notebook->FindFocus()) return FALSE;
|
||||
|
||||
if (notebook->m_pages.GetCount() == 0) return FALSE;
|
||||
|
||||
wxNode *node = notebook->m_pages.Nth( notebook->GetSelection() );
|
||||
|
||||
if (!node) return FALSE;
|
||||
|
||||
wxNotebookPage *page = (wxNotebookPage*) node->Data();
|
||||
|
||||
// don't let others the key event
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
|
||||
page->m_client->SetFocus();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// InsertChild callback for wxNotebook
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -241,9 +204,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
||||
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
Show( TRUE );
|
||||
@@ -251,6 +211,19 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetFocus()
|
||||
{
|
||||
if (m_pages.GetCount() == 0) return;
|
||||
|
||||
wxNode *node = m_pages.Nth( GetSelection() );
|
||||
|
||||
if (!node) return;
|
||||
|
||||
wxNotebookPage *page = (wxNotebookPage*) node->Data();
|
||||
|
||||
page->m_client->SetFocus();
|
||||
}
|
||||
|
||||
int wxNotebook::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, _T("invalid notebook") );
|
||||
@@ -284,7 +257,7 @@ wxString wxNotebook::GetPageText( int page ) const
|
||||
if (nb_page)
|
||||
return nb_page->m_text;
|
||||
else
|
||||
return "";
|
||||
return _T("");
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage( int page ) const
|
||||
|
@@ -98,7 +98,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxString wxStaticText::GetLabel(void) const
|
||||
wxString wxStaticText::GetLabel() const
|
||||
{
|
||||
char *str = (char *) NULL;
|
||||
gtk_label_get( GTK_LABEL(m_widget), &str );
|
||||
|
@@ -812,7 +812,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
ret = (ret || win->GetEventHandler()->ProcessEvent( event2 ));
|
||||
}
|
||||
|
||||
|
||||
/* win is a control: tab can be propagated up */
|
||||
if ( (!ret) &&
|
||||
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
||||
|
@@ -127,43 +127,6 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
||||
if (win->GetAutoLayout()) win->Layout();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "key_press_event"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static gint
|
||||
gtk_notebook_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxNotebook *notebook )
|
||||
{
|
||||
if (g_isIdle) wxapp_install_idle_handler();
|
||||
|
||||
if (g_blockEventsOnDrag) return FALSE;
|
||||
|
||||
if (!notebook->m_hasVMT) return FALSE;
|
||||
|
||||
/* this code makes jumping down from the handles of the notebooks
|
||||
to the actual items in the visible notebook page possible with
|
||||
the down-arrow key */
|
||||
|
||||
if (gdk_event->keyval != GDK_Down) return FALSE;
|
||||
|
||||
if (notebook != notebook->FindFocus()) return FALSE;
|
||||
|
||||
if (notebook->m_pages.GetCount() == 0) return FALSE;
|
||||
|
||||
wxNode *node = notebook->m_pages.Nth( notebook->GetSelection() );
|
||||
|
||||
if (!node) return FALSE;
|
||||
|
||||
wxNotebookPage *page = (wxNotebookPage*) node->Data();
|
||||
|
||||
// don't let others the key event
|
||||
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
|
||||
|
||||
page->m_client->SetFocus();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// InsertChild callback for wxNotebook
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -241,9 +204,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
|
||||
m_parent->DoAddChild( this );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_widget), "key_press_event",
|
||||
GTK_SIGNAL_FUNC(gtk_notebook_key_press_callback), (gpointer)this );
|
||||
|
||||
PostCreation();
|
||||
|
||||
Show( TRUE );
|
||||
@@ -251,6 +211,19 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetFocus()
|
||||
{
|
||||
if (m_pages.GetCount() == 0) return;
|
||||
|
||||
wxNode *node = m_pages.Nth( GetSelection() );
|
||||
|
||||
if (!node) return;
|
||||
|
||||
wxNotebookPage *page = (wxNotebookPage*) node->Data();
|
||||
|
||||
page->m_client->SetFocus();
|
||||
}
|
||||
|
||||
int wxNotebook::GetSelection() const
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, -1, _T("invalid notebook") );
|
||||
@@ -284,7 +257,7 @@ wxString wxNotebook::GetPageText( int page ) const
|
||||
if (nb_page)
|
||||
return nb_page->m_text;
|
||||
else
|
||||
return "";
|
||||
return _T("");
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage( int page ) const
|
||||
|
@@ -98,7 +98,7 @@ bool wxStaticText::Create(wxWindow *parent,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxString wxStaticText::GetLabel(void) const
|
||||
wxString wxStaticText::GetLabel() const
|
||||
{
|
||||
char *str = (char *) NULL;
|
||||
gtk_label_get( GTK_LABEL(m_widget), &str );
|
||||
|
@@ -812,7 +812,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
|
||||
ret = (ret || win->GetEventHandler()->ProcessEvent( event2 ));
|
||||
}
|
||||
|
||||
|
||||
/* win is a control: tab can be propagated up */
|
||||
if ( (!ret) &&
|
||||
((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
|
||||
|
Reference in New Issue
Block a user