[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - svtools/source

Szymon Kłos eszkadev at gmail.com
Mon Jun 22 00:30:06 PDT 2015


 svtools/source/dialogs/RemoteFilesDialog.cxx |   58 ++++++++++++++++++++++++---
 1 file changed, 52 insertions(+), 6 deletions(-)

New commits:
commit 30a758dbcc1334fbd5670c541a90312a259359f0
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Mon Jun 22 09:28:09 2015 +0200

    RemoteFilesDialog: accessibility, TABSTOP
    
    Change-Id: I72ab457d557fdee04115f4c8f78f6d908fb56254

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 663d719..594f1b1 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -17,9 +17,12 @@ class FileViewContainer : public vcl::Window
     VclPtr<SvTreeListBox> m_pTreeView;
     VclPtr<Splitter> m_pSplitter;
 
+    int m_nCurrentFocus;
+    vcl::Window* m_pFocusWidgets[4];
+
     public:
     FileViewContainer(vcl::Window *pParent)
-        : Window(pParent)
+        : Window(pParent, WB_TABSTOP)
         , m_pFileView(NULL)
         , m_pTreeView(NULL)
         , m_pSplitter(NULL)
@@ -40,11 +43,17 @@ class FileViewContainer : public vcl::Window
 
     void init(SvtFileView* pFileView,
               Splitter* pSplitter,
-              SvTreeListBox* pTreeView)
+              SvTreeListBox* pTreeView,
+              vcl::Window* pPrevSibling,
+              vcl::Window* pNextSibling)
     {
         m_pFileView = pFileView;
         m_pTreeView = pTreeView;
         m_pSplitter = pSplitter;
+        m_pFocusWidgets[0] = pPrevSibling;
+        m_pFocusWidgets[1] = pTreeView;
+        m_pFocusWidgets[2] = pFileView;
+        m_pFocusWidgets[3] = pNextSibling;
     }
 
     virtual void Resize() SAL_OVERRIDE
@@ -73,6 +82,43 @@ class FileViewContainer : public vcl::Window
         placesNewSize.Height() = aSize.Height();
         m_pTreeView->SetSizePixel( placesNewSize );
     }
+
+    void changeFocus(bool bReverse)
+    {
+        if(!bReverse && m_nCurrentFocus <= 4)
+        {
+            m_pFocusWidgets[++m_nCurrentFocus]->SetFakeFocus(true);
+            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
+        }
+        else if(m_nCurrentFocus > 0)
+        {
+            m_pFocusWidgets[--m_nCurrentFocus]->SetFakeFocus(true);
+            m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
+        }
+    }
+
+    virtual void GetFocus() SAL_OVERRIDE
+    {
+        m_nCurrentFocus = 1;
+        m_pFocusWidgets[m_nCurrentFocus]->SetFakeFocus(true);
+        m_pFocusWidgets[m_nCurrentFocus]->GrabFocus();
+    }
+
+    virtual bool Notify(NotifyEvent& rNEvt)
+    {
+        if(rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
+        {
+            const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
+            const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode();
+            bool bShift = rCode.IsShift();
+            if(rCode.GetCode() == KEY_TAB)
+            {
+                changeFocus(bShift);
+                return true;
+            }
+        }
+        return Window::Notify(rNEvt);
+    }
 };
 
 RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
@@ -128,7 +174,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pContainer->set_hexpand(true);
     m_pContainer->set_vexpand(true);
 
-    m_pFileView = VclPtr<SvtFileView>::Create( m_pContainer, WB_BORDER,
+    m_pFileView = VclPtr<SvtFileView>::Create( m_pContainer, WB_BORDER | WB_TABSTOP,
                                        REMOTEDLG_TYPE_PATHDLG == m_eType,
                                        m_bMultiselection );
 
@@ -142,7 +188,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) );
     m_pSplitter->Show();
 
-    m_pTreeView = VclPtr<SvTreeListBox>::Create( m_pContainer, WB_BORDER | WB_SORT );
+    m_pTreeView = VclPtr<SvTreeListBox>::Create( m_pContainer, WB_BORDER | WB_SORT | WB_TABSTOP );
     Size aSize(100, 200);
     m_pTreeView->set_height_request(aSize.Height());
     m_pTreeView->set_width_request(aSize.Width());
@@ -159,11 +205,11 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     nPosX += m_pSplitter->GetSizePixel().Width();
     m_pFileView->SetPosPixel(Point(nPosX, 0));
 
-    m_pContainer->init(m_pFileView, m_pSplitter, m_pTreeView);
+    m_pContainer->init( m_pFileView, m_pSplitter, m_pTreeView, m_pAddService_btn, m_pFilter_lb );
     m_pContainer->Show();
     m_pContainer->Enable( false );
 
-    m_pAddService_btn->SetMenuMode(MENUBUTTON_MENUMODE_TIMED);
+    m_pAddService_btn->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
     m_pAddService_btn->SetClickHdl( LINK( this, RemoteFilesDialog, AddServiceHdl ) );
     m_pAddService_btn->SetSelectHdl( LINK( this, RemoteFilesDialog, EditServiceMenuHdl ) );
 


More information about the Libreoffice-commits mailing list