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:27:12 +0000
commit166d8257979aac6775319a9e1f305bc94df97e29 (patch)
tree780a7ba43ff9b8ba1f449238d23d2e62b9c8777a /vcl
parent0c870ab35f0648ac5e87adc84ad4c711c4774330 (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 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 7d30f65699a5..0ba51194ce88 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -225,7 +225,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 24da8ef7c23b..bea6412cb6e5 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 )
{