comp.lang.ada
 help / color / mirror / Atom feed
* How best to:
@ 1996-03-22  0:00 tmoran
  0 siblings, 0 replies; only message in thread
From: tmoran @ 1996-03-22  0:00 UTC (permalink / raw)


In a 'cardboard thin' Ada 83 - MS Windows binding, there are a set of
window style constants which can be ORed before being passed to the API.
To reduce errors through a modicum of type checking, I'm declaring

  type Window_Styles         is private;
  type Button_Control_Styles is private;
  type Static_Control_Styles is private;
  type Listbox_Styles        is private;
  ...
  function "+"(left:Window_Styles        ; right:Window_Styles        )
    return Window_Styles        ;
  function "+"(left:Button_Control_Styles; right:Button_Control_Styles)
    return Button_Control_Styles;
  function "+"(left:Static_Control_Styles; right:Static_Control_Styles)
    return Static_Control_Styles;
  function "+"(left:Listbox_Styles       ; right:Listbox_Styles
    ) return Listbox_Styles       ;

etc.  to allow mixing general Windows_Styles with specific ones, but not
allow, eg, Button_Control_Styles to be "+" with Listbox_Styles.

When all is said and done, I wind up with nearly 500 lines.  Is there
a simpler way?

2) The package includes a set of functions of the form
  function ">="(left:Listbox_Styles; right:Window_Styles) return boolean;
to allow checking if a combined style contains a particular style (eg,
if this_style >= WS_BORDER then ...).  Is the use of ">=" for "includes"
likely to be confusing or cause problems?




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-03-22  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-22  0:00 How best to: tmoran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox