History log of /haiku/src/kits/interface/TextControl.cpp
Revision Date Author Comments
# d9385a9d 20-Jul-2020 John Scipione <jscipione@gmail.com>

IK: align BTextView text rect/fix alignment

Recalculate line breaks in FrameResized() if word-wrap is on, otherwise
only move the text rect into position. StyledEdit was recalculating line
breaks before on resize (we have to in this mode) and the frame offset
updates for non-wrapping text views are inexpensive. This makes resizing
text view's work like StyledEdit everywhere.

Scroll to cursor when word-wrap setting changes if text view is editable.
If you are viewing a long document changing word-wrap can move the cursor
quite far, so scroll back to it.

Fix _ActualTabWidth() pen location for right and center-aligned text views
so that tabs widths are calculated correctly.

Reset fTextRect horizontal limits to bounds minus insets in
_RecalculateLineBreaks(), then grow fTextRect based on alignment when
wrap is off.

Fixing insets also fixes right and center-aligned BTextViews.
Left-aligned text view's grow right, right-aligned ones grow left,
and center-aligned ones grow out.

Make extra scrolling space for all aligned text views go the other way
from how it did in hrev24130 (and on left-aligned text view's too) so
that half the text is visible when you edit past the end or before the
beginnning of a text view instead of none of it.

Fixes #1651 #12608 #13796 #15189

Do not _RecalculateLineBreaks() if text view bounds are invalid.
In SetText() detect invalid text view bounds and resize the view to the
width and height of the first line. Then recalculate line breaks.
This fixes BAlert text view size issues.

Fixes #16481 (regression from hrev54496.)

Remove useless and heavy computation. There is no point in computing line
breaks for a 10px wide text view and it takes a long time because it needs
a lot of linebreaks. The view eventually gets laid out properly.

Fixes #5582 (which was not locale-related, after all.)

Only apply default insets if text rect is set to bounds. This ensures
that apps that manipulate the text rect can continue to do so without
the default insets interfering while apps that don't can benefit
from the defaults. If you want to set the text rect to bounds and
not use the default insets you must override the default by calling
SetInsets(). This prevent the default insets from being applied once
apps have changed the text rect fixing a bug in Icon-O-Matic where the
text rect insets were being applied incorrectly.

Fixes #16488 (regression from hrev54496.)

Reduce left and right insets inside text views from full label spacing
to half label spacing. Unify padding between BTextControl and BTextView.

Move fLayoutData->UpdateInsets() to private BTextView::_UpdateInsets()
because we need access to BTextView member variables when deciding
whether or not to add the default padding or not.

_UpdateInsets() changes:
* Don't update insets if BTextView::SetInsets() was called.
* Don't add default insets unless fTextRect is set to view Bounds().
* Do not set the right and bottom insets to left and top if negative,
set them to 0 like we do to left and top -- DeskCalc bug otherwise.

Fixes #15688

Other BTextView fixes:
* Replace max_c and min_c with std::max and std::min respectively.
* Remove scrolling from one instance of BTextView::SetText() as it
produced undesired results while editing a scrolled text view.
* Add default insets in _UpdateInsets()
* Fix scrolling when entering and deleting text so that some part of
the text is always visible. Make visible scroll width depend on font
size.
* Allow scrolling to a negative offset in x but not y. This allows you
to scroll the entire contents of right and centered-aligned text views
whose content does not fit in the box.
* Change _Refresh() to take an offset instead of a bool so that you can
scroll to any offset.
* Replace TextLength() with fText->Length() in a couple of places.

TextControl changes:
* Set text rect in BTextControl::DoLayout().
* Remove AlignTextRect() from TextInput.

Fix the following problems in apps:

ScreenSaver: Set text rect in PreviewView::AddPreview().
Tracker: Set "Edit name" text view insets to 2. Tweek text rect position
to be on top of label in icon, mini-icon, and list mode. Add a TODO that
the text rect is a pixel off from the name on some files.
Mail: Remove _AlignTextRect() and FrameResized() from AddressTextControl.
Use default insets on the text view, defaults are fine here.
DeskCalc: Set insets based on font size in ExpressionTextView
SetTextRect() instead of manipulating the text rect.
Remove _CheckTextRect() and related methods from InputTextView.
Icon-O-Matic: Remove _CheckTextRect() and related methods from InputTextView.
WebPositive: Remove _AlignTextRect() and FrameResized() from URLTextView
and call SetInsets().
StyledEdit: Word-wrap and FrameResized() changes ported to BTextView.

Fixes #16476 #16480 #16488 (regressions from hrev54496.)

Change-Id: Ifeca6077f8815ccd86d5a3880f99556298aaf0fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3152
Reviewed-by: John Scipione <jscipione@gmail.com>


# 22758f16 17-Aug-2020 John Scipione <jscipione@gmail.com>

Revert "IK: align BTextView text rect/fix alignment"

This reverts commit a9b301871d06c0ebe42d22b31c685abed5107acd.

hrev54496

Change-Id: Ife3c834ad98d330f04976d9adf3b1553e7aca034
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3153
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# a9b30187 20-Jul-2020 John Scipione <jscipione@gmail.com>

IK: align BTextView text rect/fix alignment

Preserve passed in text rect in fTextRext (unless in layout)
and create an internal version fAlignedTextRect which is used
in place of fTextRect. fAlignedTextRext is aligned to fit the
text rect bounds and grows to fit. fAlignedTextRect always grows
vertically but only grows horizontally if wrap is off.

Left-aligned text view's grow right, right-aligned ones grow left,
and center center aligned ones grow out.

Set fTextRect to bounds in _DoLayout().

Reduce left and right padding inside text views from full label
spacing to half label spacing. Unify padding between BTextControl
and BTextView.

Fixing padding also fixes right and center-aligned BTextViews.

Undo extra scrolling for non-left text views from hrev24130 fixing
a scrolling left and right with mouse bug when it shouldn't.

Replace max_c and min_c with std::max and std::min respectively.

Remove scrolling from one instance of BTextView::SetText as it
produced undesired results while editing a scrolled text view.

Set text rect in BTextControl::DoLayout() and ScreenSaver
PreviewView::AddPreview().

Don't add padding if BTextView::SetInsets() is called. Set insets
to 0 in Tracker "Edit name" setting which prevents default padding
from being added. This is so that when you rename a file in Tracker
the TextView appears on top of the file name text with no padding.

80 char limit fixes.

Fixes #1651 #12608 #13796 #15189 #15688

Change-Id: I8c6106effc612f49aff374f29742471628b5df86
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3054
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 346d1496 05-Nov-2017 Humdinger <humdingerb@gmail.com>

Properly terminate property_info lists

BListView's property_info list lacked termination, resulting in
garbage output at the and of 'hey getsuites'.

Use { 0 } everywhere for sake of consistency.

Thanks to waddlesplash for spotting the bug an providing the easy fix.


# 8b902d94 22-Mar-2016 John Scipione <jscipione@gmail.com>

IK: Use panel text color for select control labels

NOTE: This should have no effect on the colors of these labels unless
you have changed the panel text color and control text colors to be
different. Both are black by default.

In the case of the menu field, spinner, check box, radio button,
slider, and text control labels we want to draw these labels using
the panel text color instead of the control text color because they
are drawn on top of the panel color. (the menu field label color was
changed in a previous commit in this push).

In all cases except the menu field the label color is specified by
temporarily unsetting the B_IS_CONTROL flag while drawing the label.
All use control look to draw the label.

The control text color is meant to be used for text INSIDE the control,
not the label text that accompanies the control -- at least that's the
way I understand it.


# 7a96554c 09-Dec-2015 looncraz <looncraz@looncraz.net>

kits/interface: Convert to using Set*UIColor.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Patches 0003-0017 from looncraz, unmodified.


# 8bc3ecb0 16-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

Added BTextControl::TextLength() method.


# f4664459 18-Dec-2014 John Scipione <jscipione@gmail.com>

Changes to BTextControl for docs.

Also remove the non-ControlLook drawing code.


# 6f9eb8d1 04-Oct-2014 Stephan Aßmus <superstippi@gmx.de>

HaikuDepot: Validate input before creating account

Provide error or info alert when fields are invalid, suggest
providing an email, but allow to ignore the warning.


# 13d147b1 30-Sep-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Introduce "invalid" text controls.

* MarkAsInvalid is used to enable or disable the mark
* The B_INVALID BControlLook flag is used
* invalid BTextControls are drawn with a red border.
* You ar encouraged to let the user know more precisely what's wrong, by
showing an helpful error message next to the control or in a tooltip.


# 60370b9a 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField/BTextControl: Store and reuse Label()


# b11edca4 22-Apr-2014 John Scipione <jscipione@gmail.com>

BTextControl: style fixes


# be436742 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControl subclasses: Override SetIcon()

... and implement Perform() action for potential later use.


# be92485f 29-Jul-2013 Humdinger <humdingerb@gmail.com>

Fixed default vertical alignment of BTextControl.

Courtesy of Rene who broke it a while back and remote
controlled me on IRC to commit the fix...


# 46d6e9d9 29-Jun-2013 Rene Gollent <anevilyak@gmail.com>

Interface Kit: Adjust max size and default alignment...

...on controls where it makes sense:
- BRadioButton and BCheckBox now return their preferred size as their
maximum.
- BRadioButton, BCheckBox and BTextControl now use left alignment by
default, as this is the most common use case for them.


# 09d87d91 04-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

The text control is now more flexible with its layout items.

* Before, you had to have both, the text view layout item, and the label
layout item or else nothing would ever be visible.
* Now you can only create the text view item, and it will still work.
* Also, no matter the order you added the layout items, they would always
put the label on the left, and the control to the right.
* You can place the label and text view layout items anywhere now, although
you should keep in mind that the view spans over their frame unions; IOW
they should always adjacent to each other, but not necessarily horizontally
and left to right.
* No longer uses a fixed label spacing, but utilizes
BControlLook::DefaultLabelSpacing() instead.
* However, the spacing is always added to the right of the label, no matter
how you place it in the layout. Maybe one wants to add a SetLabelTextViewGap()
like method.


# 8adaa6c5 26-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

interface kit: added compatibility symbols for GCC4

* InvalidateLayout method for BBox, BButton, BCheckBox, BMenuField,
BScrollView, BSlider, BStringView, BTextControl.


# 3e2017d2 11-Feb-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Some cleanup in interface kit. From unused code warnings (before I updated buildtools).


# f6c8d242 19-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Use the correct perform invocation for these functions.


# 466f2b8f 18-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add compatibility symbols for removed LayoutChanged() calls.


# 61eb1f1d 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# eee4243d 20-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

De-virtualize BView::InvalidateLayout() and introduce LayoutInvalidated() hook, like BLayout.


# 5b349aa2 08-Oct-2010 Jérôme Duval <korli@users.berlios.de>

BTextControl::SetValue():
* IsFocus() always returns false, use the textview instead.
* Use SelectAll on the textview, when it has the focus (like in MakeFocus()). This fixes bug #6703.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38900 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 50960935 03-Oct-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Remove B_NAVIGABLE flag from main view after setup the child text view that use the flags from the main view. Fix #6431.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c47e35e 27-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

Updated BTextControl and its custom BLayoutItems. Also a bit of style cleanup. Broke up BTextControl::_InitData() method into _InitData() and _InitText() and moved initialization of the BTextView there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37780 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c944d11f 13-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

bonefish+stippi:
All views which cache layout information need to call ResetLayoutInvalidation()
when they have updated the cached information. Otherwise calling
InvalidateLayout() once they are already attached to a layout may not have any
effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36217 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 84b7e122 16-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Both BTextControl and BMenuField layout the inner control at divider
+ frame width. BTextControl was even calculating it like this everywhere,
but then layouted like BMenuField. Now it's consistent and much easier to
align other controls with the text view or menu bar layout item.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c121b41f 06-Apr-2009 Rene Gollent <anevilyak@gmail.com>

Make gcc4 happy.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29985 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2a30a9e9 06-Apr-2009 Rene Gollent <anevilyak@gmail.com>

Implemented BTextControl's string "Value" property. This fixes ticket #3494.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4438cb3b 28-Feb-2009 Rene Gollent <anevilyak@gmail.com>

Prevent BTextControl from eating scripting messages it doesn't handle (though it doesn't currently handle any). Updated TODO note to clarify this. Fixes ticket #3494.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f86ba45 15-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented a new look for the Haiku interface controls. It was
overheard that they looked too ninety-ish.
TODO: The code behind this is work in progress. The basic idea
is to extract all drawing code into a new class BControlLook,
of which there is a global instance be_control_look, instantiated
in InterfaceDefs.cpp. At the moment, all the old drawing code is
still there, and the usage of be_control_look is inside if-bodies
checking the instance against NULL. In another words, by not
instanitating be_control_look, you can revert back to the old look.
BControlLook's job is to provide reusable methods for drawing
certain types of frames, backgrounds and labels, so that application
developers can make controls that re-use the same drawing code
as built-in controls and adopt to changes made there. I have added
the notion of "borders". Each of the frame drawing methods can be
made to draw certain borders only, which is supposed to help when
controls shall visually attach. This feature is not fully explored
at all ATM.
TODO: Update BColumnListView header view and BStringItem text
spacing. Update other apps where it makes sense to use BControlLook.
For the moment, only Tracker and LaunchBox are updated. More...
NOTE: The new look is not very radically different, so that existing
apps do not immediately look too ugly or out of place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c80f8962 04-Feb-2009 Jérôme Duval <korli@users.berlios.de>

Should fix Shift+TAB on text controls, as it was broken since r29028. Noticed by Karsten Heimrich.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73161598 25-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* BTextControl is kept navigable to be handled correctly by BControl::SetEnabled(). MakeFocus() transfers anyway the focus on its textview.
* BControl::SetEnabled() now calls SetFlags(), BTextControl::SetFlags() is then correctly called.
* BControl::SetEnabled() now uses fWantsNav to know if B_NAVIGABLE should be restored


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29028 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39fbf550 15-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

bonefish + zooey:
* Fixed a general problem with respect to overriding of the reserved
virtual function slots: instead of statically invoking the method
that corresponds to the reserved slot on the class that contains the
slot, we now invoke the virtual Perform() method. Perform() then dispatches
the method invocation to the "proper" class, i.e. the highest class in the
hierarchy that actually implements the requested method.
This fixes a crash in apps that use liblayout's MSlider class and
should fix one or other spurious bug with old apps or libraries, too.
* added new header folder 'binary_compatibility' that contains files that
define the method codes and data structures required by Perform()
* looked for and implemented all used reserved virtual slot functions to
invoke Perform() where necessary or to pass on the method call statically
(for slots that were already maintained by Be)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28124 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53aaed9f 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Forgot to delete fLayoutData in destructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1aaf53ec 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

I accidentally removed some backwards compatible behavior. When there is no
label, a TextControl maintains it's current width in ResizeToPreferred() if
it is wide enough. Should fix #2751.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27646 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 349c911e 16-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Implemented a lot of layout related methods and resolved a few TODOs by
doing a lot of these things the same way as BMenuField are already doing.
Perhaps a private helper class could be refactored from these two controls
to avoid duplicating a lot of this code, although there are a few subtle
differences here and there.

These changes make a BTextControl behave properly in the layout management
frame work, in case CreateLabelLayoutItem() and CreateTextViewLayoutItem()
are _not_ used to layout the BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93ba577c 15-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Updated header indentation
* Removed unused fClean member
* Got rid of fSkipSetFlags member by simply calling the BView::SetFlags()
directly where fSkipSetFlags was supposed to prevent the custom
implementation.
* Added some debugging facilities.
* Used the layout friendly constructors of BControl where appropriate.
* Used B_FOLLOW_ALL for the child text input, it should be more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b257bb85 04-Sep-2008 Karsten Heimrich <host.haiku@gmx.de>

* partly revert, we need to keep the initial width
dont overwrite with preferred, it needs to called explicit



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bdc2a52 04-Sep-2008 Karsten Heimrich <host.haiku@gmx.de>

* ResizeToPreferred und GetPreferredSize now behave more closely to R5
this fixes mostly all windows containing TextControls in ArtPaint and
should fix also ticket #2543

ArtPaint was calling the BTextControl ctor with an empty rect, followed
by ResizeToPreferred, which made in the best case the TextInput visible
but it did not take the label into account. Should help more R5 apps.

Some more tests on R5 have shown that even if you pass an extra large
width, a call to ResizeToPreferred will not respect the passed width.
Also the _BTextInput_ seems to grow with the length of the passed label.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27330 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee2a3473 15-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

Minor cleanup again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26423 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 991c062f 24-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the archive version of BTextControl::_InitData() more resistant against
a broken archive - it will now create a new _BTextInput_ child, if it couldn't
find one. This fixes #2086.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25123 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a68292dd 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

fh -> fontHeight


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24105 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b8872c02 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

BTextControl:
* Placed _BTextInput_ into BPrivate namespace.
* Made _BTextInput_::AlignTextRect() smarter, it centers the line vertically,
for the case that the BTextControl has a larger label font. Improved insets
for asthetics.
* Used _BTextInput_::AlignTextRect() consistently in BTextControl, no more
custom calls to SetTextRect(). Account for minimum vertical inset of 2
pixels in GetPreferredSize().
* Consistendly select all text when gaining focus in _BTextInput_.
* Override MouseDown() in case the control did not have focus before, or else
BTextView::MouseDown() will deselct the text again and place the cursor.
(in line with BeOS behavior)
* Removed unused fBool member from _BTextInput_ and other cleanup.

BTextView:
* Reimplemented BTextView::_AutoResize() so that it works well with
BTextControl and autoscrolling when the alignment is not B_ALIGN_LEFT.
I needed two new members for this, fLeftInset and fRightInset which are
the original insets from the fTextRects. It might currently be broken
for renaming things in Tracker, I will have to check. _AutoResize() no
longer messes up the fTextRect insets.
* Fixed stray carrets sometimes being left over, mostly when auto scrolling,
but I observed them in other cases as well.
* Prevent negative scrolling offsets when autoscrolling. Fixes weird scrolling
offsets when navigating to the left.
* Reset scrolling to B_ORIGIN when SetText() is called. Fixes for example
starting to type in the middle of the control in Vision when entering new
text and autoscrolling was triggered before.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1c257a 12-Oct-2007 Karsten Heimrich <host.haiku@gmx.de>

* the divider width was taken from the wrong archive field

- this is my first commit, so i'm really looking forward to work with you guys :)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22523 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c5a8894 01-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

fix more glitches:
* invalidate the correct rect on WindowActivated() in case fDivider is not
correclty maintained
* don't cut off part of the label in Draw() by constraining the clipping in
case the placement of the label is a little different than intented


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22135 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a431f44b 31-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* make the text view layouting more robust, draw the frame around the
text view, ignore the divider for this (application code could layout
the textview itself, and fDivider might not be maintained)
* change Draw() and TextInput::MakeFocus() accordingly

this fixes the weird placement of text controls in Beam


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3a543720 08-Jul-2006 Jérôme Duval <korli@users.berlios.de>

archives with BControl


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 47b3e74e 05-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

reduced the padding for the border, which is only 2 pixels per side, not 4

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 71c3e4ad 05-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Fixed bug 516, worked some more on AutoResize() (which is still not correct, but improves the situation, looks like bug 161 wasn't completely fixed yet)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17342 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11d7eceb 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

fixed some Archive() following stippi's path


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17188 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7a25fcaf 04-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Constrain the clipping region before drawing the label. This fixes bug 232

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 111b4fbc 20-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BTextControl was filling some part of the inner BTextView with the view color, thus hidding the text. This fixes bug 161

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa815db3 15-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Followed Korli's suggestion and used noTint where possible.
BTW other controls should use the B_CONTROL_TEXT_COLOR as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c432fbbb 14-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Now uses B_CONTROL_TEXT_COLOR to draw the label instead of just black.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16404 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aae7000d 12-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

The previous fix also didn't work correctly; we can't use the text color used
in the BTextView as a base.
Instead we're now using the correct UI default colors.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16374 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12aefeb4 12-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

This fixes the text color when disabled; B_DISABLED_LABEL_TINT is darkening the
color, not lightening it, it's supposed to be used with the background color,
not the text color.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16373 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79c35b39 11-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

SetEnabled() didn't set the text view's colors correctly anymore; _UpdateTextViewColors()
asked for IsEnabled() before it was set.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3a3f6c1e 10-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

BTextControl::AttachedToWindow() set wrong colors in case the control was
disabled (unlike SetEnabled()). They are now both using the correctly working
_UpdateTextViewColors() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16333 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ffe72abd 10-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed BTextControl resizing (did not invalidate the border area before).
* Rewrote TextControl.h
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16331 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0efe29e0 08-Dec-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

There is a FillRegion() call after all

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dde10e45 06-Dec-2005 Stephan Aßmus <superstippi@gmx.de>

fixes for various controls to remove or show focus indication when the window active status changes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 455d1c46 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* The text view now has a larger horizontal offset to look better.
* Since the text view doesn't necessarily occupy the whole text area anymore,
we need to clear the area around it manually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14872 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee001e26 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Made it a bit clearer that virtuals do not work in the constructor the way you'd think they do.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14866 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 105644bf 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the text rect of the inner text view is now the same size as its bounds;
that's simplifies resizing and moving a lot (it's now working correctly).
* the inner text view is now only navigable if the text control should have
been navigable.
* default text view inset is now (3, 3) - but this might be adapted by the
total size of the control.
* the height of the control now takes the label into account - it may differ
from the height of the text line.
* instead of computing the size again, the BTextControl constructor now
just uses its GetPreferredSize().
* the label position now depends on the position of the text view.
* the inner text view is now centered vertically inside the BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e6a5805 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13450 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6d8d6cad 15-May-2005 Stephan Aßmus <superstippi@gmx.de>

Work in progress to improve BTextView and BTextControl. I don't know what _BTextInput_::AlignTextRect() was thought to do. Some of the fixes are Haiku specific and we need to make sure that we don't need them later on (flushing drawing commands).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12685 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7a70a2d6 12-May-2005 Stephan Aßmus <superstippi@gmx.de>

This fixes the child text view re-layout, I didn't test on R5, but my changes make sense to me and are much simpler than what was there before. The BTextControl works now on Haiku, with some problems in the redraw code, that I'm pretty sure are related to our app_server.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12648 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28930a12 27-Apr-2005 Stephan Aßmus <superstippi@gmx.de>

small changes and fixes here and there

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 918a22d9 22-Feb-2005 DarkWyrm <darkwyrm@gmail.com>

BTextControl labels use the plain font, not bold :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11458 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 058691d4 18-Oct-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Style changes, updated license header,
now uses the correct constants (B_FONT_FAMILY_AND_STYLE, etc.) instead of the numbers directly... tsk, tsk :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9391 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 72d9a712 19-Feb-2004 haydentech <haydentech@nowhere.fake>

Remove one line of dead code


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6654 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9cb2dbe2 16-Jun-2003 Marc Flerackers <mflerackers@nowhere.fake>

Fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3536 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 40ceba30 03-Jun-2003 haydentech <haydentech@nowhere.fake>

Janitorial work and gcc3-related fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b75be94 14-May-2003 haydentech <haydentech@nowhere.fake>

Default args allowed only in header (not implementation) with gcc 3.X


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a38012 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8bc3ecb0546a65b660662cdd8dd8d5602cd0e4f4 16-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

Added BTextControl::TextLength() method.


# f466445917801c4badeec8827f0eacb0673f6e72 18-Dec-2014 John Scipione <jscipione@gmail.com>

Changes to BTextControl for docs.

Also remove the non-ControlLook drawing code.


# 6f9eb8d1bb1fd9d9a93b3afda0be7578ca322caa 04-Oct-2014 Stephan Aßmus <superstippi@gmx.de>

HaikuDepot: Validate input before creating account

Provide error or info alert when fields are invalid, suggest
providing an email, but allow to ignore the warning.


# 13d147b12ba4c8276daf6ecb858424d358389a16 30-Sep-2014 Adrien Destugues <pulkomandy@pulkomandy.tk>

Introduce "invalid" text controls.

* MarkAsInvalid is used to enable or disable the mark
* The B_INVALID BControlLook flag is used
* invalid BTextControls are drawn with a red border.
* You ar encouraged to let the user know more precisely what's wrong, by
showing an helpful error message next to the control or in a tooltip.


# 60370b9a6c8456c5970455f6bf170a383e56c621 22-Apr-2014 John Scipione <jscipione@gmail.com>

BMenuField/BTextControl: Store and reuse Label()


# b11edca47d067a1afd3cdb8368d0e1e5ca98b2bb 22-Apr-2014 John Scipione <jscipione@gmail.com>

BTextControl: style fixes


# be4367428b6478ae059614d7a9b6f6dc721e5dcb 21-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BControl subclasses: Override SetIcon()

... and implement Perform() action for potential later use.


# be92485f65a70a34be8da9e53b5087d35c91aa66 29-Jul-2013 Humdinger <humdingerb@gmail.com>

Fixed default vertical alignment of BTextControl.

Courtesy of Rene who broke it a while back and remote
controlled me on IRC to commit the fix...


# 46d6e9d9ed21f6752b4f256ed193faa5bc586501 29-Jun-2013 Rene Gollent <anevilyak@gmail.com>

Interface Kit: Adjust max size and default alignment...

...on controls where it makes sense:
- BRadioButton and BCheckBox now return their preferred size as their
maximum.
- BRadioButton, BCheckBox and BTextControl now use left alignment by
default, as this is the most common use case for them.


# 09d87d9151728f731c1d27e8914c5bbd6e72ec5b 04-Nov-2012 Axel Dörfler <axeld@pinc-software.de>

The text control is now more flexible with its layout items.

* Before, you had to have both, the text view layout item, and the label
layout item or else nothing would ever be visible.
* Now you can only create the text view item, and it will still work.
* Also, no matter the order you added the layout items, they would always
put the label on the left, and the control to the right.
* You can place the label and text view layout items anywhere now, although
you should keep in mind that the view spans over their frame unions; IOW
they should always adjacent to each other, but not necessarily horizontally
and left to right.
* No longer uses a fixed label spacing, but utilizes
BControlLook::DefaultLabelSpacing() instead.
* However, the spacing is always added to the right of the label, no matter
how you place it in the layout. Maybe one wants to add a SetLabelTextViewGap()
like method.


# 8adaa6c54487cab1d200592bb2d5aca44ba2039b 26-Feb-2012 Jerome Duval <jerome.duval@gmail.com>

interface kit: added compatibility symbols for GCC4

* InvalidateLayout method for BBox, BButton, BCheckBox, BMenuField,
BScrollView, BSlider, BStringView, BTextControl.


# 3e2017d24e3912c42e583a508caea971a195f666 11-Feb-2012 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Some cleanup in interface kit. From unused code warnings (before I updated buildtools).


# f6c8d242946d814ca47bca8eb49219979f009686 19-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Use the correct perform invocation for these functions.


# 466f2b8f997acaecf0397f9f1c8b36a2b1fc5a4e 18-Dec-2011 Rene Gollent <anevilyak@gmail.com>

Add compatibility symbols for removed LayoutChanged() calls.


# 61eb1f1d19eed26b6138b0701612e8eb31bb1d86 22-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.


# eee4243d35225a35d0964ebebe94490eaca14261 20-Oct-2011 Alex Wilson <yourpalal2@gmail.com>

De-virtualize BView::InvalidateLayout() and introduce LayoutInvalidated() hook, like BLayout.


# 5b349aa267c2c605b1beca665e2fc27454a198fb 08-Oct-2010 Jérôme Duval <korli@users.berlios.de>

BTextControl::SetValue():
* IsFocus() always returns false, use the textview instead.
* Use SelectAll on the textview, when it has the focus (like in MakeFocus()). This fixes bug #6703.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38900 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5096093590aae37e154ddeedc15aca57a14ee01d 03-Oct-2010 Clemens Zeidler <clemens.zeidler@googlemail.com>

