#define wxIMAGELIST_DRAW_SELECTED 0x0004
#define wxIMAGELIST_DRAW_FOCUSED 0x0008
+// Flag values for Set/GetImageList
+enum {
+ wxIMAGE_LIST_NORMAL, // Normal icons
+ wxIMAGE_LIST_SMALL, // Small icons
+ wxIMAGE_LIST_STATE // State icons: unimplemented (see WIN32 documentation)
+};
+
class wxImageList: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxImageList)
void DeleteItem( long item );
void DeleteChildren( long item );
bool DeleteAllItems();
+ bool ExpandItem(long item) { return ExpandItem(item, wxTREE_EXPAND_EXPAND); }
+ bool CollapseItem(long item) { return ExpandItem(item, wxTREE_EXPAND_COLLAPSE); }
+ bool ToggleItem(long item) { return ExpandItem(item, wxTREE_EXPAND_TOGGLE); }
bool ExpandItem( long item, int action );
bool GetItem( wxTreeItem &info ) const;
long GetItemData( long item ) const;
void OnChar( wxKeyEvent &event );
void OnMouse( const wxMouseEvent &event );
- void SetImageList(wxImageList *imageList) { m_imageList = imageList; }
- wxImageList *GetImageList() const { return m_imageList; }
-
+ wxImageList *GetImageList(int which = wxIMAGE_LIST_NORMAL) const;
+ void SetImageList(wxImageList *imageList, int which = wxIMAGE_LIST_NORMAL);
+
private:
wxGenericTreeItem *m_anchor;
wxGenericTreeItem *m_current;
wxPaintDC *m_dc;
wxBrush *m_hilightBrush;
wxImageList *m_imageList;
+ wxImageList *m_smallImageList;
void CalculateLevel( wxGenericTreeItem *item, wxPaintDC &dc, int level, int &y );
void CalculatePositions();
void OnCancel( wxCommandEvent &event );
void OnOk( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event);
+ bool Destroy(void);
void OnCloseWindow(wxCloseEvent& event);
/*
void OnCharHook(wxKeyEvent& event);
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual void InitDialog(void);
-/*
- void OnOK(wxCommandEvent& event);
- void OnApply(wxCommandEvent& event);
- void OnCancel(wxCommandEvent& event);
-*/
private:
void SetTitle( const wxString &title );
wxString GetTitle(void) const;
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
+ void OnIdle( wxIdleEvent &event );
//private:
void GtkOnSize( int x, int y, int width, int height );
+ void DoMenuUpdates(void);
+ void DoMenuUpdates(wxMenu* menu);
private:
private:
GtkList *m_list;
+ wxList m_clientData;
public:
class wxMenuItem;
class wxMenu;
+//-----------------------------------------------------------------------------
+// const
+//-----------------------------------------------------------------------------
+
+#define ID_SEPARATOR (-1)
+
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
wxString m_helpStr;
GtkWidget *m_menuItem; // GtkMenuItem
+
+ bool IsSeparator() const { return m_id == ID_SEPARATOR; }
+ bool IsEnabled() const { return m_isEnabled; }
+ bool IsChecked() const { return m_checked; }
+
+ int GetId() const { return m_id; }
+ const wxString& GetHelp() const { return m_helpStr; }
+ wxMenu *GetSubMenu() const { return m_subMenu; }
};
wxMenu *subMenu, const wxString &helpStr = "" );
int FindItem( const wxString itemString ) const;
void Break(void) {};
+ void Check(int id, bool Flag);
void Enable( int id, bool enable );
bool Enabled( int id ) const;
void SetLabel( int id, const wxString &label );
void OnCancel( wxCommandEvent &event );
void OnOk( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event);
+ bool Destroy(void);
void OnCloseWindow(wxCloseEvent& event);
/*
void OnCharHook(wxKeyEvent& event);
virtual void EndModal(int retCode);
virtual bool IsModal(void) const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
virtual void InitDialog(void);
-/*
- void OnOK(wxCommandEvent& event);
- void OnApply(wxCommandEvent& event);
- void OnCancel(wxCommandEvent& event);
-*/
private:
void SetTitle( const wxString &title );
wxString GetTitle(void) const;
void OnActivate( wxActivateEvent &WXUNUSED(event) ) {};
+ void OnIdle( wxIdleEvent &event );
//private:
void GtkOnSize( int x, int y, int width, int height );
+ void DoMenuUpdates(void);
+ void DoMenuUpdates(wxMenu* menu);
private:
private:
GtkList *m_list;
+ wxList m_clientData;
public:
class wxMenuItem;
class wxMenu;
+//-----------------------------------------------------------------------------
+// const
+//-----------------------------------------------------------------------------
+
+#define ID_SEPARATOR (-1)
+
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
wxString m_helpStr;
GtkWidget *m_menuItem; // GtkMenuItem
+
+ bool IsSeparator() const { return m_id == ID_SEPARATOR; }
+ bool IsEnabled() const { return m_isEnabled; }
+ bool IsChecked() const { return m_checked; }
+
+ int GetId() const { return m_id; }
+ const wxString& GetHelp() const { return m_helpStr; }
+ wxMenu *GetSubMenu() const { return m_subMenu; }
};
wxMenu *subMenu, const wxString &helpStr = "" );
int FindItem( const wxString itemString ) const;
void Break(void) {};
+ void Check(int id, bool Flag);
void Enable( int id, bool enable );
bool Enabled( int id ) const;
void SetLabel( int id, const wxString &label );
file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, "E&xit");
-
+
// A nice touch: a history of files visited. Use this menu.
m_docManager->FileHistoryUseMenu(file_menu);
// Make an image list containing small icons
m_imageListNormal = new wxImageList(16, 16, TRUE);
+#ifdef __WXMSW__
wxIcon icon1("icon1", wxBITMAP_TYPE_ICO_RESOURCE);
m_imageListNormal->Add(icon1);
wxIcon icon2("icon2", wxBITMAP_TYPE_ICO_RESOURCE);
m_imageListNormal->Add(icon2);
+#else
+#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
}
else
{
- wxNode *node = m_children.First();
- while (node)
+ if (!m_isCollapsed)
{
- wxGenericTreeItem *child = (wxGenericTreeItem*)node->Data();
- long res = child->HitTest( point, flags );
- if (res != -1) return res;
- node = node->Next();
+ wxNode *node = m_children.First();
+ while (node)
+ {
+ wxGenericTreeItem *child = (wxGenericTreeItem*)node->Data();
+ long res = child->HitTest( point, flags );
+ if (res != -1) return res;
+ node = node->Next();
+ };
};
};
return -1;
m_isCreated = FALSE;
m_dc = NULL;
m_hilightBrush = new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT), wxSOLID );
+ m_imageList = NULL;
+ m_smallImageList = NULL;
};
wxTreeCtrl::wxTreeCtrl(wxWindow *parent, wxWindowID id,
m_isCreated = FALSE;
m_dc = NULL;
m_hilightBrush = new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT), wxSOLID );
+ m_imageList = NULL;
+ m_smallImageList = NULL;
Create( parent, id, pos, size, style, name );
};
{
CalculatePositions();
+ if (!p->HasChildren()) p->m_hasChildren = TRUE;
+
int ch = 0;
GetClientSize( NULL, &ch );
if (p)
{
CalculatePositions();
+
+ if (!p->HasChildren()) p->m_hasChildren = TRUE;
int ch = 0;
GetClientSize( NULL, &ch );
node = node->Next();
};
+ CalculatePositions();
+
i->SendCollapse( this );
break;
}
return m_anchor->HitTest( point, flags );
};
+wxImageList *wxTreeCtrl::GetImageList( int which ) const
+{
+ if (which == wxIMAGE_LIST_NORMAL) return m_imageList;
+ return m_smallImageList;
+};
+
+void wxTreeCtrl::SetImageList( wxImageList *imageList, int which )
+{
+ if (which == wxIMAGE_LIST_NORMAL)
+ {
+ if (m_imageList) delete m_imageList;
+ m_imageList = imageList;
+ }
+ else
+ {
+ if (m_smallImageList) delete m_smallImageList;
+ m_smallImageList = imageList;
+ };
+};
+
void wxTreeCtrl::AdjustMyScrollbars()
{
if (m_anchor)
{
dc.SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
dc.SetBrush( *m_hilightBrush );
- if (m_hasFocus)
- dc.SetPen( *wxBLACK_PEN );
- else
- dc.SetPen( *wxWHITE_PEN );
long tw, th;
dc.GetTextExtent( item->m_text, &tw, &th );
- dc.DrawRectangle( item->m_x-2, item->m_y-2, tw+4, th+4 );
+ if (m_hasFocus)
+ {
+ dc.SetPen( *wxBLACK_PEN );
+ dc.DrawRectangle( item->m_x-2, item->m_y-2, tw+4, th+4 );
+ }
+ else
+ {
+ dc.SetPen( *wxTRANSPARENT_PEN );
+ dc.DrawRectangle( item->m_x-2, item->m_y-2, tw+4, th+4 );
+ }
dc.DrawText( item->m_text, item->m_x, item->m_y );
dc.SetPen( *wxBLACK_PEN );
}
else
{
- dc.SetPen( *wxWHITE_PEN );
+ dc.SetPen( *wxTRANSPARENT_PEN );
long tw, th;
dc.GetTextExtent( item->m_text, &tw, &th );
dc.DrawRectangle( item->m_x-2, item->m_y-2, tw+4, th+4 );
};
if (item->NumberOfVisibleChildren() == 0) return;
-
+
+ int semiOldY = y;
+
wxNode *node = item->m_children.First();
while (node)
{
wxGenericTreeItem *child = (wxGenericTreeItem *)node->Data();
y += m_lineHeight;
+ semiOldY = y;
+
PaintLevel( child, dc, level+1, y );
node = node->Next();
};
- dc.DrawLine( horizX+15, oldY+5, horizX+15, y );
+ dc.DrawLine( horizX+15, oldY+5, horizX+15, semiOldY );
}
void wxTreeCtrl::OnPaint( const wxPaintEvent &WXUNUSED(event) )
#include "wx/app.h"
#include "wx/gtk/win_gtk.h"
+//-----------------------------------------------------------------------------
+
+extern wxList wxPendingDelete;
+
//-----------------------------------------------------------------------------
// delete
return FALSE;
}
+bool wxDialog::Destroy(void)
+{
+ if (!wxPendingDelete.Member(this))
+ wxPendingDelete.Append(this);
+
+ return TRUE;
+}
+
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
if (GetEventHandler()->OnClose() || event.GetForce())
void wxDialog::EndModal( int retCode )
{
- gtk_main_quit();
SetReturnCode( retCode );
+ gtk_main_quit();
};
void wxDialog::InitDialog(void)
{
m_needParent = FALSE;
- PreCreation( parent, -1, pos, wxDefaultSize, style, "filedialog" );
+ PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" );
m_message = message;
m_path = "";
m_fileName = defaultFileName;
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_SIZE(wxFrame::OnSize)
+ EVT_IDLE(wxFrame::OnIdle)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
return (wxString&)m_title;
};
+void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
+{
+ DoMenuUpdates();
+}
+
+// Query app for menu item updates (called from OnIdle)
+void wxFrame::DoMenuUpdates(void)
+{
+ wxMenuBar* bar = GetMenuBar();
+ if (!bar) return;
+
+ wxNode *node = bar->m_menus.First();
+ while (node)
+ {
+ wxMenu* menu = (wxMenu*)node->Data();
+ DoMenuUpdates(menu);
+
+ node = node->Next();
+ };
+}
+
+void wxFrame::DoMenuUpdates(wxMenu* menu)
+{
+ wxNode* node = menu->m_items.First();
+ while (node)
+ {
+ wxMenuItem* item = (wxMenuItem*) node->Data();
+ if ( !item->IsSeparator() )
+ {
+ wxWindowID id = item->GetId();
+ wxUpdateUIEvent event(id);
+ event.SetEventObject( this );
+
+ if (GetEventHandler()->ProcessEvent(event))
+ {
+ if (event.GetSetText())
+ menu->SetLabel(id, event.GetText());
+ if (event.GetSetChecked())
+ menu->Check(id, event.GetChecked());
+ if (event.GetSetEnabled())
+ menu->Enable(id, event.GetEnabled());
+ }
+
+ if (item->GetSubMenu())
+ DoMenuUpdates(item->GetSubMenu());
+ }
+ node = node->Next();
+ }
+}
+
+
gtk_container_add( GTK_CONTAINER(m_list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
gtk_container_add( GTK_CONTAINER(m_list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
-void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) )
+void wxListBox::Append( const wxString &item, char *clientData )
{
- wxFAIL_MSG("wxListBox::Append(clientdata) not implemented");
+ GtkWidget *list_item;
+ list_item = gtk_list_item_new_with_label( item );
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ gtk_container_add( GTK_CONTAINER(m_list), list_item );
+
+ m_clientData.Append( (wxObject*)clientData );
+
+ gtk_widget_show( list_item );
};
void wxListBox::Clear(void)
{
gtk_list_clear_items( m_list, 0, Number() );
+
+ m_clientData.Clear();
};
void wxListBox::Delete( int n )
{
gtk_list_clear_items( m_list, n, n );
+
+ wxNode *node = m_clientData.Nth( n );
+ if (!node)
+ {
+ wxFAIL_MSG("wxListBox::Delete wrong index");
+ }
+ else
+ m_clientData.DeleteNode( node );
};
void wxListBox::Deselect( int n )
return -1;
};
-char *wxListBox::GetClientData( int WXUNUSED(n) ) const
+char *wxListBox::GetClientData( int n ) const
{
- wxFAIL_MSG("wxListBox::GetClientData not implemented");
-
+ wxNode *node = m_clientData.Nth( n );
+ if (node) return ((char*)node->Data());
return NULL;
};
{
};
-void wxListBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) )
+void wxListBox::SetClientData( int n, char *clientData )
{
+ wxNode *node = m_clientData.Nth( n );
+ if (node) node->SetData( (wxObject*)clientData );
};
void wxListBox::SetFirstItem( int WXUNUSED(n) )
void wxMenu::AppendSeparator(void)
{
wxMenuItem *mitem = new wxMenuItem();
- mitem->m_id = -1;
+ mitem->m_id = ID_SEPARATOR;
mitem->m_text = "";
mitem->m_helpStr = "";
mitem->m_isCheckMenu = FALSE;
return -1;
};
+void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
+{
+ // I'm just too lazy
+};
+
void wxMenu::Enable( int id, bool enable )
{
wxNode *node = m_items.First();
wxTextCtrl::wxTextCtrl(void) : streambuf()
{
+ if( allocate() )
+ setp(base(),ebuf());
+
m_modified = FALSE;
};
const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) : streambuf()
{
+ if( allocate() )
+ setp(base(),ebuf());
+
m_modified = FALSE;
Create( parent, id, value, pos, size, style, name );
};
int wxTextCtrl::overflow(int c)
{
- // Make sure there is a holding area
- if ( allocate()==EOF )
- {
- wxError("Streambuf allocation failed","Internal error");
- return EOF;
- }
-
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- // Reset get area
- setg(0,0,0);
-
- // Make sure there is a put area
- if ( ! pptr() )
- {
-/* This doesn't seem to be fatal so comment out error message */
-// wxError("Put area not opened","Internal error");
- setp( base(), base() );
- }
-
- // Determine how many characters have been inserted but no consumed
- int plen = pptr() - pbase();
-
- // Now Jerry relies on the fact that the buffer is at least 2 chars
- // long, but the holding area "may be as small as 1" ???
- // And we need an additional \0, so let's keep this inefficient but
- // safe copy.
-
- // If c!=EOF, it is a character that must also be comsumed
- int xtra = c==EOF? 0 : 1;
-
- // Write temporary C-string to wxTextWindow
- {
- char *txt = new char[plen+xtra+1];
- memcpy(txt, pbase(), plen);
- txt[plen] = (char)c; // append c
- txt[plen+xtra] = '\0'; // append '\0' or overwrite c
- // If the put area already contained \0, output will be truncated there
- WriteText(txt);
- delete[] txt;
- }
-
- // Reset put area
- setp(pbase(), epptr());
-
-#if defined(__WATCOMC__)
- return __NOT_EOF;
-#elif defined(zapeof) // HP-UX (all cfront based?)
- return zapeof(c);
-#else
- return c!=EOF ? c : 0; // this should make everybody happy
-#endif
-
-/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
setp(pbase(), epptr());
delete[] txt;
return EOF;
-*/
};
int wxTextCtrl::sync(void)
{
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- if ( pptr() && pptr() > pbase() ) return overflow(EOF);
-
- return 0;
-/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
setp(pbase(), epptr());
delete[] txt;
return 0;
-*/
};
int wxTextCtrl::underflow(void)
#include "wx/app.h"
#include "wx/gtk/win_gtk.h"
+//-----------------------------------------------------------------------------
+
+extern wxList wxPendingDelete;
+
//-----------------------------------------------------------------------------
// delete
return FALSE;
}
+bool wxDialog::Destroy(void)
+{
+ if (!wxPendingDelete.Member(this))
+ wxPendingDelete.Append(this);
+
+ return TRUE;
+}
+
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
if (GetEventHandler()->OnClose() || event.GetForce())
void wxDialog::EndModal( int retCode )
{
- gtk_main_quit();
SetReturnCode( retCode );
+ gtk_main_quit();
};
void wxDialog::InitDialog(void)
{
m_needParent = FALSE;
- PreCreation( parent, -1, pos, wxDefaultSize, style, "filedialog" );
+ PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" );
m_message = message;
m_path = "";
m_fileName = defaultFileName;
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_SIZE(wxFrame::OnSize)
+ EVT_IDLE(wxFrame::OnIdle)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
return (wxString&)m_title;
};
+void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event))
+{
+ DoMenuUpdates();
+}
+
+// Query app for menu item updates (called from OnIdle)
+void wxFrame::DoMenuUpdates(void)
+{
+ wxMenuBar* bar = GetMenuBar();
+ if (!bar) return;
+
+ wxNode *node = bar->m_menus.First();
+ while (node)
+ {
+ wxMenu* menu = (wxMenu*)node->Data();
+ DoMenuUpdates(menu);
+
+ node = node->Next();
+ };
+}
+
+void wxFrame::DoMenuUpdates(wxMenu* menu)
+{
+ wxNode* node = menu->m_items.First();
+ while (node)
+ {
+ wxMenuItem* item = (wxMenuItem*) node->Data();
+ if ( !item->IsSeparator() )
+ {
+ wxWindowID id = item->GetId();
+ wxUpdateUIEvent event(id);
+ event.SetEventObject( this );
+
+ if (GetEventHandler()->ProcessEvent(event))
+ {
+ if (event.GetSetText())
+ menu->SetLabel(id, event.GetText());
+ if (event.GetSetChecked())
+ menu->Check(id, event.GetChecked());
+ if (event.GetSetEnabled())
+ menu->Enable(id, event.GetEnabled());
+ }
+
+ if (item->GetSubMenu())
+ DoMenuUpdates(item->GetSubMenu());
+ }
+ node = node->Next();
+ }
+}
+
+
gtk_container_add( GTK_CONTAINER(m_list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
gtk_container_add( GTK_CONTAINER(m_list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
-void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) )
+void wxListBox::Append( const wxString &item, char *clientData )
{
- wxFAIL_MSG("wxListBox::Append(clientdata) not implemented");
+ GtkWidget *list_item;
+ list_item = gtk_list_item_new_with_label( item );
+
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+
+ gtk_container_add( GTK_CONTAINER(m_list), list_item );
+
+ m_clientData.Append( (wxObject*)clientData );
+
+ gtk_widget_show( list_item );
};
void wxListBox::Clear(void)
{
gtk_list_clear_items( m_list, 0, Number() );
+
+ m_clientData.Clear();
};
void wxListBox::Delete( int n )
{
gtk_list_clear_items( m_list, n, n );
+
+ wxNode *node = m_clientData.Nth( n );
+ if (!node)
+ {
+ wxFAIL_MSG("wxListBox::Delete wrong index");
+ }
+ else
+ m_clientData.DeleteNode( node );
};
void wxListBox::Deselect( int n )
return -1;
};
-char *wxListBox::GetClientData( int WXUNUSED(n) ) const
+char *wxListBox::GetClientData( int n ) const
{
- wxFAIL_MSG("wxListBox::GetClientData not implemented");
-
+ wxNode *node = m_clientData.Nth( n );
+ if (node) return ((char*)node->Data());
return NULL;
};
{
};
-void wxListBox::SetClientData( int WXUNUSED(n), char *WXUNUSED(clientData) )
+void wxListBox::SetClientData( int n, char *clientData )
{
+ wxNode *node = m_clientData.Nth( n );
+ if (node) node->SetData( (wxObject*)clientData );
};
void wxListBox::SetFirstItem( int WXUNUSED(n) )
void wxMenu::AppendSeparator(void)
{
wxMenuItem *mitem = new wxMenuItem();
- mitem->m_id = -1;
+ mitem->m_id = ID_SEPARATOR;
mitem->m_text = "";
mitem->m_helpStr = "";
mitem->m_isCheckMenu = FALSE;
return -1;
};
+void wxMenu::Check( int WXUNUSED(id), bool WXUNUSED(Flag) )
+{
+ // I'm just too lazy
+};
+
void wxMenu::Enable( int id, bool enable )
{
wxNode *node = m_items.First();
wxTextCtrl::wxTextCtrl(void) : streambuf()
{
+ if( allocate() )
+ setp(base(),ebuf());
+
m_modified = FALSE;
};
const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) : streambuf()
{
+ if( allocate() )
+ setp(base(),ebuf());
+
m_modified = FALSE;
Create( parent, id, value, pos, size, style, name );
};
int wxTextCtrl::overflow(int c)
{
- // Make sure there is a holding area
- if ( allocate()==EOF )
- {
- wxError("Streambuf allocation failed","Internal error");
- return EOF;
- }
-
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- // Reset get area
- setg(0,0,0);
-
- // Make sure there is a put area
- if ( ! pptr() )
- {
-/* This doesn't seem to be fatal so comment out error message */
-// wxError("Put area not opened","Internal error");
- setp( base(), base() );
- }
-
- // Determine how many characters have been inserted but no consumed
- int plen = pptr() - pbase();
-
- // Now Jerry relies on the fact that the buffer is at least 2 chars
- // long, but the holding area "may be as small as 1" ???
- // And we need an additional \0, so let's keep this inefficient but
- // safe copy.
-
- // If c!=EOF, it is a character that must also be comsumed
- int xtra = c==EOF? 0 : 1;
-
- // Write temporary C-string to wxTextWindow
- {
- char *txt = new char[plen+xtra+1];
- memcpy(txt, pbase(), plen);
- txt[plen] = (char)c; // append c
- txt[plen+xtra] = '\0'; // append '\0' or overwrite c
- // If the put area already contained \0, output will be truncated there
- WriteText(txt);
- delete[] txt;
- }
-
- // Reset put area
- setp(pbase(), epptr());
-
-#if defined(__WATCOMC__)
- return __NOT_EOF;
-#elif defined(zapeof) // HP-UX (all cfront based?)
- return zapeof(c);
-#else
- return c!=EOF ? c : 0; // this should make everybody happy
-#endif
-
-/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
setp(pbase(), epptr());
delete[] txt;
return EOF;
-*/
};
int wxTextCtrl::sync(void)
{
- // Verify that there are no characters in get area
- if ( gptr() && gptr() < egptr() )
- {
- wxError("Who's trespassing my get area?","Internal error");
- return EOF;
- }
-
- if ( pptr() && pptr() > pbase() ) return overflow(EOF);
-
- return 0;
-/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
setp(pbase(), epptr());
delete[] txt;
return 0;
-*/
};
int wxTextCtrl::underflow(void)