Commit Graph

651 Commits

Author SHA1 Message Date
John Scipione
e439b00397 Fix button label position, try number 2
Create and use BLayoutUtils::AlignOnRect() to position the button label
in BControlLook::DrawLabel().

AlignOnRect(), unlike AlignInFrame(), provides the possibility to return
a rectangle with dimensions greater than the available size.

Add some comments above the methods in LayoutUtils that indicate such.

Also update copyright headers in LayoutUtils and ControlLook
2014-04-08 14:10:10 -04:00
Adrien Destugues
eb43166326 app_server & interface kit: support fill rules.
* BView gets SetFillRule/FillRule methods. The fill rule is part of the
view state.
* The B_NONZERO rule is the default. This is what we implemented before.
* The B_EVEN_ODD rule is the other common possibility for this, and
we need to support it to help WebKit to render properly.
2014-03-11 17:27:42 +01:00
John Scipione
ab5c74422e BView: ScrollWithMouseWheelDelta return status code 2014-03-07 19:11:44 -05:00
John Scipione
5d10a74cfb BSeparatorItem: Style fix, rename archive to data
... missed it in a few places, trying to make variables names consistent.

Update hrev in docs
2014-03-04 14:28:20 -05:00
John Scipione
4479c8fda7 Style fixes to BSeparatorItem class.
Mostly meant for documentation with a few other style corrections as well.

Update copyright header.
2014-03-04 14:15:20 -05:00
John Scipione
fa412b5fd9 BMenuItem: Style fixes related to documentation. 2014-02-28 19:05:34 -05:00
Adrien Destugues
b8c44b4c3f BAffineTransform: C++11 compatibility fix
inline const floats are a gcc extension. It is possible to do it in a
standard way in C++11 using constexpr, but then gcc will reject the
previously accepted nonstandard syntax.
2014-02-07 14:42:51 +01:00
Stephan Aßmus
a6db6bd40f Added WIP support for affine transformations to BViews.
Everything untested, but compiles, so it must work. The idea is to introduce
BAffineTransform additionally to the existing Origin and Scale properties of
BViews. One may use it in parallel or as an alternative. Painter in app_server
is not yet aware of the additional transformation. It is however already used
to transform drawing coordinates. It probably needs to work differently,
perhaps only in Painter and AGGTextRenderer.
2014-02-04 22:53:06 +01:00
John Scipione
77acb43273 TextView: Remove Cmd+Up and Cmd+Down Shortcuts
to go to the beginning and end of the document.
2014-02-01 11:04:34 -05:00
John Scipione
0875173246 TextView: Update nav shortcuts again
Make Cmd+Left and Cmd+Right work the same as Option+Left and
Option+Right, that is, they do word-wise navigation.

Make Option+Up go to beginning of paragraph and Option+Down go to end
of paragraph like Cmd+Left and Cmd+Right used to.

Unfortunately option shortcuts are currently eaten by S&T until #9431
gets fixed.
2014-01-31 18:30:07 -05:00
John Scipione
eb774c2948 TextView: Update navigation shortcuts
* Command+Left goes to beginning of line, ignoring softwrap
* Command+Right goes to the end of line, ignoring softwrap
* Home goes to beginning of line, accounting for softwrap
* End goes to end of line, accounting for softwrap
* Option+Left goes to previous word
* Option+Right goes to next word
* Command+Home and Command+Up go to beginning of document
* Command+End and Command+Down go to end of document

Shift with any of the above also selects the text.

This is similar to how the text editor Eddie works.
2014-01-30 19:48:31 -05:00
Ingo Weinhold
a0848a1916 BButton: Add optional pop-up marker
* Add behavior constant B_POP_UP_BEHAVIOR which adds a pop-up marker
  to the button (similar to that of BMenuField).
* Add methods [Set]PopUpMessage(). To set/get the the message that is
  sent to the button's target when the pop-up marker is clicked.
2013-12-30 04:42:52 +01:00
Ingo Weinhold
813c5772c9 BButton: Removed dead code
Remove methods _DrawDefault() and _DrawFocusLine() which were used for
the non-BControlLook drawing.
2013-12-30 04:18:33 +01:00
Ingo Weinhold
b998f9f02f BButton: Add support for toggle button behavior
Add methods SetBehavior(), Behavior(). Supported behavior constants are
B_BUTTON_BEHAVIOR -- normal button behavior -- and B_TOGGLE_BEHAVIOR
-- toggle button behavior.
2013-12-29 01:21:45 +01:00
Ingo Weinhold
b181fabe57 BButton: Remove left over attributes 2013-12-29 00:43:25 +01:00
Ingo Weinhold
a249edfbfc BButton: Add flat property
* Add methods SetFlat()/IsFlat(). A flat button doesn't draw its frame,
  unless the mouse is hovering over it or it is otherwise activated.
* As a side effect this change also activates the hover glow that was
  already implemented in BControlLook, but not activated in BButton.
2013-12-29 00:13:49 +01:00
Ingo Weinhold
97bf0ce362 BControl: Move icon code to separate class BIcon 2013-12-22 14:45:34 +01:00
Ingo Weinhold
5414b3c445 Move icon related constants to InterfaceDefs.h
There will be non-BControl views to use those as well.
2013-12-22 14:45:33 +01:00
Ingo Weinhold
f829889455 BCheckBox: Add icon support
* Draw(): Remove the non-BControlLook code.
* GetPreferredSize(): Implement based on _ValidatePreferredSize() to
  avoid code duplication.
* Draw(): Fix off-by-one error. The label was too close to the box.
* Draw(), _ValidatePreferredSize(): Add icon support.
  _ValidatePreferredSize() is now actually aligned with what Draw()
  expects. The preferred width is now a tight fit; there were three or
  four pixels of empty space before.
  Due to the fixed check box position the layout isn't that nice in
  some situations (particularly with an icon larger than the text),
  IMHO.
2013-12-22 04:48:21 +01:00
Ingo Weinhold
be4367428b BControl subclasses: Override SetIcon()
... and implement Perform() action for potential later use.
2013-12-22 02:48:27 +01:00
Ingo Weinhold
be260374d5 BControl: Add icon support
The icon is meant as an addition to or replacement of the label. Icon
bitmaps for various states of the control (off, on, partially on, each
enabled or disabled, plus up to 125 custom states) can be set
individually via SetIconBitmap() (getter IconBitmap()).
The convenience method SetIcon() can be used to set the bitmaps for the
standard states from a single bitmap; it also supports cropping the
icon to its non-transparent area. Code borrowed from BIconButton.
2013-12-22 02:48:25 +01:00
Ingo Weinhold
1b848ee7f2 BControlLook: Add DrawLabel() variants with icon
A label, a bitmap, or both can be specified.
2013-12-22 02:48:24 +01:00
Ingo Weinhold
8719e0dc4b BControlLook: Add methods for getting insets
* Update the previously unused frame_type and background_type enums.
* Add methods GetFrameInsets(), GetBackgroundInsets(), GetInsets() to
  get the insets for a given frame type, background type, or both
  respectively.
2013-12-22 02:48:23 +01:00
Ingo Weinhold
df37cd4edd BCheckBox: Add tri-state support
* Add possible control state B_CONTROL_PARTIALLY_ON and support it in
  BCheckBox and BControlLook.
* BCheckBox: Add partialStateToOff property defining whether the
  partial state should transition to off. Defaults to false (i.e.
  partial to on).
2013-12-21 02:12:04 +01:00
John Scipione
1e1afb3939 Updates to BOutlineListView for docs
mostly param naming.

No functional change intended.
2013-12-11 16:13:52 -05:00
John Scipione
6f33360fac BPopUpMenu style fixes for documentation, no functional change intended 2013-11-11 19:27:45 -05:00
John Scipione
ef92b3dd4c BMenuBar: Update param names related to docs.
No functional change intended.

Renamed title => name in regular constructors,
      No right or wrong here but consistant now.
Renamed data => archive in Achive constructor,
      Ditto.