Remove B_NAVIGABLE flag from main view after setup the child text view that use the flags from the main view. Fix #6431.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38879 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c47e35e2aec1ddf574c2495db8761678fb4a3f5 27-Jul-2010 Alex Wilson <yourpalal2@gmail.com>

Updated BTextControl and its custom BLayoutItems. Also a bit of style cleanup. Broke up BTextControl::_InitData() method into _InitData() and _InitText() and moved initialization of the BTextView there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37780 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c944d11f7e0a6775ab04ced50dd929e539c7d10f 13-Apr-2010 Stephan Aßmus <superstippi@gmx.de>

bonefish+stippi:
All views which cache layout information need to call ResetLayoutInvalidation()
when they have updated the cached information. Otherwise calling
InvalidateLayout() once they are already attached to a layout may not have any
effect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36217 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 84b7e122328acc208f32698d1f29ed0737e6d4df 16-Apr-2009 Stephan Aßmus <superstippi@gmx.de>

Both BTextControl and BMenuField layout the inner control at divider
+ frame width. BTextControl was even calculating it like this everywhere,
but then layouted like BMenuField. Now it's consistent and much easier to
align other controls with the text view or menu bar layout item.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c121b41fd2153fcc58fca31a4bdff99200013aaf 06-Apr-2009 Rene Gollent <anevilyak@gmail.com>

Make gcc4 happy.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29985 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2a30a9e9f1489b6499b74a2aa1f9cfcb4bb5b6dd 06-Apr-2009 Rene Gollent <anevilyak@gmail.com>

Implemented BTextControl's string "Value" property. This fixes ticket #3494.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29982 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4438cb3b6945a62dde3ac9f0b6dfb7f308e39f4b 28-Feb-2009 Rene Gollent <anevilyak@gmail.com>

Prevent BTextControl from eating scripting messages it doesn't handle (though it doesn't currently handle any). Updated TODO note to clarify this. Fixes ticket #3494.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2f86ba45579bdc9648b232175f87edc62ab71b54 15-Feb-2009 Stephan Aßmus <superstippi@gmx.de>

Implemented a new look for the Haiku interface controls. It was
overheard that they looked too ninety-ish.
TODO: The code behind this is work in progress. The basic idea
is to extract all drawing code into a new class BControlLook,
of which there is a global instance be_control_look, instantiated
in InterfaceDefs.cpp. At the moment, all the old drawing code is
still there, and the usage of be_control_look is inside if-bodies
checking the instance against NULL. In another words, by not
instanitating be_control_look, you can revert back to the old look.
BControlLook's job is to provide reusable methods for drawing
certain types of frames, backgrounds and labels, so that application
developers can make controls that re-use the same drawing code
as built-in controls and adopt to changes made there. I have added
the notion of "borders". Each of the frame drawing methods can be
made to draw certain borders only, which is supposed to help when
controls shall visually attach. This feature is not fully explored
at all ATM.
TODO: Update BColumnListView header view and BStringItem text
spacing. Update other apps where it makes sense to use BControlLook.
For the moment, only Tracker and LaunchBox are updated. More...
NOTE: The new look is not very radically different, so that existing
apps do not immediately look too ugly or out of place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c80f8962e7d11ee8909ae050ed36d77895d2e4df 04-Feb-2009 Jérôme Duval <korli@users.berlios.de>

Should fix Shift+TAB on text controls, as it was broken since r29028. Noticed by Karsten Heimrich.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 73161598d79a62dc009e87db7950a4d43b4599ad 25-Jan-2009 Jérôme Duval <korli@users.berlios.de>

* BTextControl is kept navigable to be handled correctly by BControl::SetEnabled(). MakeFocus() transfers anyway the focus on its textview.
* BControl::SetEnabled() now calls SetFlags(), BTextControl::SetFlags() is then correctly called.
* BControl::SetEnabled() now uses fWantsNav to know if B_NAVIGABLE should be restored


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29028 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39fbf5509b8740d9883b61649027478dc8a3ead8 15-Oct-2008 Oliver Tappe <zooey@hirschkaefer.de>

bonefish + zooey:
* Fixed a general problem with respect to overriding of the reserved
virtual function slots: instead of statically invoking the method
that corresponds to the reserved slot on the class that contains the
slot, we now invoke the virtual Perform() method. Perform() then dispatches
the method invocation to the "proper" class, i.e. the highest class in the
hierarchy that actually implements the requested method.
This fixes a crash in apps that use liblayout's MSlider class and
should fix one or other spurious bug with old apps or libraries, too.
* added new header folder 'binary_compatibility' that contains files that
define the method codes and data structures required by Perform()
* looked for and implemented all used reserved virtual slot functions to
invoke Perform() where necessary or to pass on the method call statically
(for slots that were already maintained by Be)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28124 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 53aaed9f6bf679d9afd5e085eaf6349581c25259 21-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

Forgot to delete fLayoutData in destructor.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27669 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1aaf53ecac2cdc76688cd7e7d08b474efaa64196 20-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

I accidentally removed some backwards compatible behavior. When there is no
label, a TextControl maintains it's current width in ResizeToPreferred() if
it is wide enough. Should fix #2751.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27646 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 349c911ee9194e4f25c31267a6464f5399c71e59 16-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Implemented a lot of layout related methods and resolved a few TODOs by
doing a lot of these things the same way as BMenuField are already doing.
Perhaps a private helper class could be refactored from these two controls
to avoid duplicating a lot of this code, although there are a few subtle
differences here and there.

These changes make a BTextControl behave properly in the layout management
frame work, in case CreateLabelLayoutItem() and CreateTextViewLayoutItem()
are _not_ used to layout the BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 93ba577c3e4d59a6b18a8a6e11a93a22ca4e669d 15-Sep-2008 Stephan Aßmus <superstippi@gmx.de>

