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:
Robert Roebling 1999-08-20 22:52:21 +00:00
parent 5586805bfa
commit ed58dbeab6
28 changed files with 135 additions and 136 deletions

View File

@ -16,7 +16,7 @@
#pragma interface "datstrm.h"
#endif
#include <wx/stream.h>
#include "wx/stream.h"
#if wxUSE_STREAMS

View File

@ -16,13 +16,13 @@
# pragma interface
#endif
#include <wx/setup.h>
#include "wx/setup.h"
#if wxUSE_DYNLIB_CLASS
#include <wx/string.h>
#include <wx/list.h>
#include <wx/hash.h>
#include "wx/string.h"
#include "wx/list.h"
#include "wx/hash.h"
// this is normally done by configure, but I leave it here for now...
#if defined(__UNIX__) && !(defined(HAVE_DLOPEN) || defined(HAVE_SHL_LOAD))

View File

@ -16,7 +16,7 @@
#pragma interface "filefn.h"
#endif
#include <wx/list.h>
#include "wx/list.h"
// ----------------------------------------------------------------------------
// constants

View File

@ -23,7 +23,7 @@ limitation)
#pragma implementation
#endif
#include <wx/wxprec.h>
#include "wx/wxprec.h"
#ifdef __BORDLANDC__
#pragma hdrstop
@ -32,11 +32,10 @@ limitation)
#if wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
#ifndef WXPRECOMP
#include <wx/wx.h>
#include "wx/wx.h"
#endif
#include <wx/filesys.h>
#include "wx/filesys.h"
//--------------------------------------------------------------------------------

View File

@ -11,7 +11,7 @@
#pragma implementation
#endif
#include <wx/wxprec.h>
#include "wx/wxprec.h"
#ifdef __BORDLANDC__
#pragma hdrstop
@ -21,12 +21,10 @@
#ifndef WXPRECOMP
#include <wx/wx.h>
#include "wx/wx.h"
#endif
#include <wx/filesys.h>
#include "wx/filesys.h"
//--------------------------------------------------------------------------------
// wxZipFSHandler

View File

@ -130,6 +130,9 @@ public:
void OnNavigationKey(wxNavigationKeyEvent& event);
// overridden from wxWindow to make tabbing work
void SetFocus();
// implementation
void SetConstraintSizes(bool recurse);

View File

@ -130,6 +130,9 @@ public:
void OnNavigationKey(wxNavigationKeyEvent& event);
// overridden from wxWindow to make tabbing work
void SetFocus();
// implementation
void SetConstraintSizes(bool recurse);

View File

@ -11,7 +11,7 @@
#ifndef _WX_WXMMSTREAM_H__
#define _WX_WXMMSTREAM_H__
#include <wx/stream.h>
#include "wx/stream.h"
#if wxUSE_STREAMS

View File

@ -11,8 +11,8 @@
#ifndef _WX_WX_SERBASEH_H__
#define _WX_WX_SERBASEH_H__
#include <wx/setup.h>
#include <wx/dynlib.h>
#include "wx/setup.h"
#include "wx/dynlib.h"
#define WXSERIAL(classname) classname##_Serialize

View File

@ -24,13 +24,13 @@
// wxSocket headers (generic)
// ---------------------------------------------------------------------------
#ifdef WXPREC
# include <wx/wxprec.h>
# include "wx/wxprec.h"
#else
# include <wx/event.h>
# include <wx/string.h>
# include "wx/event.h"
# include "wx/string.h"
#endif
#include <wx/sckaddr.h>
#include "wx/sckaddr.h"
#include "wx/gsocket.h"
class WXDLLEXPORT wxTimer;

View File

@ -352,7 +352,7 @@ void WXDLLEXPORT wxMutexGuiLeave();
#else // !wxUSE_THREADS
#include <wx/defs.h> // for WXDLLEXPORT
#include "wx/defs.h" // for WXDLLEXPORT
// no thread support
inline void WXDLLEXPORT wxMutexGuiEnter() { }

View File

@ -16,7 +16,7 @@
#pragma interface "txtstrm.h"
#endif
#include <wx/stream.h>
#include "wx/stream.h"
#if wxUSE_STREAMS
@ -73,6 +73,8 @@ class WXDLLEXPORT wxTextOutputStream {
wxOutputStream *m_output;
};
wxTextOutputStream &endl( wxTextOutputStream &stream );
#endif
// wxUSE_STREAMS

View File

@ -20,10 +20,10 @@
#if wxUSE_STREAMS && wxUSE_FILE
#include <wx/object.h>
#include <wx/string.h>
#include <wx/stream.h>
#include <wx/file.h>
#include "wx/object.h"
#include "wx/string.h"
#include "wx/stream.h"
#include "wx/file.h"
class wxFileInputStream: public wxInputStream {
public:

View File

@ -19,7 +19,7 @@
#if wxUSE_ZLIB && wxUSE_STREAMS
#include <wx/stream.h>
#include "wx/stream.h"
class WXDLLEXPORT wxZlibInputStream: public wxFilterInputStream {
public:

View File

@ -384,7 +384,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
button->SetToolTip( "Press here to set italic font" );
#endif // wxUSE_TOOLTIPS
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "&Disable", wxPoint(20,130), wxSize(-1, -1), wxALIGN_RIGHT );
m_checkbox = new wxCheckBox( panel, ID_LISTBOX_ENABLE, "&Disable", wxPoint(20,130) );
m_checkbox->SetValue(FALSE);
#if wxUSE_TOOLTIPS
m_checkbox->SetToolTip( "Click here to disable the listbox" );

View File

@ -271,7 +271,7 @@ void MyFrame::FileOpen(wxCommandEvent& WXUNUSED(event) )
void MyFrame::FileSave(wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog(this, "Testing save file dialog", "", "",
wxFileDialog dialog(this, "Testing save file dialog", "", "myletter.txt",
"Text files (*.txt)|*.txt|Document files (*.doc)|*.doc",
wxSAVE|wxOVERWRITE_PROMPT);

View File

@ -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 )

View File

@ -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() )

View File

@ -477,5 +477,10 @@ wxTextOutputStream& wxTextOutputStream::operator<<(float f)
return *this;
}
wxTextOutputStream &endl( wxTextOutputStream &stream )
{
return stream << _T('\n');
}
#endif
// wxUSE_STREAMS

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 );

View File

@ -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)) &&

View File

@ -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

View File

@ -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 );

View File

@ -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)) &&