2013-11-06 19:26:19 -05:00
John Scipione
45e17d3d42 Update BView::DrawAfterChildren() param name
... from r to updateRect, no functional change intended.

Also a tiny change to the param description in the docs.
2013-11-06 13:14:53 -05:00
John Scipione
9a9ebda459 BMenu: Some style fixes related to docs
Mostly just making the variable names match between the
header and source.

No functional change intended.
2013-11-06 12:21:58 -05:00
Julian Harnath
057c8708f2 Move B_MOUSE_IDLE generation to app_server.
* BWindow used to generate the B_MOUSE_IDLE events by sending a
  delayed message with a one-shot BMessageRunner to itself.
  Every creation and deletion of BMessageRunners causes synchronous
  messaging between the application under the mouse cursor and the
  registrar. This creates large amounts of calls to set_port_owner()
  in the kernel whenever moving the mouse.

* Now, B_MOUSE_IDLE is sent by the cursor loop inside the app_server
  instead. When the mouse wasn't moved for the tooltip delay time,
  it inserts a B_MOUSE_IDLE message into the event stream.

* The tooltip delay thus becomes a system-wide constant and is not
  configurable per-application anymore (no code currently in the
  Haiku repo makes use of that anyhow).
2013-10-26 16:11:45 +02:00
John Scipione
285b7163ad MenuField: Filter out additional MouseDown messages.
...while mouse is down on a menufield

This makes it so that you can't open 2 menufields simultaneously
by clicking and holding the right mouse button on one menufield while
clicking a second with the the left mouse button opening it.

This matches the behavior on BeOS R5.

Should help with #6408 comment:9
2013-10-08 20:25:15 -04:00
Ingo Weinhold
cf70d345b2 Merge remote-tracking branch 'haiku/master' into package-management
This reverts 8f7f28a7c3 (OpenGL: Upgrade
to
Mesa 9.2).

Conflicts:
	build/jam/BuildFeatures
	build/jam/HaikuImage
	build/jam/OptionalPackages
	build/scripts/build_cross_tools_gcc4
	src/add-ons/opengl/swpipe/Jamfile
	src/apps/diskusage/Jamfile
	src/kits/tracker/ContainerWindow.cpp
	src/kits/tracker/DeskWindow.cpp
	src/kits/tracker/Jamfile
2013-09-13 01:02:28 +02:00
Ingo Weinhold
4a8da96088 BLayoutUtils: Add GetLayoutTreeDump()
Returns a debug output string listing the basic layout properties of
the view/item hierarchy.
2013-09-11 04:46:36 +02:00
Ingo Weinhold
94dc74b027 More explicit denoting the BPrivate namespace 2013-09-10 19:14:18 +02:00
John Scipione
4385f73996 Revert "Menu: check numBytes == 1 on KeyDown"
This reverts commit 44dc533861.
2013-08-25 19:40:00 -04:00
John Scipione
8f74b98905 MenuField: Remove unused variables
fSelected and fTransition
2013-08-25 00:09:16 -04:00
John Scipione
44dc533861 Menu: check numBytes == 1 on KeyDown 2013-08-25 00:08:44 -04:00
John Scipione
cccc4076db Menu and friends: Style fixes, no functional
... changes intended.

* 80 char limit fixes
* Indentation fixes
* Braces style fixes
* Use ternary operator where appropriate
* Rename menuItem to just item and declare it once outside
  the loop
* Omit 3rd param of GetMouse() because it is default
* Rename variables eg state => focused and menu => submenu
* Indent comments below line they apply to
* Reword some comments
* Add some #pragmas
2013-08-25 00:05:02 -04:00
John Scipione
9422c92ea3 MenuField: Open the menu bar when the label is clicked
Fixes #6894

Private DrawLabel() method renamed to _DrawLabel() and rest of drawing
code moved to new private method _DrawMenuField(). These methods both
check to make sure that they are drawing in a valid rect that intersects
updateRect.

When label or menu is selected Draw a the label background in the selected
menu color matching the behavior of BeOS R5.

