Re: naming conventions
[email protected] (Robert Roebling)
| Newsgroups | gmane.comp.lib.wxwindows.wxnet |
|---|---|
| Message-ID | <BA96674C.8F3A%[email protected]> |
>> namespace wx
>> {
>> const int ALIGN_RIGHT = 0x0008;
>> const int wxALIGN_RIGHT = ALIGN_RIGHT;
>> }
>
> I'm all for providing multiple names for things. I would even add
> "AlignRight" to that list, just to be more C# friendly.
>
> The problem is that these need to be defined within a class or enum, so
> we need to have some leading name. 'wx' makes the most sense, but it's
> also in the 'wx' namespace, so you end up with 'wx.wx.ALIGN_RIGHT'.
OK, so how about providing the enum as "globals"
class Orientation
{
public const int AlignRight = 0x008;
...
}
and the again in wxWindow (from which they will mostly be used):
class public Window
{
private const int wxALIGN_RIGHT = wx.Orientation.AlignRight;
...
}
We should probably put all flags that are in defs.h in the
C# Window class. Then again, this would be really ugly from
a design standpoint, since the wxALIGN_RIGHT is only used
for the Sizer classes.
I wonder if I can use my pseudo-global function and still not
use Window.wxALIGN_RIGHT. Would it be possible to do this
using System;
using System.Drawing;
using wx;
namespace Window
{
class my_pseudo_class_for_gobal_funcs
{
public static Sizer MyDialogFunc()
{
Sizer sizer = new Sizer( ... );
// not use Window.wxALIGN_RIGHT since
// we are in the Window name space
sizer.Add( ..., wxALIGN_RIGHT );
return sizer;
}
}
}
OK, I haven't got the perfect solution either. Maybe a middle
way would be wx.Orientation.RightAlign = wx.Sizer.ALIGN_RIGHT.
Robert
--
Robert Roebling, MD, <[email protected]>
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en