Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » TabBar: ordering of tabs by their Value (title)
TabBar: ordering of tabs by their Value (title) [message #27040] Tue, 22 June 2010 17:42 Go to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
hi folks.

recently i was in need to have the TabBar / CtrlTabBar stuff have the ability to order the Tabs using some custom ValueOrderFn function. as it had only the GroupOrder and Stacking behaviour i tried to extend it to my best knowledge of the package..

it is a quick fix though, so authors please review it and if it has sense, it might go upstream. i think this is quite important..

the archieve includes the .svn folder for easy inspection / diff.
  • Attachment: TabBar.rar
    (Size: 51.50KB, Downloaded 287 times)
Re: TabBar: ordering of tabs by their Value (title) [message #27088 is a reply to message #27040] Fri, 25 June 2010 11:50 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I have incorporated you changes, though I have changed the implementation and interface. that's partly because I'd implemented the sorting so badly to begin with I thought a rewrite was needed.

These functions are now available:
	TabBar& SortTabs(bool b = true);
	TabBar& SortTabsOnce();
	TabBar& SortTabsOnce(TabSort &sort);
	TabBar& SortTabs(TabSort &sort);

	TabBar& SortTabValues(ValueOrder &sort);
	TabBar& SortTabValuesOnce(ValueOrder &sort);
	TabBar& SortTabKeys(ValueOrder &sort);
	TabBar& SortTabKeysOnce(ValueOrder &sort);
	
	TabBar& SortGroups(bool b = true);
	TabBar& SortGroups(TabSort &sort);
	TabBar& SortStacks(bool b = true);
	TabBar& SortStacks(TabSort &sort);
	TabBar& SortStacks(ValueOrder &sort);

	bool	IsValueSort() const				{ return tabsort; }
	bool	IsGroupSort() const				{ return groupsort; }
	bool	IsStackSort() const				{ return stacksort; }


I also finally got around to adding the ability to change the goup separators, so this function is now added:
	TabBar &SetGroupSeparators(Value horz, Value vert);
(the Values can be anything you would pass to ChPaint)

I have also removed TabBarCtrl (I assume it was you that committed it?). I'm open to adding something like it to the package but that version lacked polish and did not match the coding style (it used camelCase among other things).

Thanks for your additions, I'll look at the Docking submission when I get time.

[Updated on: Fri, 25 June 2010 11:51]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27089 is a reply to message #27088] Fri, 25 June 2010 11:56 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
mrjt wrote on Fri, 25 June 2010 11:50



I have also removed TabBarCtrl ........



Arrghhhh.... no, it was from me, and I'm using it on my app....

Max

[Updated on: Fri, 25 June 2010 11:57]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27095 is a reply to message #27089] Fri, 25 June 2010 12:44 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
TabBarCtrl is quite important, we might consider repolishing Smile

could you transfer TabBarCtrl to bazaar as extra package meanwhile?

[Updated on: Fri, 25 June 2010 13:05]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27096 is a reply to message #27095] Fri, 25 June 2010 12:54 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
There is nothing to stop you using it in your own app or even adding it as a seperate package to the bazaar, it's doesn't need to be included in the TabBar package.

Part of the problem is that the TabBar isn't well suited to encapsulation like that. To make a general purpose ctrl (as it would have to be to be added to the package) you have to either duplicate a lot of the interface or expose the TabBar object, which also exposes the Callbacks that the host ctrl needs to use to function.

It's something that's very easy to do for a single solution for your own app, but difficult to create a 'proper' general purpose ctrl with correct encapsulation.

I'll think about it though, maybe some small changes to TabBar could make it work better.

[Updated on: Fri, 25 June 2010 12:55]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27097 is a reply to message #27096] Fri, 25 June 2010 12:58 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thnks mrjt,

thats exaclty why i needed to make tabbar public in the changes above. its a general question to think of. copying almost the whole api just to hide away a member is overkill
Re: TabBar: ordering of tabs by their Value (title) [message #27099 is a reply to message #27096] Fri, 25 June 2010 13:50 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
mrjt wrote on Fri, 25 June 2010 12:54

There is nothing to stop you using it in your own app or even adding it as a seperate package to the bazaar, it's doesn't need to be included in the TabBar package.



It depends.... if you didn't remove my changes in TabBar, it's ok, I can put in a separate package. If you did remove my patches from tabbar too, I'll have to duplicate all of tabbar code in my package.

Ciao

Max
Re: TabBar: ordering of tabs by their Value (title) [message #27102 is a reply to message #27099] Fri, 25 June 2010 14:44 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Which patches do you mean?

EDIT: If you mean WhenCloseSome etc. then they are still there. The only interface change (besides additions) is the renaming of GroupSort to SortGroups.

[Updated on: Fri, 25 June 2010 15:38]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27107 is a reply to message #27102] Fri, 25 June 2010 16:16 Go to previous messageGo to next message
mdelfede is currently offline  mdelfede
Messages: 1307
Registered: September 2007
Ultimate Contributor
Yep, I meant those Smile

So I'll add a separate TabBarCtrl bazaar package on next days, I guess.

Ciao

Max

[Updated on: Fri, 25 June 2010 16:17]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27110 is a reply to message #27107] Fri, 25 June 2010 17:57 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Right.

I've modified TabBar so that it can now be used like a Ctrl (outside of a frame) and restricts it's drawing to the correct size. Suprisingly few changes were necessary and a nice side effect has been a slight rendering improvement when the scrollbar is hidden Smile

This means that you can now inherit from it directly to make a TabBarCtrl without the use of any Callbacks and the whole interface exposed.

I have attached a package that contains my implementation of TabBarCtrl a much more comprehensive TabCtrlBarTest. I'm not going to commit it just yet as it needs more testing and I haven't tried it with Docking.

EDIT: See further down-thread for latest version

[Updated on: Mon, 28 June 2010 16:49]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27111 is a reply to message #27110] Fri, 25 June 2010 18:01 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thanks, we'll take care of testing over weekend
Re: TabBar: ordering of tabs by their Value (title) [message #27112 is a reply to message #27110] Fri, 25 June 2010 18:08 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
BTW:

while tweaking TabBar:

is it possible to make the scroll bar width adjustable

in
void TabScrollBar::Paint(Draw &w)

the values are somehow hardcoded.. that'd be nice
Re: TabBar: ordering of tabs by their Value (title) [message #27132 is a reply to message #27112] Sun, 27 June 2010 13:37 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Do you mean width as in left to right dimension or height as in the thickness of the bar?
Re: TabBar: ordering of tabs by their Value (title) [message #27142 is a reply to message #27132] Sun, 27 June 2010 23:12 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thickness, maybe something like that??

TabBar.cpp:139
void TabScrollBar::Paint(Draw &w)
...
	if(total > sz.cx) {
		p = Point(ffloor(pos), 1);
		rsz = Size(fceil(size), barwidth);
	}
	else {
		p = Point(0, 1);
		rsz = Size(sz.cx, barwidth);
	}
...


//.h
	void SetBarWidth(int w) { barwidth = w; LayoutRefresh(); }

[Updated on: Mon, 28 June 2010 10:14]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27148 is a reply to message #27142] Mon, 28 June 2010 16:49 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Well, it was a little more complex than that but I've made the changes.

Fucntion is:
TabBar::SetScrollThickness()

which sets the thickness of the blue bar in the scrollbar (the total thickness includes an extra 1 pixel on either side). The default value is 2.

I've also fixed a couple of ScrollBar related bugs in TabBarCtrl and updated TabBarCtrlTest to include option for changing thickness (under tab 3: "Layout3").

[Updated on: Mon, 28 June 2010 16:50]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27149 is a reply to message #27148] Mon, 28 June 2010 16:55 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
thanks a lot..we 'll test..
Re: TabBar: ordering of tabs by their Value (title) [message #27172 is a reply to message #27149] Tue, 29 June 2010 17:07 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Sorry for little offtopic.
Does anyone like these TabBar images?
http://www.ultimatepp.org/forum/index.php?t=msg&goto=262 20#msg_26220
Is there a sense to use them instead of old ones?
Re: TabBar: ordering of tabs by their Value (title) [message #27174 is a reply to message #27149] Tue, 29 June 2010 17:53 Go to previous messageGo to next message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
Hi Mirek

i have spent some time using / adapting your new design, the TabBarCtrl : public TabBar is a good thing Smile

i have modified / extended some things slightly, and tried to adopt / extend the TabBarCtrlTest and the FileTabsExample.

the svn stuff is there, but basicly the current state (since your rar archive was not up in svn Smile so diff shows all your changes as well. but you will spot the stuff i did easily.

bugfix in TabBar.cpp
TabBar& TabBar::SortStacks(bool b)
{
	stacksort = b; << was staticly true


added (to my best knowledge)
TabBar& TabBar::SortGroupsOnce()
TabBar& TabBar::SortGroupsOnce(TabSort &sort)

TabBar& TabBar::SortStacksOnce()
TabBar& TabBar::SortStacksOnce(TabSort &sort)


this one was not implemented
TabBar& TabBar::SortStacks(ValueOrder &sort)


this one needs to go public, since its API functions are public as well
	struct TabSort {


and thus this one has to be public as well.
	struct Tab : Moveable<Tab> {


Docking:

made available the sorting functions from outside.
and some static function stuff, Value converts need not be dependant to intance, if they dont use anything from it...
why not having DockableCtrl::GetContainer() public?

there are 2 changes (first 2) in DockCont.spp from me, which i dont think are usable, so spare them out, they have to do with handling..


i hope this feedback helps
  • Attachment: bazaar.rar
    (Size: 243.72KB, Downloaded 255 times)
Re: TabBar: ordering of tabs by their Value (title) [message #27179 is a reply to message #27172] Tue, 29 June 2010 18:39 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Mindtraveller wrote on Tue, 29 June 2010 16:07

Sorry for little offtopic.
Does anyone like these TabBar images?
http://www.ultimatepp.org/forum/index.php?t=msg&goto=262 20#msg_26220
Is there a sense to use them instead of old ones?

Sorry Embarassed I knew there was something else I was supposed to but I couldn't remember what it was.

I'll add them to the package tomorrow. Definitely this time.

kohait00:
Thanks for the fixes, I obviously made some pretty stupid mistakes there Smile

kohait00 wrote on Tue, 29 June 2010 16:53

Hi Mirek

Not guilty!

James

[Updated on: Tue, 29 June 2010 18:40]

Report message to a moderator

Re: TabBar: ordering of tabs by their Value (title) [message #27184 is a reply to message #27179] Tue, 29 June 2010 21:04 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
sorry guys if i mess up the names Smile
Previous Topic: Doking:Does the Dock Manager work correctly?
Next Topic: HelpViewer Class
Goto Forum:
  


Current Time: Fri Mar 29 15:24:26 CET 2024

Total time taken to generate the page: 0.01296 seconds