* Updated header indentation
* Removed unused fClean member
* Got rid of fSkipSetFlags member by simply calling the BView::SetFlags()
directly where fSkipSetFlags was supposed to prevent the custom
implementation.
* Added some debugging facilities.
* Used the layout friendly constructors of BControl where appropriate.
* Used B_FOLLOW_ALL for the child text input, it should be more correct.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27576 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b257bb85e7afd2075be7c3e9393932228c0ad83a 04-Sep-2008 Karsten Heimrich <host.haiku@gmx.de>

* partly revert, we need to keep the initial width
dont overwrite with preferred, it needs to called explicit



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1bdc2a52032e19f602b65e92e4ee5665fcd6d9f6 04-Sep-2008 Karsten Heimrich <host.haiku@gmx.de>

* ResizeToPreferred und GetPreferredSize now behave more closely to R5
this fixes mostly all windows containing TextControls in ArtPaint and
should fix also ticket #2543

ArtPaint was calling the BTextControl ctor with an empty rect, followed
by ResizeToPreferred, which made in the best case the TextInput visible
but it did not take the label into account. Should help more R5 apps.

Some more tests on R5 have shown that even if you pass an extra large
width, a call to ResizeToPreferred will not respect the passed width.
Also the _BTextInput_ seems to grow with the length of the passed label.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27330 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee2a3473854f3fbe6a823448e87201f6b9162190 15-Jul-2008 Stephan Aßmus <superstippi@gmx.de>

Minor cleanup again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26423 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 991c062ff3d344abc28963281fe2a2f4d0543262 24-Apr-2008 Axel Dörfler <axeld@pinc-software.de>

* Made the archive version of BTextControl::_InitData() more resistant against
a broken archive - it will now create a new _BTextInput_ child, if it couldn't
find one. This fixes #2086.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25123 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a68292dd29321557a0cf01e8087573c197095bea 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

fh -> fontHeight


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24105 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b8872c02c1d02d892037bcdb6cbbb3dfe482b98b 24-Feb-2008 Stephan Aßmus <superstippi@gmx.de>

BTextControl:
* Placed _BTextInput_ into BPrivate namespace.
* Made _BTextInput_::AlignTextRect() smarter, it centers the line vertically,
for the case that the BTextControl has a larger label font. Improved insets
for asthetics.
* Used _BTextInput_::AlignTextRect() consistently in BTextControl, no more
custom calls to SetTextRect(). Account for minimum vertical inset of 2
pixels in GetPreferredSize().
* Consistendly select all text when gaining focus in _BTextInput_.
* Override MouseDown() in case the control did not have focus before, or else
BTextView::MouseDown() will deselct the text again and place the cursor.
(in line with BeOS behavior)
* Removed unused fBool member from _BTextInput_ and other cleanup.

BTextView:
* Reimplemented BTextView::_AutoResize() so that it works well with
BTextControl and autoscrolling when the alignment is not B_ALIGN_LEFT.
I needed two new members for this, fLeftInset and fRightInset which are
the original insets from the fTextRects. It might currently be broken
for renaming things in Tracker, I will have to check. _AutoResize() no
longer messes up the fTextRect insets.
* Fixed stray carrets sometimes being left over, mostly when auto scrolling,
but I observed them in other cases as well.
* Prevent negative scrolling offsets when autoscrolling. Fixes weird scrolling
offsets when navigating to the left.
* Reset scrolling to B_ORIGIN when SetText() is called. Fixes for example
starting to type in the middle of the control in Vision when entering new
text and autoscrolling was triggered before.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1c257adea827a7e5164b6f987c8e8843c1dc94 12-Oct-2007 Karsten Heimrich <host.haiku@gmx.de>

* the divider width was taken from the wrong archive field

- this is my first commit, so i'm really looking forward to work with you guys :)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22523 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2c5a88945e306c7db2408ce2d8832f9e6b27e127 01-Sep-2007 Stephan Aßmus <superstippi@gmx.de>

fix more glitches:
* invalidate the correct rect on WindowActivated() in case fDivider is not
correclty maintained
* don't cut off part of the label in Draw() by constraining the clipping in
case the placement of the label is a little different than intented


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22135 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a431f44be88d3d0f1748a1fe032c1159dab8d11c 31-Aug-2007 Stephan Aßmus <superstippi@gmx.de>

* make the text view layouting more robust, draw the frame around the
text view, ignore the divider for this (application code could layout
the textview itself, and fDivider might not be maintained)
* change Draw() and TextInput::MakeFocus() accordingly

this fixes the weird placement of text controls in Beam


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22134 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9ecf9d1c1d4888d341a6eac72112c72d1ae3a4cb 26-Aug-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

Merge from layout management branch.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18649 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3a543720c49eb65f6c5404d1e804337deb3fbb1e 08-Jul-2006 Jérôme Duval <korli@users.berlios.de>

archives with BControl


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 47b3e74e2dbffda745821f07652574f3eae76508 05-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

