GTK
- added docview sample, doesn't work :-( - changed wxBmpButton callback name git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,12 +59,13 @@ class wxTextCtrl: public wxControl, public streambuf
|
|||||||
wxString GetValue(void) const;
|
wxString GetValue(void) const;
|
||||||
void SetValue( const wxString &value );
|
void SetValue( const wxString &value );
|
||||||
void WriteText( const wxString &text );
|
void WriteText( const wxString &text );
|
||||||
/*
|
|
||||||
wxString GetLineText( const long lineNo ) const;
|
|
||||||
bool LoadFile( const wxString &file );
|
bool LoadFile( const wxString &file );
|
||||||
bool SaveFile( const wxString &file );
|
bool SaveFile( const wxString &file );
|
||||||
void DiscardEdits(void);
|
|
||||||
bool IsModified(void);
|
bool IsModified(void);
|
||||||
|
void DiscardEdits(void);
|
||||||
|
/*
|
||||||
|
wxString GetLineText( const long lineNo ) const;
|
||||||
void OnDropFiles( wxDropFilesEvent &event );
|
void OnDropFiles( wxDropFilesEvent &event );
|
||||||
long PositionToXY( const long pos, long *x, long *y ) const;
|
long PositionToXY( const long pos, long *x, long *y ) const;
|
||||||
long XYToPosition( const long x, const long y );
|
long XYToPosition( const long x, const long y );
|
||||||
@@ -97,6 +98,10 @@ class wxTextCtrl: public wxControl, public streambuf
|
|||||||
wxTextCtrl& operator<<(const double d);
|
wxTextCtrl& operator<<(const double d);
|
||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool m_modified;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -59,12 +59,13 @@ class wxTextCtrl: public wxControl, public streambuf
|
|||||||
wxString GetValue(void) const;
|
wxString GetValue(void) const;
|
||||||
void SetValue( const wxString &value );
|
void SetValue( const wxString &value );
|
||||||
void WriteText( const wxString &text );
|
void WriteText( const wxString &text );
|
||||||
/*
|
|
||||||
wxString GetLineText( const long lineNo ) const;
|
|
||||||
bool LoadFile( const wxString &file );
|
bool LoadFile( const wxString &file );
|
||||||
bool SaveFile( const wxString &file );
|
bool SaveFile( const wxString &file );
|
||||||
void DiscardEdits(void);
|
|
||||||
bool IsModified(void);
|
bool IsModified(void);
|
||||||
|
void DiscardEdits(void);
|
||||||
|
/*
|
||||||
|
wxString GetLineText( const long lineNo ) const;
|
||||||
void OnDropFiles( wxDropFilesEvent &event );
|
void OnDropFiles( wxDropFilesEvent &event );
|
||||||
long PositionToXY( const long pos, long *x, long *y ) const;
|
long PositionToXY( const long pos, long *x, long *y ) const;
|
||||||
long XYToPosition( const long x, const long y );
|
long XYToPosition( const long x, const long y );
|
||||||
@@ -97,6 +98,10 @@ class wxTextCtrl: public wxControl, public streambuf
|
|||||||
wxTextCtrl& operator<<(const double d);
|
wxTextCtrl& operator<<(const double d);
|
||||||
wxTextCtrl& operator<<(const char c);
|
wxTextCtrl& operator<<(const char c);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
bool m_modified;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
1
samples/docview/Makefile
Normal file
1
samples/docview/Makefile
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include ../../src/gtk/setup/general/makeapp
|
26
samples/docview/Makefile.in
Normal file
26
samples/docview/Makefile.in
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# WXXT base directory
|
||||||
|
WXBASEDIR=@WXBASEDIR@
|
||||||
|
|
||||||
|
# set the OS type for compilation
|
||||||
|
OS=@OS@
|
||||||
|
# compile a library only
|
||||||
|
RULE=bin
|
||||||
|
|
||||||
|
# define library name
|
||||||
|
BIN_TARGET=test
|
||||||
|
# define library sources
|
||||||
|
BIN_SRC=\
|
||||||
|
doc.cpp view.cpp docview.cpp
|
||||||
|
|
||||||
|
#define library objects
|
||||||
|
BIN_OBJ=\
|
||||||
|
doc.o view.o docview.o
|
||||||
|
|
||||||
|
# additional things needed to link
|
||||||
|
BIN_LINK=
|
||||||
|
|
||||||
|
# additional things needed to compile
|
||||||
|
ADD_COMPILE=
|
||||||
|
|
||||||
|
# include the definitions now
|
||||||
|
include ../../../template.mak
|
@@ -258,7 +258,7 @@ bool TextEditDocument::IsModified(void) const
|
|||||||
TextEditView *view = (TextEditView *)GetFirstView();
|
TextEditView *view = (TextEditView *)GetFirstView();
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
return (wxDocument::IsModified() || view->textsw->Modified());
|
return (wxDocument::IsModified() || view->textsw->IsModified());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxDocument::IsModified();
|
return wxDocument::IsModified();
|
||||||
|
@@ -26,7 +26,7 @@ class wxBitmapButton;
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
||||||
|
|
||||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||||
{
|
{
|
||||||
wxBitmapButton *button = (wxBitmapButton*)data;
|
wxBitmapButton *button = (wxBitmapButton*)data;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||||
@@ -77,7 +77,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
|
|||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
|
||||||
|
|
||||||
|
void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
||||||
|
{
|
||||||
|
win->m_modified = TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||||
// EVT_CHAR(wxTextCtrl::OnChar)
|
// EVT_CHAR(wxTextCtrl::OnChar)
|
||||||
@@ -28,12 +33,14 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxTextCtrl::wxTextCtrl(void) : streambuf()
|
wxTextCtrl::wxTextCtrl(void) : streambuf()
|
||||||
{
|
{
|
||||||
|
m_modified = FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, const wxWindowID id, const wxString &value,
|
wxTextCtrl::wxTextCtrl( wxWindow *parent, const wxWindowID id, const wxString &value,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
const int style, const wxString &name ) : streambuf()
|
const int style, const wxString &name ) : streambuf()
|
||||||
{
|
{
|
||||||
|
m_modified = FALSE;
|
||||||
Create( parent, id, value, pos, size, style, name );
|
Create( parent, id, value, pos, size, style, name );
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,9 +67,22 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
|
|||||||
if (!value.IsNull())
|
if (!value.IsNull())
|
||||||
{
|
{
|
||||||
gint tmp = 0;
|
gint tmp = 0;
|
||||||
|
|
||||||
|
// Don't know why this is so
|
||||||
|
if (style & wxTE_MULTILINE)
|
||||||
|
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length()+1, &tmp );
|
||||||
|
else
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
|
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (style & wxREADONLY)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (style & wxTE_MULTILINE) gtk_text_set_editable( GTK_TEXT(m_widget), 1 );
|
||||||
|
};
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -115,27 +135,31 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
|
||||||
wxString wxTextCtrl::GetLineText( const long lineNo ) const
|
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile( const wxString &file )
|
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::SaveFile( const wxString &file )
|
bool wxTextCtrl::IsModified(void)
|
||||||
{
|
{
|
||||||
|
return m_modified;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxTextCtrl::DiscardEdits(void)
|
void wxTextCtrl::DiscardEdits(void)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::IsModified(void)
|
/*
|
||||||
|
wxString wxTextCtrl::GetLineText( const long lineNo ) const
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@@ -26,7 +26,7 @@ class wxBitmapButton;
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
|
||||||
|
|
||||||
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
|
||||||
{
|
{
|
||||||
wxBitmapButton *button = (wxBitmapButton*)data;
|
wxBitmapButton *button = (wxBitmapButton*)data;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
|
||||||
@@ -77,7 +77,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
|
|||||||
SetSize( newSize.x, newSize.y );
|
SetSize( newSize.x, newSize.y );
|
||||||
|
|
||||||
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
|
||||||
GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
|
GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this );
|
||||||
|
|
||||||
PostCreation();
|
PostCreation();
|
||||||
|
|
||||||
|
@@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
|
||||||
|
|
||||||
|
void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
|
||||||
|
{
|
||||||
|
win->m_modified = TRUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
|
||||||
// EVT_CHAR(wxTextCtrl::OnChar)
|
// EVT_CHAR(wxTextCtrl::OnChar)
|
||||||
@@ -28,12 +33,14 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxTextCtrl::wxTextCtrl(void) : streambuf()
|
wxTextCtrl::wxTextCtrl(void) : streambuf()
|
||||||
{
|
{
|
||||||
|
m_modified = FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxTextCtrl::wxTextCtrl( wxWindow *parent, const wxWindowID id, const wxString &value,
|
wxTextCtrl::wxTextCtrl( wxWindow *parent, const wxWindowID id, const wxString &value,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
const int style, const wxString &name ) : streambuf()
|
const int style, const wxString &name ) : streambuf()
|
||||||
{
|
{
|
||||||
|
m_modified = FALSE;
|
||||||
Create( parent, id, value, pos, size, style, name );
|
Create( parent, id, value, pos, size, style, name );
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,9 +67,22 @@ bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &
|
|||||||
if (!value.IsNull())
|
if (!value.IsNull())
|
||||||
{
|
{
|
||||||
gint tmp = 0;
|
gint tmp = 0;
|
||||||
|
|
||||||
|
// Don't know why this is so
|
||||||
|
if (style & wxTE_MULTILINE)
|
||||||
|
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length()+1, &tmp );
|
||||||
|
else
|
||||||
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
|
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (style & wxREADONLY)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (style & wxTE_MULTILINE) gtk_text_set_editable( GTK_TEXT(m_widget), 1 );
|
||||||
|
};
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -115,27 +135,31 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
|
||||||
wxString wxTextCtrl::GetLineText( const long lineNo ) const
|
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::LoadFile( const wxString &file )
|
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::SaveFile( const wxString &file )
|
bool wxTextCtrl::IsModified(void)
|
||||||
{
|
{
|
||||||
|
return m_modified;
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxTextCtrl::DiscardEdits(void)
|
void wxTextCtrl::DiscardEdits(void)
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxTextCtrl::IsModified(void)
|
/*
|
||||||
|
wxString wxTextCtrl::GetLineText( const long lineNo ) const
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user