process.cpp C 32,B
protocol.cpp C S,B
quantize.cpp C
+radiocmn.cpp C
resource.cpp C
sckaddr.cpp C S,B
sckfile.cpp C S,B
# endif
#endif /* !defined(wxUSE_LISTCTRL) */
+#ifndef wxUSE_MSGDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_MSGDLG must be defined."
+# else
+# define wxUSE_MSGDLG 0
+# endif
+#endif /* !defined(wxUSE_MSGDLG) */
+
#ifndef wxUSE_MDI_ARCHITECTURE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_MDI_ARCHITECTURE must be defined."
# define wxUSE_FILEDLG 1
# endif
# endif
-#endif /* !wxUSE_FILEDLG */
+#endif /* wxUSE_FILEDLG */
#if !wxUSE_FONTDLG
# if defined(wxUSE_FONTMAP)
# endif
#endif /* !wxUSE_IMAGLIST */
+#if !wxUSE_MSGDLG
+# ifdef wxABORT_ON_CONFIG_ERROR
+ /* FIXME: should compile without it, of course, but doesn't */
+# error "wxMessageBox is always needed"
+# else
+# undef wxUSE_MSGDLG
+# define wxUSE_MSGDLG 1
+# endif
+#endif
+
#if wxUSE_RADIOBTN
# if defined(__WXUNIVERSAL__) && !wxUSE_CHECKBOX
# ifdef wxABORT_ON_CONFIG_ERROR
#pragma interface "datetime.h"
#endif
+#if wxUSE_DATETIME
+
#include <time.h>
#include <limits.h> // for INT_MIN
: (wxDateTime::WeekDay)(wd - 1);
}
+#endif // wxUSE_DATETIME
+
#endif // _WX_DATETIME_H
#if !defined( __WXMSW__ ) && !defined( __WXMAC__) && !defined(__WXPM__)
#define wxMessageDialog wxGenericMessageDialog
-
-int wxMessageBox( const wxString& message
- ,const wxString& caption = wxMessageBoxCaptionStr
- ,long style = wxOK|wxCENTRE
- ,wxWindow *parent = (wxWindow *) NULL
- ,int x = -1
- ,int y = -1
- );
-
#endif
#endif
#ifndef _WX_MSGDLG_H_BASE_
#define _WX_MSGDLG_H_BASE_
+#if wxUSE_MSGDLG
+
#if defined(__WXMSW__)
#include "wx/msw/msgdlg.h"
#elif defined(__WXMOTIF__)
#include "wx/generic/msgdlgg.h"
#endif
+// ----------------------------------------------------------------------------
+// wxMessageBox: the simplest way to use wxMessageDialog
+// ----------------------------------------------------------------------------
+
+int WXDLLEXPORT wxMessageBox(const wxString& message,
+ const wxString& caption = wxMessageBoxCaptionStr,
+ long style = wxOK | wxCENTRE,
+ wxWindow *parent = NULL,
+ int x = -1, int y = -1);
+
+#endif // wxUSE_MSGDLG
+
#endif
// _WX_MSGDLG_H_BASE_
};
-int WXDLLEXPORT wxMessageBox(const wxString& message, const wxString& caption = wxMessageBoxCaptionStr,
- long style = wxOK|wxCENTRE,
- wxWindow *parent = NULL, int x = -1, int y = -1);
-
#endif
// _WX_MSGBOXDLG_H_
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
#define wxUSE_INTL 1
-// Set wxUSE_TIMEDATE to 1 to compile the wxDateTime and related classes which
+// Set wxUSE_DATETIME to 1 to compile the wxDateTime and related classes which
// allow to manipulate dates, times and time intervals. wxDateTime replaces the
// old wxTime and wxDate classes which are still provided for backwards
// compatibility (and implemented in terms of wxDateTime).
//
// Requires: wxUSE_LONGLONG
//
+// Default is 1
+//
// Recommended setting: 1
-#define wxUSE_TIMEDATE 1
+#define wxUSE_DATETIME 1
+
+// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not
+// the same as wxDateTime!). These classes are obsolete and shouldn't be used
+// in new code
+//
+// Default is 0
+//
+// Recommended setting: 0 unless you have legacy code which uses these classes
+#define wxUSE_TIMEDATE 0
// Set wxUSE_TIMER to 1 to compile wxTimer class
//
// Recommended setting: 1 (unless it really doesn't work)
#define wxUSE_COMMON_DIALOGS 1
+// wxBusyInfo displays window with message when app is busy. Works in same way
+// as wxBusyCursor
+#define wxUSE_BUSYINFO 1
+
+// Use single/multiple choice dialogs.
+//
+// Default is 1
+//
+// Recommended setting: 1 (used in the library itself)
+#define wxUSE_CHOICEDLG 1
+
+// wxDirDlg class for getting a directory name from user
+#define wxUSE_DIRDLG 1
+
+// TODO: setting to choose the generic or native one
+
// Use file open/save dialogs.
//
// Default is 1
// Recommended setting: 1 (used in the library itself)
#define wxUSE_FONTDLG 1
-// Use single/multiple choice dialogs.
+// Use wxMessageDialog and wxMessageBox.
//
// Default is 1
//
// Recommended setting: 1 (used in the library itself)
-#define wxUSE_CHOICEDLG 1
-
-// text entry dialog and wxGetTextFromUser function
-#define wxUSE_TEXTDLG 1
+#define wxUSE_MSGDLG 1
// progress dialog class for lengthy operations
#define wxUSE_PROGRESSDLG 1
-// wxBusyInfo displays window with message when app is busy. Works in same way
-// as wxBusyCursor
-#define wxUSE_BUSYINFO 1
-
-// wxDirDlg class for getting a directory name from user
-#define wxUSE_DIRDLG 1
-
// support for startup tips (wxShowTip &c)
#define wxUSE_STARTUP_TIPS 1
+// text entry dialog and wxGetTextFromUser function
+#define wxUSE_TEXTDLG 1
+
// ----------------------------------------------------------------------------
// Metafiles support
// ----------------------------------------------------------------------------
// you need to modify setup.h and rebuild everything
// ----------------------------------------------------------------------------
-#if wxUSE_TIMEDATE && !wxUSE_LONGLONG
+#if wxUSE_DATETIME && !wxUSE_LONGLONG
#error wxDateTime requires wxLongLong
#endif
void HandleOnChar(wxKeyEvent& event);
void HandleOnMouseEnter(wxMouseEvent& event);
void HandleOnMouseLeave(wxMouseEvent& event);
+#if wxUSE_MOUSEWHEEL
void HandleOnMouseWheel(wxMouseEvent& event);
+#endif // wxUSE_MOUSEWHEEL
protected:
// get pointer to our scroll rect if we use it or NULL
double m_scaleX;
double m_scaleY;
+
+#if wxUSE_MOUSEWHEEL
+ int m_wheelRotation;
+#endif // wxUSE_MOUSEWHEEL
};
// ----------------------------------------------------------------------------
#endif
#ifndef WX_PRECOMP
- #include <wx/wx.h>
+ #include <wx/app.h>
+ #include <wx/frame.h>
+ #include <wx/menu.h>
#include <wx/log.h>
+ #include <wx/textctrl.h>
#endif
#if !wxUSE_MENUS
WX_USE_THEME(win32);
WX_USE_THEME(gtk);
-
- // not implemented yet
- #define wxMessageBox
#endif // __WXUNIVERSAL__
// ----------------------------------------------------------------------------
void LogMenuEvent(const wxCommandEvent& event);
+protected:
void OnQuit(wxCommandEvent& event);
+ void OnClearLog(wxCommandEvent& event);
+
void OnAbout(wxCommandEvent& event);
void OnDummy(wxCommandEvent& event);
void OnGetLabelMenu(wxCommandEvent& event);
void OnSetLabelMenu(wxCommandEvent& event);
- void OnRightDown(wxMouseEvent& event);
+ void OnRightUp(wxMouseEvent& event);
void OnUpdateCheckMenuItemUI(wxUpdateUIEvent& event);
+ void OnSize(wxSizeEvent& event);
+
private:
wxMenu *CreateDummyMenu(wxString *title);
wxMenuItem *GetLastMenuItem() const;
- wxMenu *m_menu;
+ // the menu previously detached from the menubar (may be NULL)
+ wxMenu *m_menu;
+ // the count of dummy menus already created
size_t m_countDummy;
+ // the control used for logging
+ wxTextCtrl *m_textctrl;
+
+ // the previous log target
+ wxLog *m_logOld;
+
DECLARE_EVENT_TABLE()
};
enum
{
Menu_File_Quit = 100,
+ Menu_File_ClearLog,
Menu_MenuBar_Toggle = 200,
Menu_MenuBar_Append,
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
- EVT_MENU(Menu_File_Quit, MyFrame::OnQuit)
+ EVT_MENU(Menu_File_Quit, MyFrame::OnQuit)
+ EVT_MENU(Menu_File_ClearLog, MyFrame::OnClearLog)
EVT_MENU(Menu_Help_About, MyFrame::OnAbout)
EVT_UPDATE_UI(Menu_Menu_Check, MyFrame::OnUpdateCheckMenuItemUI)
- EVT_RIGHT_DOWN(MyFrame::OnRightDown)
+ EVT_RIGHT_UP(MyFrame::OnRightUp)
+
+ EVT_SIZE(MyFrame::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(MyEvtHandler, wxEvtHandler)
frame->Show(TRUE);
#if wxUSE_STATUSBAR
- frame->SetStatusText("Hello, wxWindows");
+ frame->SetStatusText("Welcome to wxWindows menu sample");
#endif // wxUSE_STATUSBAR
SetTopWindow(frame);
{
m_menu = NULL;
m_countDummy = 0;
+ m_logOld = NULL;
#if wxUSE_STATUSBAR
- CreateStatusBar(2);
+ CreateStatusBar();
#endif // wxUSE_STATUSBAR
// create the menubar
wxMenu *fileMenu = new wxMenu;
- fileMenu->Append(Menu_File_Quit, "E&xit\tAlt-X", "Quit toolbar sample");
- wxMenuItem *itemBitmap = new wxMenuItem(fileMenu, Menu_File_Quit,
- "Quit with &bitmap\tAlt-Q");
- itemBitmap->SetBitmap(wxBitmap(copy_xpm));
- fileMenu->Append(itemBitmap);
+ wxMenuItem *item = new wxMenuItem(fileMenu, Menu_File_ClearLog,
+ "Clear &log\tCtrl-L");
+ item->SetBitmap(copy_xpm);
+ fileMenu->Append(item);
+ fileMenu->AppendSeparator();
+ fileMenu->Append(Menu_File_Quit, "E&xit\tAlt-X", "Quit menu sample");
wxMenu *menubarMenu = new wxMenu;
menubarMenu->Append(Menu_MenuBar_Append, "&Append menu\tCtrl-A",
// intercept all menu events and log them in this custom event handler
PushEventHandler(new MyEvtHandler(this));
+
+ // create the log text window
+ m_textctrl = new wxTextCtrl(this, -1, _T(""),
+ wxDefaultPosition, wxDefaultSize,
+ wxTE_MULTILINE);
+ m_textctrl->SetEditable(FALSE);
+ m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_textctrl));
+
+ wxLogMessage(_T("Brief explanations: the commands or the \"Menu\" menu\n")
+ _T("append/insert/delete items to/from the last menu.\n")
+ _T("The commands from \"Menubar\" menu work with the\n")
+ _T("menubar itself.\n")
+ _T("Right click the band below to test popup menus.\n"));
}
MyFrame::~MyFrame()
// delete the event handler installed in ctor
PopEventHandler(TRUE);
+
+ // restore old logger
+ delete wxLog::SetActiveTarget(m_logOld);
}
wxMenu *MyFrame::CreateDummyMenu(wxString *title)
{
wxMenu *menu = new wxMenu;
- menu->Append(Menu_Dummy_First, "First item\tCtrl-F1");
+ menu->Append(Menu_Dummy_First, "&First item\tCtrl-F1");
menu->AppendSeparator();
- menu->Append(Menu_Dummy_Second, "Second item\tCtrl-F2", "", TRUE);
+ menu->Append(Menu_Dummy_Second, "&Second item\tCtrl-F2", "", TRUE);
if ( title )
{
void MyFrame::LogMenuEvent(const wxCommandEvent& event)
{
int id = event.GetId();
- if (!GetMenuBar()->FindItem(id))
+ if ( !GetMenuBar()->FindItem(id) )
return;
+
wxString msg = wxString::Format("Menu command %d", id);
if ( GetMenuBar()->FindItem(id)->IsCheckable() )
{
event.IsChecked() ? "" : "not ");
}
-#if wxUSE_STATUSBAR
- SetStatusText(msg, 1);
-#endif // wxUSE_STATUSBAR
+ wxLogMessage(msg);
}
// ----------------------------------------------------------------------------
Close(TRUE);
}
+void MyFrame::OnClearLog(wxCommandEvent& WXUNUSED(event))
+{
+ m_textctrl->Clear();
+}
+
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
- (void)wxMessageBox("wxWindows toolbar sample",
+#ifdef __WXUNIVERSAL__
+ // wxMessageBox not implemented yet
+ wxLogMessage("wxWindows menu sample\n© 1999-2001 Vadim Zeitlin");
+#else
+ (void)wxMessageBox("wxWindows menu sample\n© 1999-2001 Vadim Zeitlin",
"About wxWindows menu sample",
wxICON_INFORMATION);
+#endif
}
void MyFrame::OnDeleteMenu(wxCommandEvent& WXUNUSED(event))
}
}
-void MyFrame::OnEnableMenu(wxCommandEvent& WXUNUSED(event))
+void MyFrame::OnEnableMenu(wxCommandEvent& event)
{
wxMenuBar *mbar = GetMenuBar();
size_t count = mbar->GetMenuCount();
- static bool s_enabled = TRUE;
-
- s_enabled = !s_enabled;
- mbar->EnableTop(count - 1, s_enabled);
+ mbar->EnableTop(count - 1, event.IsChecked());
}
void MyFrame::OnGetLabelMenu(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDummy(wxCommandEvent& event)
{
- wxString s;
- s.Printf("Dummy item #%d", event.GetId() - Menu_Dummy_First + 1);
- wxMessageBox(s, "Menu sample", wxICON_INFORMATION);
+ wxLogMessage("Dummy item #%d", event.GetId() - Menu_Dummy_First + 1);
}
void MyFrame::OnAppendMenuItem(wxCommandEvent& WXUNUSED(event))
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
menu->AppendSeparator();
- menu->Append(Menu_Dummy_Third, "Third dummy item\tCtrl-F3",
+ menu->Append(Menu_Dummy_Third, "&Third dummy item\tCtrl-F3",
"Checkable item", TRUE);
}
wxMenu *menu = menubar->GetMenu(menubar->GetMenuCount() - 1);
- menu->Append(Menu_Dummy_Last, "Dummy sub menu",
+ menu->Append(Menu_Dummy_Last, "&Dummy sub menu",
CreateDummyMenu(NULL), "Dummy sub menu help");
}
}
}
-void MyFrame::OnRightDown(wxMouseEvent &event )
+void MyFrame::OnRightUp(wxMouseEvent &event)
{
wxMenu menu("Test popup");
menu.Append(Menu_Help_About, "&About");
- menu.Append(Menu_Popup_Submenu, "Submenu", CreateDummyMenu(NULL));
- menu.Append(Menu_Popup_ToBeDeleted, "To be deleted");
- menu.Append(Menu_Popup_ToBeChecked, "To be checked", "", TRUE);
- menu.Append(Menu_Popup_ToBeGreyed, "To be greyed");
+ menu.Append(Menu_Popup_Submenu, "&Submenu", CreateDummyMenu(NULL));
+ menu.Append(Menu_Popup_ToBeDeleted, "To be &deleted");
+ menu.Append(Menu_Popup_ToBeChecked, "To be &checked", "", TRUE);
+ menu.Append(Menu_Popup_ToBeGreyed, "To be &greyed");
menu.AppendSeparator();
menu.Append(Menu_File_Quit, "E&xit");
menu.Check(Menu_Popup_ToBeChecked, TRUE);
menu.Enable(Menu_Popup_ToBeGreyed, FALSE);
- PopupMenu( &menu, event.GetX(), event.GetY() );
+ PopupMenu(&menu, event.GetX(), event.GetY());
// test for destroying items in popup menus
-#if 0
+#if 0 // doesn't work in wxGTK!
menu.Destroy(Menu_Popup_Submenu);
PopupMenu( &menu, event.GetX(), event.GetY() );
#endif // 0
}
+
+void MyFrame::OnSize(wxSizeEvent& event)
+{
+ // leave a band below for popup menu testing
+ wxSize size = GetClientSize();
+ m_textctrl->SetSize(0, 0, size.x, (3*size.y)/4);
+
+ // this is really ugly but we have to do it as we can't just call
+ // event.Skip() because wxFrameBase would make the text control fill the
+ // entire frame then
+#ifdef __WXUNIVERSAL__
+ PositionMenuBar();
+#endif // __WXUNIVERSAL__
+}
+
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: src/common/radiocmn.cpp
+// Purpose: wxRadioBox methods common to all ports
+// Author: Vadim Zeitlin
+// Modified by:
+// Created: 03.06.01
+// RCS-ID: $Id$
+// Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
+// License: wxWindows license
+///////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+ #pragma implementation "radioboxbase.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#if wxUSE_RADIOBOX
+
+#ifndef WX_PRECOMP
+ #include "wx/radiobox.h"
+#endif //WX_PRECOMP
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+int wxRadioBoxBase::GetNextItem(int item, wxDirection dir, long style) const
+{
+ int count = GetCount(),
+ numCols = GetColumnCount(),
+ numRows = GetRowCount();
+
+ bool horz = (style & wxRA_SPECIFY_COLS) != 0;
+
+ switch ( dir )
+ {
+ case wxUP:
+ if ( horz )
+ {
+ item -= numCols;
+ }
+ else // vertical layout
+ {
+ if ( !item-- )
+ item = count - 1;
+ }
+ break;
+
+ case wxLEFT:
+ if ( horz )
+ {
+ if ( !item-- )
+ item = count - 1;
+ }
+ else // vertical layout
+ {
+ item -= numRows;
+ }
+ break;
+
+ case wxDOWN:
+ if ( horz )
+ {
+ item += numCols;
+ }
+ else // vertical layout
+ {
+ if ( ++item == count )
+ item = 0;
+ }
+ break;
+
+ case wxRIGHT:
+ if ( horz )
+ {
+ if ( ++item == count )
+ item = 0;
+ }
+ else // vertical layout
+ {
+ item += numRows;
+ }
+ break;
+
+ default:
+ wxFAIL_MSG( _T("unexpected wxDirection value") );
+ return -1;
+ }
+
+ // ensure that the item is in range [0..count)
+ if ( item < 0 )
+ {
+ // first map the item to the one in the same column but in the last row
+ item += count;
+
+ // now there are 2 cases: either it is the first item of the last row
+ // in which case we need to wrap again and get to the last item or we
+ // can just go to the previous item
+ if ( item % (horz ? numCols : numRows) )
+ item--;
+ else
+ item = count - 1;
+ }
+ else if ( item >= count )
+ {
+ // same logic as above
+ item -= count;
+
+ // ... except that we need to check if this is not the last item, not
+ // the first one
+ if ( (item + 1) % (horz ? numCols : numRows) )
+ item++;
+ else
+ item = 0;
+ }
+
+ wxASSERT_MSG( item < count && item >= 0,
+ _T("logic error in wxRadioBox::GetNextItem()") );
+
+ return item;
+}
+
+#endif // wxUSE_RADIOBOX
+
// ProcessEvent() above
event.Skip(FALSE);
- switch ( event.GetEventType() )
- {
- case wxEVT_SCROLLWIN_TOP:
- case wxEVT_SCROLLWIN_BOTTOM:
- case wxEVT_SCROLLWIN_LINEUP:
- case wxEVT_SCROLLWIN_LINEDOWN:
- case wxEVT_SCROLLWIN_PAGEUP:
- case wxEVT_SCROLLWIN_PAGEDOWN:
- case wxEVT_SCROLLWIN_THUMBTRACK:
- case wxEVT_SCROLLWIN_THUMBRELEASE:
- m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event);
- return !event.GetSkipped();
+ wxEventType evType = event.GetEventType();
- case wxEVT_PAINT:
- m_scrollHelper->HandleOnPaint((wxPaintEvent &)event);
- return TRUE;
-
- case wxEVT_SIZE:
- m_scrollHelper->HandleOnSize((wxSizeEvent &)event);
- return FALSE;
+ if ( evType == wxEVT_PAINT )
+ {
+ m_scrollHelper->HandleOnPaint((wxPaintEvent &)event);
+ return TRUE;
+ }
- case wxEVT_CHAR:
- m_scrollHelper->HandleOnChar((wxKeyEvent &)event);
+ if ( evType == wxEVT_SCROLLWIN_TOP ||
+ evType == wxEVT_SCROLLWIN_BOTTOM ||
+ evType == wxEVT_SCROLLWIN_LINEUP ||
+ evType == wxEVT_SCROLLWIN_LINEDOWN ||
+ evType == wxEVT_SCROLLWIN_PAGEUP ||
+ evType == wxEVT_SCROLLWIN_PAGEDOWN ||
+ evType == wxEVT_SCROLLWIN_THUMBTRACK ||
+ evType == wxEVT_SCROLLWIN_THUMBRELEASE )
+ {
+ m_scrollHelper->HandleOnScroll((wxScrollWinEvent &)event);
return !event.GetSkipped();
+ }
- case wxEVT_ENTER_WINDOW:
- m_scrollHelper->HandleOnMouseEnter((wxMouseEvent &)event);
- break;
-
- case wxEVT_LEAVE_WINDOW:
- m_scrollHelper->HandleOnMouseLeave((wxMouseEvent &)event);
- break;
-
- case wxEVT_MOUSEWHEEL:
- m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event);
- break;
+ if ( evType == wxEVT_ENTER_WINDOW )
+ {
+ m_scrollHelper->HandleOnMouseEnter((wxMouseEvent &)event);
+ }
+ else if ( evType == wxEVT_LEAVE_WINDOW )
+ {
+ m_scrollHelper->HandleOnMouseLeave((wxMouseEvent &)event);
+ }
+#if wxUSE_MOUSEWHEEL
+ else if ( evType == wxEVT_MOUSEWHEEL )
+ {
+ m_scrollHelper->HandleOnMouseWheel((wxMouseEvent &)event);
+ }
+#endif // wxUSE_MOUSEWHEEL
+ else if ( evType == wxEVT_SIZE )
+ {
+ m_scrollHelper->HandleOnSize((wxSizeEvent &)event);
+ }
+ else if ( evType == wxEVT_CHAR )
+ {
+ m_scrollHelper->HandleOnChar((wxKeyEvent &)event);
+ return !event.GetSkipped();
}
return FALSE;
}
}
+#if wxUSE_MOUSEWHEEL
+
void wxScrollHelper::HandleOnMouseWheel(wxMouseEvent& event)
{
m_wheelRotation += event.GetWheelRotation();
}
}
+#endif // wxUSE_MOUSEWHEEL
+
// ----------------------------------------------------------------------------
// wxGenericScrolledWindow implementation
// ----------------------------------------------------------------------------
c = c->GetParent();
}
- ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty);
+ ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
c = c->GetParent();
}
- ((wxScrolledWindow*)(m_Wnd->GetParent()))->ViewStart(&stx, &sty);
+ ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
wxHtmlCell::DrawInvisible(dc, x, y);
nodeG = (m_GlobalProcessors) ? m_GlobalProcessors->GetFirst() : NULL;
// VS: there are two lists, global and local, both of them sorted by
- // priority. Since we have to go through _both_ lists with
+ // priority. Since we have to go through _both_ lists with
// decreasing priority, we "merge-sort" the lists on-line by
// processing that one of the two heads that has higher priority
// in every iteration
wxYield(); Refresh(FALSE);
m_tmpCanDrawLocks++;
- if (m_HistoryOn && (m_HistoryPos != -1))
+ if (m_HistoryOn && (m_HistoryPos != -1))
{
// store scroll position into history item:
int x, y;
- ViewStart(&x, &y);
+ GetViewStart(&x, &y);
(*m_History)[m_HistoryPos].SetPos(y);
}
- if (location[0] == wxT('#'))
+ if (location[0] == wxT('#'))
{
// local anchor:
wxString anch = location.Mid(1) /*1 to end*/;
}
else if (location.Find(wxT('#')) != wxNOT_FOUND &&
(m_FS->GetPath() + location.BeforeFirst(wxT('#'))) == m_OpenedPage)
- {
+ {
wxString anch = location.AfterFirst(wxT('#'));
m_tmpCanDrawLocks--;
rt_val = ScrollToAnchor(anch);
needs_refresh = TRUE;
// load&display it:
if (m_RelatedStatusBar != -1)
- {
+ {
m_RelatedFrame->SetStatusText(_("Connecting..."), m_RelatedStatusBar);
Refresh(FALSE);
}
f = m_FS->OpenFile(location);
if (f == NULL)
- {
- wxString err;
-
+ {
wxLogError(_("Unable to open requested HTML document: %s"), location.c_str());
m_tmpCanDrawLocks--;
}
else
- {
+ {
wxNode *node;
wxString src = wxEmptyString;
if (m_RelatedStatusBar != -1)
- {
+ {
wxString msg = _("Loading : ") + location;
m_RelatedFrame->SetStatusText(msg, m_RelatedStatusBar);
Refresh(FALSE);
node = m_Filters.GetFirst();
while (node)
- {
+ {
wxHtmlFilter *h = (wxHtmlFilter*) node->GetData();
if (h->CanRead(*f))
- {
+ {
src = h->ReadFile(*f);
break;
}
node = node->GetNext();
}
if (src == wxEmptyString)
- {
+ {
if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter();
src = m_DefaultFilter->ReadFile(*f);
}
rt_val = SetPage(src);
m_OpenedPage = f->GetLocation();
if (f->GetAnchor() != wxEmptyString)
- {
+ {
wxYield();
ScrollToAnchor(f->GetAnchor());
}
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell->Layout(ClientWidth);
if (ClientHeight < m_Cell->GetHeight() + GetCharHeight())
- {
+ {
SetScrollbars(
wxHTML_SCROLL_STEP, wxHTML_SCROLL_STEP,
m_Cell->GetWidth() / wxHTML_SCROLL_STEP,
/*cheat: top-level frag is always container*/);
}
else /* we fit into window, no need for scrollbars */
- {
+ {
SetScrollbars(wxHTML_SCROLL_STEP, 1, m_Cell->GetWidth() / wxHTML_SCROLL_STEP, 0); // disable...
GetClientSize(&ClientWidth, &ClientHeight);
m_Cell->Layout(ClientWidth); // ...and relayout
// store scroll position into history item:
int x, y;
- ViewStart(&x, &y);
+ GetViewStart(&x, &y);
(*m_History)[m_HistoryPos].SetPos(y);
// go to previous position:
m_GlobalProcessors->DeleteContents(TRUE);
}
wxHtmlProcessorList::Node *node;
-
+
for (node = m_GlobalProcessors->GetFirst(); node; node = node->GetNext())
{
if (processor->GetPriority() > node->GetData()->GetPriority())
#endif
#endif
dc.SetBackgroundMode(wxTRANSPARENT);
- ViewStart(&x, &y);
+ GetViewStart(&x, &y);
while (upd)
{
wxPoint pos;
wxString lnk;
- ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
+ GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
pos = event.GetPosition();
if (m_Cell)
int x, y;
wxHtmlLinkInfo *lnk;
- ViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
+ GetViewStart(&sx, &sy); sx *= wxHTML_SCROLL_STEP; sy *= wxHTML_SCROLL_STEP;
wxGetMousePosition(&x, &y);
ScreenToClient(&x, &y);
lnk = m_Cell->GetLink(sx + x, sy + y);
if (lnk != m_tmpLastLink)
- {
+ {
if (lnk == NULL)
- {
+ {
SetCursor(*s_cur_arrow);
if (m_RelatedStatusBar != -1) m_RelatedFrame->SetStatusText(wxEmptyString, m_RelatedStatusBar);
}
else
- {
+ {
SetCursor(*s_cur_hand);
if (m_RelatedStatusBar != -1)
m_RelatedFrame->SetStatusText(lnk->GetHref(), m_RelatedStatusBar);
return M_FONTDATA->m_encoding;
}
-// ----------------------------------------------------------------------------
-// wxNativeFontInfo
-// ----------------------------------------------------------------------------
-
-bool wxNativeFontInfo::FromString(const wxString& s)
-{
- long l;
-
- wxStringTokenizer tokenizer(s, _T(";"));
-
- wxString token = tokenizer.GetNextToken();
- //
- // Ignore the version for now
- //
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfHeight = l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfWidth = l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfEscapement = l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfOrientation = l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfWeight = l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfItalic = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfUnderline = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfStrikeOut = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfCharSet = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfOutPrecision = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfClipPrecision = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfQuality = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if ( !token.ToLong(&l) )
- return FALSE;
- lf.lfPitchAndFamily = (BYTE)l;
-
- token = tokenizer.GetNextToken();
- if(!token)
- return FALSE;
- wxStrcpy(lf.lfFaceName, token.c_str());
-
- return TRUE;
-}
-
-wxString wxNativeFontInfo::ToString() const
+wxNativeFontInfo *wxFont::GetNativeFontInfo() const
{
- wxString s;
+ if( M_FONTDATA->m_nativeFontInfoOk )
+ return new wxNativeFontInfo(M_FONTDATA->m_nativeFontInfo);
- s.Printf(_T("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%s"),
- 0, // version, in case we want to change the format later
- lf.lfHeight,
- lf.lfWidth,
- lf.lfEscapement,
- lf.lfOrientation,
- lf.lfWeight,
- lf.lfItalic,
- lf.lfUnderline,
- lf.lfStrikeOut,
- lf.lfCharSet,
- lf.lfOutPrecision,
- lf.lfClipPrecision,
- lf.lfQuality,
- lf.lfPitchAndFamily,
- lf.lfFaceName);
-
- return s;
+ return 0;
}
}
else
{
- lvItem.pszText = info.m_text;
+ // pszText is not const, hence the cast
+ lvItem.pszText = (wxChar *)info.m_text.c_str();
if ( lvItem.pszText )
lvItem.cchTextMax = info.m_text.Length();
else
// dtor
wxNotebook::~wxNotebook()
{
- if (m_bOwnsImageList) delete m_pImageList;
+ if (m_bOwnsImageList)
+ delete m_imageList;
}
// ----------------------------------------------------------------------------
static int rgMonthDays[13] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
+#if wxUSE_TIMEDATE
static BOOL OleDateFromTm(WORD wYear, WORD wMonth, WORD wDay,
WORD wHour, WORD wMinute, WORD wSecond, DATE& dtDest);
static BOOL TmFromOleDate(DATE dtSrc, struct tm& tmDest);
+#endif // wxUSE_TIMEDATE
static void ClearVariant(VARIANTARG *pvarg) ;
static void ReleaseVariant(VARIANTARG *pvarg) ;
bool processed = TRUE;
- bool horz = (radiobox->GetWindowStyle() & wxRA_SPECIFY_COLS) != 0;
- int num = radiobox->Number(),
- rows = radiobox->GetNumVer(),
- cols = radiobox->GetNumHor();
-
- int selOld = radiobox->GetSelection();
- int selNew = selOld;
-
+ wxDirection dir;
switch ( wParam )
{
case VK_UP:
radiobox->GetWindowStyle()
);
- int dim = horz ? cols : rows;
- if ( selNew % dim == 0 )
- {
- selNew -= dim - 1;
- }
- else
- {
- selNew++;
- }
- }
-
if ( selNew != selOld )
{
radiobox->SetSelection(selNew);
#ifdef __WIN32__
case WM_HELP:
- {
- wxRadioBox *radiobox = (wxRadioBox *)
- ::GetWindowLong(hwnd, GWL_USERDATA);
+ {
+ wxRadioBox *radiobox = (wxRadioBox *)
+ ::GetWindowLong(hwnd, GWL_USERDATA);
- wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
+ wxCHECK_MSG( radiobox, 0, wxT("radio button without radio box?") );
- bool processed = TRUE;
+ bool processed = TRUE;
- HELPINFO* info = (HELPINFO*) lParam;
- // Don't yet process menu help events, just windows
- if (info->iContextType == HELPINFO_WINDOW)
- {
- wxWindow* subjectOfHelp = radiobox;
- bool eventProcessed = FALSE;
- while (subjectOfHelp && !eventProcessed)
+ HELPINFO* info = (HELPINFO*) lParam;
+ // Don't yet process menu help events, just windows
+ if (info->iContextType == HELPINFO_WINDOW)
{
- wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), wxPoint(info->MousePos.x, info->MousePos.y) ) ; // info->iCtrlId);
- helpEvent.SetEventObject(radiobox);
- eventProcessed = radiobox->GetEventHandler()->ProcessEvent(helpEvent);
+ wxWindow* subjectOfHelp = radiobox;
+ bool eventProcessed = FALSE;
+ while (subjectOfHelp && !eventProcessed)
+ {
+ wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), wxPoint(info->MousePos.x, info->MousePos.y) ) ; // info->iCtrlId);
+ helpEvent.SetEventObject(radiobox);
+ eventProcessed = radiobox->GetEventHandler()->ProcessEvent(helpEvent);
- // Go up the window hierarchy until the event is handled (or not)
- subjectOfHelp = subjectOfHelp->GetParent();
+ // Go up the window hierarchy until the event is handled (or not)
+ subjectOfHelp = subjectOfHelp->GetParent();
+ }
+ processed = eventProcessed;
}
- processed = eventProcessed;
- }
- else if (info->iContextType == HELPINFO_MENUITEM)
- {
- wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ;
- helpEvent.SetEventObject(radiobox);
- processed = radiobox->GetEventHandler()->ProcessEvent(helpEvent);
- }
- else processed = FALSE;
+ else if (info->iContextType == HELPINFO_MENUITEM)
+ {
+ wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ;
+ helpEvent.SetEventObject(radiobox);
+ processed = radiobox->GetEventHandler()->ProcessEvent(helpEvent);
+ }
+ else processed = FALSE;
- if (processed)
- return 0;
+ if (processed)
+ return 0;
- break;
- }
-#endif
+ break;
+ }
+#endif // __WIN32__
}
return ::CallWindowProc(CASTWNDPROC s_wndprocRadioBtn, hwnd, message, wParam, lParam);
// event tables
// ---------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-
// in wxUniv/MSW this class is abstract because it doesn't have DoPopupMenu()
// method
#ifdef __WXUNIVERSAL__