reduced the padding for the border, which is only 2 pixels per side, not 4

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17345 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 71c3e4ad7db429fdc7fb881f30d0d4a8a4bcae73 05-May-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Fixed bug 516, worked some more on AutoResize() (which is still not correct, but improves the situation, looks like bug 161 wasn't completely fixed yet)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17342 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 11d7ecebd0255943e4b27c2fe94174c30d00385d 21-Apr-2006 Jérôme Duval <korli@users.berlios.de>

fixed some Archive() following stippi's path


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17188 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7a25fcafdac9f01b3c82c9c5de8bcd267dd2519a 04-Mar-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Constrain the clipping region before drawing the label. This fixes bug 232

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16579 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 111b4fbcaf41227f1d3983799efa8737a5566509 20-Feb-2006 Stefano Ceccherini <stefano.ceccherini@gmail.com>

BTextControl was filling some part of the inner BTextView with the view color, thus hidding the text. This fixes bug 161

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fa815db3385b3a14620e941305869dda79e549c3 15-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Followed Korli's suggestion and used noTint where possible.
BTW other controls should use the B_CONTROL_TEXT_COLOR as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c432fbbbb796cec5100f8738a336e1310f507da8 14-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

Now uses B_CONTROL_TEXT_COLOR to draw the label instead of just black.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16404 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aae7000d63b98f6acdc24715d2c9443501876a30 12-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

The previous fix also didn't work correctly; we can't use the text color used
in the BTextView as a base.
Instead we're now using the correct UI default colors.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16374 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 12aefeb42adc80999081b974d7f440a647f74816 12-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

This fixes the text color when disabled; B_DISABLED_LABEL_TINT is darkening the
color, not lightening it, it's supposed to be used with the background color,
not the text color.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16373 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 79c35b3912e86485f62f560fc74d1bac369b33a4 11-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

SetEnabled() didn't set the text view's colors correctly anymore; _UpdateTextViewColors()
asked for IsEnabled() before it was set.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16355 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3a3f6c1ee938f2e8876c7b17dfddcb7b045ecd45 10-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

BTextControl::AttachedToWindow() set wrong colors in case the control was
disabled (unlike SetEnabled()). They are now both using the correctly working
_UpdateTextViewColors() method.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16333 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ffe72abd853e0ed076735ae2bdf5890f3162d3fd 10-Feb-2006 Axel Dörfler <axeld@pinc-software.de>

* Fixed BTextControl resizing (did not invalidate the border area before).
* Rewrote TextControl.h
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16331 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0efe29e09df560edba2833aeea46f38dd80a37db 08-Dec-2005 Stefano Ceccherini <stefano.ceccherini@gmail.com>

There is a FillRegion() call after all

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15432 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dde10e451942993f3d48b9bccf2b777815efea79 06-Dec-2005 Stephan Aßmus <superstippi@gmx.de>

fixes for various controls to remove or show focus indication when the window active status changes

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 455d1c46a62597b8392b78b2ae61671f6f9ce6d5 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* The text view now has a larger horizontal offset to look better.
* Since the text view doesn't necessarily occupy the whole text area anymore,
we need to clear the area around it manually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14872 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee001e262a13bdd1f2c445a7ca2ee282b52d01bc 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

Made it a bit clearer that virtuals do not work in the constructor the way you'd think they do.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14866 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 105644bf32c7aaca865b4624e413e4b864dd0c21 12-Nov-2005 Axel Dörfler <axeld@pinc-software.de>

* the text rect of the inner text view is now the same size as its bounds;
that's simplifies resizing and moving a lot (it's now working correctly).
* the inner text view is now only navigable if the text control should have
been navigable.
* default text view inset is now (3, 3) - but this might be adapted by the
total size of the control.
* the height of the control now takes the label into account - it may differ
from the height of the text line.
* instead of computing the size again, the BTextControl constructor now
just uses its GetPreferredSize().
* the label position now depends on the position of the text view.
* the inner text view is now centered vertically inside the BTextControl.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2e6a5805ba8db3b072d81257cc44f966def5fd37 05-Jul-2005 Stephan Aßmus <superstippi@gmx.de>

MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13450 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6d8d6cad9da47bc0390985127aadc269e027880e 15-May-2005 Stephan Aßmus <superstippi@gmx.de>

Work in progress to improve BTextView and BTextControl. I don't know what _BTextInput_::AlignTextRect() was thought to do. Some of the fixes are Haiku specific and we need to make sure that we don't need them later on (flushing drawing commands).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12685 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7a70a2d6d697b43058e2277f24c2bf64fbd5eab9 12-May-2005 Stephan Aßmus <superstippi@gmx.de>

This fixes the child text view re-layout, I didn't test on R5, but my changes make sense to me and are much simpler than what was there before. The BTextControl works now on Haiku, with some problems in the redraw code, that I'm pretty sure are related to our app_server.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12648 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28930a1240a314a0d984c70368ec83aa5d329272 27-Apr-2005 Stephan Aßmus <superstippi@gmx.de>

small changes and fixes here and there

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12480 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 918a22d990c0fa29f9fed7602634e21205e6758f 22-Feb-2005 DarkWyrm <darkwyrm@gmail.com>

BTextControl labels use the plain font, not bold :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11458 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 058691d40979c8638e25331cbbce20547fc590fd 18-Oct-2004 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Style changes, updated license header,
now uses the correct constants (B_FONT_FAMILY_AND_STYLE, etc.) instead of the numbers directly... tsk, tsk :)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9391 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 72d9a71283180f69f43d72c16bc59e6c16a757d6 19-Feb-2004 haydentech <haydentech@nowhere.fake>

Remove one line of dead code


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6654 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9cb2dbe29dbcf58bce0bd925316c77faafce43e0 16-Jun-2003 Marc Flerackers <mflerackers@nowhere.fake>

Fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3536 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 40ceba30d6b162a3a59501900e73f236ccac92ab 03-Jun-2003 haydentech <haydentech@nowhere.fake>

Janitorial work and gcc3-related fixes


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3408 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5b75be9487aae202fd2c9488072e3719bb858ac9 14-May-2003 haydentech <haydentech@nowhere.fake>

Default args allowed only in header (not implementation) with gcc 3.X


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3243 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 52a380120846174213ccce9c4aab0dda17c72083 08-Jul-2002 ejakowatz <ejakowatz@nowhere.fake>

It is accomplished ...


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96