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 » U++ Library support » Splitter » Why Splitter::GetChildCount() is not public???- GetCount [SOLVED]
Why Splitter::GetChildCount() is not public???- GetCount [SOLVED] [message #1956] Tue, 28 March 2006 19:11 Go to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
Why Splitter::GetChildCount() is not public???

[Updated on: Sun, 09 April 2006 03:39]

Report message to a moderator

Re: Why Splitter::GetChildCount() is not public??? [message #1957 is a reply to message #1956] Tue, 28 March 2006 20:18 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
fudadmin wrote on Tue, 28 March 2006 18:11

Why Splitter::GetChildCount() is not public???

and PosToClient()...
Re: Why Splitter::GetChildCount() is not public??? [message #1959 is a reply to message #1957] Tue, 28 March 2006 21:31 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13311
Registered: November 2005
Ultimate Member
fudadmin wrote on Tue, 28 March 2006 13:18

fudadmin wrote on Tue, 28 March 2006 18:11

Why Splitter::GetChildCount() is not public???

and PosToClient()...



Well, over time I have found "keep the interface minimal" a good practice. Sometimes I am wrong about interface, but enriching it is quite easy thing. But the opposite, removing stuff from interface, is much more dangerous bussines (angry users... Smile.

Will be fun when nDraw (which I am working on now and which changes raster image processing significantly) gets to production code Smile

Mirek
Re: Why Splitter::GetChildCount() is not public??? [message #1961 is a reply to message #1959] Tue, 28 March 2006 23:34 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Tue, 28 March 2006 20:31

fudadmin wrote on Tue, 28 March 2006 13:18

fudadmin wrote on Tue, 28 March 2006 18:11

Why Splitter::GetChildCount() is not public???

and PosToClient()...



Well, over time I have found "keep the interface minimal" a good practice. Sometimes I am wrong about interface, but enriching it is quite easy thing. But the opposite, removing stuff from interface, is much more dangerous bussines (angry users... Smile.

Mirek


The users are angry when they find inconsistant interfaces - in some Ctrl's the same methods are public, in some - not. It looks like I will have to maintain my own version of Ultimate++...
Re: Why Splitter::GetChildCount() is not public??? [message #1963 is a reply to message #1961] Tue, 28 March 2006 23:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13311
Registered: November 2005
Ultimate Member
fudadmin wrote on Tue, 28 March 2006 16:34

luzr wrote on Tue, 28 March 2006 20:31

fudadmin wrote on Tue, 28 March 2006 13:18

fudadmin wrote on Tue, 28 March 2006 18:11

Why Splitter::GetChildCount() is not public???

and PosToClient()...



Well, over time I have found "keep the interface minimal" a good practice. Sometimes I am wrong about interface, but enriching it is quite easy thing. But the opposite, removing stuff from interface, is much more dangerous bussines (angry users... Smile.

Mirek


The users are angry when they find inconsistant interfaces - in some Ctrl's the same methods are public, in some - not. It looks like I will have to maintain my own version of Ultimate++...


PosToClient nor GetChildCount is not common public interface....

Mirek
Re: Why Splitter::GetChildCount() is not public??? [message #1965 is a reply to message #1963] Wed, 29 March 2006 00:45 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Tue, 28 March 2006 22:54

fudadmin wrote on Tue, 28 March 2006 16:34

luzr wrote on Tue, 28 March 2006 20:31

fudadmin wrote on Tue, 28 March 2006 13:18

fudadmin wrote on Tue, 28 March 2006 18:11

Why Splitter::GetChildCount() is not public???

and PosToClient()...



Well, over time I have found "keep the interface minimal" a good practice. Sometimes I am wrong about interface, but enriching it is quite easy thing. But the opposite, removing stuff from interface, is much more dangerous bussines (angry users... Smile.

Mirek


The users are angry when they find inconsistant interfaces - in some Ctrl's the same methods are public, in some - not. It looks like I will have to maintain my own version of Ultimate++...


PosToClient nor GetChildCount is not common public interface....

Mirek


Originally I meant only count of children. In HeaderCtrl you can have GetCount() which is a number of children? Why all similar controls can't have the same?

Regarding private interfaces - this is where I completely agree with Lisp and Assembler advocates - "C++ was created for stupid programmers"...

P.S
On the other hand Fox-toolkit is not afraid to make public this kind of methods
  /// Return true if specified window is owned by this window
  FXbool isOwnerOf(const FXWindow* window) const;

  /// Return true if specified window is ancestor of this window
  FXbool isChildOf(const FXWindow* window) const;

  /// Return true if this window contains child in its subtree
  FXbool containsChild(const FXWindow* child) const;

  /// Return the child window at specified coordinates
  FXWindow* getChildAt(FXint x,FXint y) const;

  /// Return the number of child windows for this window
  FXint numChildren() const;

  /**
  * Return the index (starting from zero) of the specified child window,
  * or -1 if the window is not a child or NULL
  */
  FXint indexOfChild(const FXWindow *window) const;

  /**
  * Return the child window at specified index,
  * or NULL if the index is negative or out of range
  */
  FXWindow* childAtIndex(FXint index) const;

  /// Return the common ancestor of window a and window b
  static FXWindow* commonAncestor(FXWindow* a,FXWindow* b);

[Updated on: Wed, 29 March 2006 00:55]

Report message to a moderator

Re: Why Splitter::GetChildCount() is not public??? [message #1972 is a reply to message #1956] Wed, 29 March 2006 08:39 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1361
Registered: November 2005
Location: Poland
Ultimate Contributor

The question is why do you need this method to be public? In "real" apps I never needed to check how many children splitter has..
Re: Why Splitter::GetChildCount() is not public??? [message #1973 is a reply to message #1965] Wed, 29 March 2006 10:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13311
Registered: November 2005
Ultimate Member
The trouble of ChildGetCount is that in U++, it is "loop" function (you have to go through the list of child and count them) - you probably do not want to encourage users to depend on such method, you better to force them to organize things differently.

As for HeaderCtrl::GetCount, it is different beast altogether - HeaderCtrl column tabs are not Ctrls.

However, you might be right about Splitter. Therefore, it now has "GetCount", which returns the number of split-panes.

Mirek
Re: Why Splitter::GetChildCount() is not public??? [message #1979 is a reply to message #1973] Wed, 29 March 2006 11:29 Go to previous message
fudadmin is currently offline  fudadmin
Messages: 1298
Registered: November 2005
Location: London, UK
Senior Contributor
Administrator
luzr wrote on Wed, 29 March 2006 09:57

The trouble of ChildGetCount is that in U++, it is "loop" function (you have to go through the list of child and count them) - you probably do not want to encourage users to depend on such method, you better to force them to organize things differently.

As for HeaderCtrl::GetCount, it is different beast altogether - HeaderCtrl column tabs are not Ctrls.

However, you might be right about Splitter. Therefore, it now has "GetCount", which returns the number of split-panes.

Mirek


Thanks! Smile
Previous Topic: setters of Splitter should return Splitter& [ADDED]
Next Topic: The case of the disappearing splitter.
Goto Forum:
  


Current Time: Wed May 12 06:40:06 CEST 2021

Total time taken to generate the page: 0.02046 seconds