summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-12 12:49:58 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-12-12 13:29:27 +0000
commit7d34a702136765cab15edb47aecae9181edd2802 (patch)
tree40e16587d704a44c2be6593df52cb1aa11bd111a /vcl
parent4f97f17d8a86546465ebdc0fa39b5c453ad60781 (diff)
Resolves: fdo#57469 allow tab to traverse into custom widgets
The magic WB_TABSTOP bit is the one that allows a widget to be accepted as a candidate for getting focus when pressing tab (cherry picked from commit 166d8257979aac6775319a9e1f305bc94df97e29) Conflicts: svx/source/dialog/fontlb.cxx Change-Id: I7d964bae6b84184ccbc4652d66cf3d2637566405
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/layout.hxx13
-rw-r--r--vcl/source/control/edit.cxx14
-rw-r--r--vcl/source/window/dialog.cxx10
-rw-r--r--vcl/source/window/dlgctrl.cxx2
4 files changed, 37 insertions, 2 deletions
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index b09b112348f0..d9c5e6352a7f 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -547,12 +547,25 @@ bool isVisibleInLayout(const Window *pWindow);
//return true if this window and its stack of containers are all enabled
bool isEnabledInLayout(const Window *pWindow);
+//Get first window of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(WINDOW_FIRSTCHILD);
+//in a flat hierarchy where dialogs only have one layer
+//of children
+Window* firstLogicalChildOfParent(Window *pTopLevel);
+
//Get next window after pChild of a pTopLevel window as
//if any intermediate layout widgets didn't exist
//i.e. acts like pChild = pChild->GetWindow(WINDOW_NEXT);
//in a flat hierarchy where dialogs only have one layer
//of children
Window* nextLogicalChildOfParent(Window *pTopLevel, Window *pChild);
+
+//Get previous window before pChild of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+//i.e. acts like pChild = pChild->GetWindow(WINDOW_PREV);
+//in a flat hierarchy where dialogs only have one layer
+//of children
Window* prevLogicalChildOfParent(Window *pTopLevel, Window *pChild);
inline bool isContainerWindow(const Window &rWindow)
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index a82a465f169a..f0c697e033fd 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -229,7 +229,19 @@ bool Edit::set_property(const rtl::OString &rKey, const rtl::OString &rValue)
SetMaxTextLen(nTextLen == 0 ? EDIT_NOLIMIT : nTextLen);
}
else if (rKey == "editable")
- SetReadOnly(!toBool(rValue));
+ {
+ bool bReadOnly = !toBool(rValue);
+ SetReadOnly(bReadOnly);
+ //disable tab to traverse into readonly editables
+ WinBits nBits = GetStyle();
+ nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
+ if (!bReadOnly)
+ nBits |= WB_TABSTOP;
+ else
+ nBits |= WB_NOTABSTOP;
+ fprintf(stderr, "tabstop is %ld\n", nBits & WB_TABSTOP);
+ SetStyle(nBits);
+ }
else if (rKey == "visibility")
{
WinBits nBits = GetStyle();
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 3ef0f445b446..513dd5005cd3 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -171,6 +171,16 @@ Window * prevLogicalChildOfParent(Window *pTopLevel, Window *pChild)
return pChild;
}
+//Get first window of a pTopLevel window as
+//if any intermediate layout widgets didn't exist
+Window * firstLogicalChildOfParent(Window *pTopLevel)
+{
+ Window *pChild = pTopLevel->GetWindow(WINDOW_FIRSTCHILD);
+ if (pChild && isContainerWindow(*pChild))
+ pChild = nextLogicalChildOfParent(pTopLevel, pChild);
+ return pChild;
+}
+
// -----------------------------------------------------------------------
void ImplWindowAutoMnemonic( Window* pWindow )
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 0ff589bc3407..6c481da574a6 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -78,7 +78,7 @@ static Window* ImplGetSubChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16&
Window* pTabPage = NULL;
Window* pFoundWindow = NULL;
- Window* pWindow = pParent->GetWindow( WINDOW_FIRSTCHILD );
+ Window* pWindow = firstLogicalChildOfParent(pParent);
Window* pNextWindow = pWindow;
while ( pWindow )
{