_DrawLabel() calls be_control_look->DrawLabel()

Update copyright year in MenuField.h
2013-08-21 04:20:58 -04:00
John Scipione
74577830da ColorControl: Implement keyboard navigation
Implements enhancement described in #9819

This feature works pretty much as it did on BeOS R5.

When you focus on the color control, the border is drawn blue and
the dot on the red ramp draws as an outline to show that it is
selected. You can push the up and down arrow keys to navigate to the
previous and next ramps respectively and can push right and left to
increment and decrement the color value of the selected ramp.

Clicking on the control no longer gives it focus.

In BeOS the left and right arrows would increment and decriment by 5,
on Haiku they increment and decrement by 1, but, by holding down the
key for a second or so the increment value increases to 5 allowing for
both course and fine adjustments.

On a technical note I split the int32 fFocusedComponent member variable
into 2 int16 member variables, fFocusedRamp and fClickedRamp. I did this
because I needed an entra variable, and can't  change the size of the
class without using up another reserved member variable slot. int16
should be more than enough for these variables as they store an index to
the currently focused or clicked on ramp (0-3). Please someone chime in
if this is not okay for FBC in some condition I didn't think about.
2013-08-17 03:40:58 -04:00
John Scipione
323523c4b9 BWindow: style fixes only, no functional change. 2013-07-26 18:36:00 -04:00
John Scipione
e724b26f23 Remove enum elaborated type specifier
...from orientation params. Elaborated type specifiers are not needed
for C++ code and removing them makes doxygen happy. Verified working
on both gcc2h and gcc4h builds.
2013-07-08 19:29:11 -04:00
Rene Gollent
d376554674 BBox: propagate alignment from child for the...
...FULL_{VERTICAL,HORIZONTAL} case.
2013-07-03 23:41:44 -04:00
Rene Gollent
46d6e9d9ed 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.
2013-07-01 11:30:49 -04:00
John Scipione
1e6e124cb4 BView: Style fixes only, no functional change intended
Motivated by inconsistancies found while documenting BView.

Update copyright year, alphabetize

Variable names normalized:
* pt => point
* r => rect
* p => pattern
* c => color
* msg => message
* a, b and pt0, pt1 => start, end
* r, g, b, a => red, green, blue, alpha

A couple of white spaces fixes.

A couple of !pointer => pointer == NULL fixes.

GetPreferredSize params => _width and _height to indicate out params.
2013-06-28 22:59:17 -04:00
John Scipione
8b3b14fdfa BColorControl: Introduce a _PaletteFrame() method
... eliminating duplicate code.
2013-06-10 19:15:09 -04:00
John Scipione
62fec205dd BColorControl: Size text rect based on font size
* Also change kMinCellSize from a uint32 to a float so that it can be used
  with std::min() and std::max() instead of min_c() and max_c().
* Set the text controls sizes and margins based on the font size. Also rework
  _TextRectOffset() so that it will get the right spacing from by dividing the
  palette frame by 3.
* Replace bare numbers and refactor with calculation or magic constant.
* Create a private method _TextRectOffset() which calculates and
  returns the vertical text rect offset to use based on the font size.
* Replace 2.0 with new kBevelSpacing constant where appropriate.
* fPaletteFrame calculation in _LayoutView() was refactored but should
  not have changed.
2013-06-10 19:15:07 -04:00
John Scipione
1186916f06 BColorControl: Create _SetCellSize() method
...eliminating duplicated code.
2013-06-10 19:15:07 -04:00
John Scipione
0289f92063 BColorControl: Style fixes
* Update copyright in header, add my name, alphabetize.
* Rename _ColorRamp() to _DrawColorRamp().
* Rename update parameter to updateRect
2013-06-10 19:15:06 -04:00
John Scipione
fc77b031d7 Revert "BBox: Always offset the top border by the same amount"
This reverts commit 39899cf662.

Checked with BeOS R5, and this is not how it works, to remain
compatable we need to go back to how this was before.
2013-05-30 21:47:04 -04:00