]> git.saurik.com Git - wxWidgets.git/commitdiff
1. panels pass focus to the next item in parent panel
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Jul 1999 23:22:30 +0000 (23:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 20 Jul 1999 23:22:30 +0000 (23:22 +0000)
2. warnings removed from iniconf.cpp and it's removed for Win32 compilation
3. wxWindow::PopupMenu(wxPoint) added, documented
4. Docs for wxTextCtrl explicitly mention that EVT_TEXT is triggered by
   programmatic updates too

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
distrib/msw/tmake/filelist.txt
docs/latex/wx/text.tex
docs/latex/wx/window.tex
include/wx/generic/listctrl.h
include/wx/gtk/window.h
include/wx/gtk1/window.h
include/wx/msw/window.h
include/wx/window.h
src/generic/panelg.cpp
src/gtk/window.cpp
src/gtk1/window.cpp
src/msw/iniconf.cpp
src/msw/window.cpp

index 5a94040c22824a93b86983af8ff72c2c93c7802a..5cab7e9814e9eb66d15a637f52f7a1f5e54d5dc2 100644 (file)
@@ -173,7 +173,7 @@ gdiobj.cpp  M
 helpwin.cpp    M
 icon.cpp       M
 imaglist.cpp   M       32
-iniconf.cpp    M
+iniconf.cpp    M       16
 joystick.cpp   M
 listbox.cpp    M
 listctrl.cpp   M       32
index deb52984b49d2db8b8f84375859f163b91b5ed85..d2e831e45988d584b901d1c7f4c1dbf2e363d317 100644 (file)
@@ -66,7 +66,9 @@ functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument.
 \twocolwidtha{7cm}%
 \begin{twocollist}\itemsep=0pt
 \twocolitem{{\bf EVT\_TEXT(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_UPDATED event,
-generated when the text changes.}
+generated when the text changes. Notice that this event will always be sent
+when the text controls contents changes - whether this is due to user input or
+comes from the program itself (for example, if SetValue() is called)}
 \twocolitem{{\bf EVT\_TEXT\_ENTER(id, func)}}{Respond to a wxEVT\_COMMAND\_TEXT\_ENTER event,
 generated when enter is pressed in a single-line text control.}
 \end{twocollist}%
index 46b27b976ba0a12dcccd01fe4b37169f5a22fa8e..fa0c7ec57ac68b6c3fef1caa43c9a62c8610bcaa 100644 (file)
@@ -1492,18 +1492,21 @@ default value is FALSE.}
 
 \membersection{wxWindow::PopupMenu}\label{wxwindowpopupmenu}
 
-\func{virtual bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
+\func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{const wxPoint& }{pos}}
+
+\func{bool}{PopupMenu}{\param{wxMenu* }{menu}, \param{int }{x}, \param{int }{y}}
 
 Pops up the given menu at the specified coordinates, relative to this
 window, and returns control when the user has dismissed the menu. If a
-menu item is selected, the callback defined for the menu is called with
-wxMenu and wxCommandEvent reference arguments. The callback should access
-the commandInt member of the event to check the selected menu identifier.
+menu item is selected, the corresponding menu event is generated and will be
+processed as usually.
 
 \wxheading{Parameters}
 
 \docparam{menu}{Menu to pop up.}
 
+\docparam{pos}{The position where the menu will appear.}
+
 \docparam{x}{Required x position for the menu to appear.}
 
 \docparam{y}{Required y position for the menu to appear.}
index 70afe451358c05cb3ce161e6ce269ff2347b6a0f..de85888917f97c0a596af5baf3f9a50546223fe2 100644 (file)
@@ -629,7 +629,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
       { return m_mainWin ? m_mainWin->GetBackgroundColour() : wxColour(); }
     wxColour GetForegroundColour() const
       { return m_mainWin ? m_mainWin->GetForegroundColour() : wxColour(); }
-    bool PopupMenu( wxMenu *menu, int x, int y )
+    bool DoPopupMenu( wxMenu *menu, int x, int y )
       { return m_mainWin->PopupMenu( menu, x, y ); }
     void SetFocus()
       { m_mainWin->SetFocus(); }
index aa722a2f14822dd19052cf8b08b1c53219487def..bf99cd47e7afbef423efba70baaa5d97ba39a91e 100644 (file)
@@ -86,7 +86,7 @@ public:
                                const wxFont *theFont = (const wxFont *) NULL)
                                const;
 
-    virtual bool PopupMenu( wxMenu *menu, int x, int y );
+    virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
 
     virtual void SetScrollbar( int orient, int pos, int thumbVisible,
                                int range, bool refresh = TRUE );
index aa722a2f14822dd19052cf8b08b1c53219487def..bf99cd47e7afbef423efba70baaa5d97ba39a91e 100644 (file)
@@ -86,7 +86,7 @@ public:
                                const wxFont *theFont = (const wxFont *) NULL)
                                const;
 
-    virtual bool PopupMenu( wxMenu *menu, int x, int y );
+    virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
 
     virtual void SetScrollbar( int orient, int pos, int thumbVisible,
                                int range, bool refresh = TRUE );
