Opened 18 years ago

Closed 5 years ago

Last modified 5 years ago

#1142 closed enhancement (fixed)

BToolbar API

Reported by: ekdahl Owned by: waddlesplash
Priority: low Milestone: R1/beta2
Component: Kits/Interface Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking: #5552
Platform: All

Description (last modified by mmadia)

A standard public toolbar class is missing. Is needed to keep a consistent look throughout the system. Should it be possible to add any BControl-derived class to it?

This mailing list thread: BToolBar API, has some pertinent information in replies.

Here are a few features that I quickly came up with, the actual feature set is a topic for further discussion and also depends on the eventual project proposal:

  • horizontal/vertical positioning
  • tear-away toolbars
  • multi-tools that unfold (with a right-click?)
  • arbitrarily resizable symbols (vector)
  • show/hide labels
  • configuring via drag&drop
  • ...

Change History (12)

comment:1 by axeld, 18 years ago

Milestone: R1Unscheduled
Owner: axeld removed
Priority: normallow

comment:2 by mmadia, 15 years ago

Description: modified (diff)
Summary: BToolbar classBToolbar API
Version: R1/pre-alpha1R1/Development

comment:3 by anevilyak, 15 years ago

Blocking: 5552 added

comment:4 by plfiorini, 15 years ago

I started doing some stuff for Caya, actually I've just wrote a ToolButton that supports bitmaps and/or text and menus; some features from Qt's QToolButton are planned so that a ToolButton would be used either inside or outside toolbars.

Also, I'm a big fan of QAction which would be useful to create toolbuttons and menuitems from the same action, a benefit would be to enable or disable the action will always enable or disable the respective controls and trigger the same BMessage when pressed.

Here's the code for reference, I will post another comment once a Toolbar class is done:

http://svn.osdrawer.net/caya/trunk/libs/libinterface/ToolButton.cpp http://svn.osdrawer.net/caya/trunk/libs/libinterface/ToolButton.h

comment:5 by stippi, 15 years ago

The code looks pretty good already. Some remarks:

  • You could probably derive from BButton and avoid implementing some hooks, like MouseDown would only check if the popup menu is clicked, otherwise forward to BButton...
  • When you use be_control_look->Flags(), the drawing functions will already take care of the disabled look, so you don't need to tint the base color yourself.
  • But you probably should tint the bitmap if the control is disabled. You can do this by setting B_CONSTANT_ALPHA and setting a high color with an alpha of 120 or so, and then the DrawBitmap() call will draw the bitmap with "global alpha", which is properly combined with the alpha channel of the bitmap.

You can also look at the IconButton class in WebPositive. Don't get me wrong, I think your code is a lot cleaner, but you can probably copy a lot of SetBitmap() implementations into your class to offer a lot more ways to set the bitmap. IconButton keeps many bitmaps for the various states. I think you may only need the disabled bitmap, since IconButton also decreases the contrast/saturation.

Thanks for working on this!

comment:6 by waddlesplash, 11 years ago

Component: User InterfaceKits/Interface Kit
Milestone: UnscheduledR1/alpha5
Owner: set to waddlesplash
Status: newassigned

comment:7 by waddlesplash, 11 years ago

Blocked By: 10887 added

comment:8 by pulkomandy, 11 years ago

BButton got some improvements lately, making it more suitable for use in a toolbar:

  • Support for icons (of configurable size)
  • Support for a popup menu

This gets the job done for a simple toolbar, which is essentially an horizontal BGroupLayout with buttons in it. We can go further with drag and drop/moveable buttons support, but I'm not sure if this is an useful feature for the standard API; or better left for apps to handle on their own.

comment:9 by pulkomandy, 11 years ago

Milestone: R1/alpha5Unscheduled

New APIs aren't part of the R1 roadmap, remove from alpha5 milestone.

comment:10 by pulkomandy, 5 years ago

Blocked By: 10887 removed
Resolution: fixed
Status: assignedclosed

We have one now.

comment:11 by nielx, 5 years ago

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

comment:12 by nielx, 5 years ago

Milestone: UnscheduledR1/beta2
Note: See TracTickets for help on using tickets.