index 33f358e879b411ce583da7566b24e2f6af30cd29..dbd49770ede8c5f52577ad63712c41ab5aa59103 100644 (file)
@@ -110,7 +110,7 @@ public:
                                const wxFont *theFont = (const wxFont *) NULL)
                                const;
 
-    virtual bool PopupMenu( wxMenu *menu, int x, int y );
+    virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
 
     virtual void SetScrollbar( int orient, int pos, int thumbVisible,
                                int range, bool refresh = TRUE );
index 6edbb625246468e17a1c22a0d82ab5171b5c7ed2..34049b6af0c99b0de53f07c28aa26553203c5b54 100644 (file)
@@ -531,7 +531,10 @@ public:
 
     void UpdateWindowUI();
 
-    virtual bool PopupMenu( wxMenu *menu, int x, int y ) = 0;
+    bool PopupMenu( wxMenu *menu, const wxPoint& pos )
+        { return DoPopupMenu(menu, pos.x, pos.y); }
+    bool PopupMenu( wxMenu *menu, int x, int y )
+        { return DoPopupMenu(menu, x, y); }
 
     // scrollbars
     // ----------
@@ -772,6 +775,8 @@ protected:
     virtual void DoSetToolTip( wxToolTip *tip );
 #endif // wxUSE_TOOLTIPS
 
+    virtual bool DoPopupMenu( wxMenu *menu, int x, int y ) = 0;
+
 private:
     // contains the last id generated by NewControlId
     static int ms_lastControlId;
index 9f719780e4636cc0c54e4fea9e7c25a38a7a38a8..a37cabb6ede74645facadeca1502d62a88e04d26 100644 (file)
@@ -109,16 +109,34 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
     }
 
     wxWindowList::Node *start_node = GetChildren().Find( winFocus );
-    if (!start_node)
+    if ( !start_node )
+        start_node = GetChildren().Find( m_winLastFocused );
+    if ( !start_node )
         start_node = GetChildren().GetFirst();
 
     wxWindowList::Node *node = event.GetDirection() ? start_node->GetNext()
                                                     : start_node->GetPrevious();
 
-    while (node != start_node)
+    while ( node != start_node )
     {
-        if (!node)
+        if ( !node )
         {
+            // check if our (may be grand) parent is another panel: if this is
+            // the case, they will know what to do with this navigation key and
+            // 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)
+            for ( wxWindow *p = GetParent(); p; p = p->GetParent() )
+            {
+                if ( wxDynamicCast(p, wxPanel) )
+                {
+                    event.Skip();
+
+                    return;
+                }
+            }
+
+            // no, we are not inside another panel so process this ourself
             node = event.GetDirection() ? GetChildren().GetFirst()
                                         : GetChildren().GetLast();
 
@@ -127,7 +145,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
 
         wxWindow *child = node->GetData();
 
-        if (child->AcceptsFocus())
+        if ( child->AcceptsFocus() )
         {
             // ok, event processed
             child->SetFocus();
index c61a2a2c67899f873a889e16ec1e773ecd8ce791..24823403c34155d10c41c8667455cc6fe2067328 100644 (file)
@@ -2869,7 +2869,7 @@ static void pop_pos_callback( GtkMenu * WXUNUSED(menu),
     *y = gs_pop_y;
 }
 
-bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
+bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
 {
     wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
 
index c61a2a2c67899f873a889e16ec1e773ecd8ce791..24823403c34155d10c41c8667455cc6fe2067328 100644 (file)
@@ -2869,7 +2869,7 @@ static void pop_pos_callback( GtkMenu * WXUNUSED(menu),
     *y = gs_pop_y;
 }
 
-bool wxWindow::PopupMenu( wxMenu *menu, int x, int y )
+bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y )
 {
     wxCHECK_MSG( m_widget != NULL, FALSE, _T("invalid window") );
 
index 22199a3f397df2d9307f58f54ea2c72de1bef4de..1adae8ce223774cd223ff05bc9c1dcbc821c9f3a 100644 (file)
@@ -442,9 +442,13 @@ bool wxIniConfig::DeleteAll()
   char szBuf[MAX_PATH];
   size_t nRc = GetWindowsDirectory(szBuf, WXSIZEOF(szBuf));
   if ( nRc == 0 )
+  {
     wxLogLastError("GetWindowsDirectory");
+  }
   else if ( nRc > WXSIZEOF(szBuf) )
+  {
     wxFAIL_MSG("buffer is too small for Windows directory.");
+  }
 
   wxString strFile = szBuf;
   strFile << '\\' << m_strLocalFilename;
index 5f6bf803cf205592eb1ef19ad8921c1c579a57aa..8d185d64205bef6d592f33a9b3112e22c0daccc0 100644 (file)
@@ -1422,7 +1422,7 @@ void wxWindow::GetCaretPos(int *x, int *y) const
 // popup menu
 // ---------------------------------------------------------------------------
 
-bool wxWindow::PopupMenu(wxMenu *menu, int x, int y)
+bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 {
     menu->SetInvokingWindow(this);
     menu->UpdateUI();