Back to index

plt-scheme  4.2.1
Public Member Functions | Public Attributes
os_wxMenu Class Reference
Inheritance diagram for os_wxMenu:
Inheritance graph
[legend]
Collaboration diagram for os_wxMenu:
Collaboration graph
[legend]

List of all members.

Public Member Functions

os_wxMenu CONSTRUCTOR_ARGS ((nstring x0=NULL, wxFunction x1=NULL, class wxFont *x2=NULL))
 ~os_wxMenu ()
int Number (void)
void Append (long id, char *label, char *help=NULL, Bool checkable=FALSE)
void Append (long id, char *label, wxMenu *submenu, char *help=NULL)
void AppendSeparator (void)
Bool DeleteItem (long id, int pos)
Bool Delete (long id)
Bool DeleteByPosition (int pos)
void Break (void)
void Check (long id, Bool flag)
Bool Checked (long id)
void Enable (long id, Bool flag)
char * GetHelpString (long id)
char * GetLabel (long id)
char * GetTitle (void)
void SetHelpString (long id, char *help)
void SetLabel (long id, char *label)
void SetTitle (char *title)
wxFontGetFont ()
voidGetClientData (void)
void SetClientData (void *data)
int FindItem (char *label, int strip=1)
void Stop (void)
void Unpop (void)
void SetWidth (int w)
void install_cleanup ()
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
voidoperator new (size_t size, void *p)
voidoperator new (size_t size)
voidoperator new (size_t size, GCPlacement gcp)
void operator delete (void *obj)
void operator delete (void *, void *)
void operator delete (void *obj)
voidoperator new[] (size_t size)
voidoperator new[] (size_t size, GCPlacement gcp)
voidoperator new[] (size_t size, void *p)
void operator delete[] (void *obj)
void operator delete[] (void *, void *)

Public Attributes

Scheme_Objectcallback_closure
WXTYPE __type
void__gc_external

Detailed Description

Definition at line 103 of file wxs_menu.cxx.


Constructor & Destructor Documentation

Definition at line 133 of file wxs_menu.cxx.

Here is the call graph for this function:


Member Function Documentation

void wxMenu::Append ( long  id,
char *  label,
char *  help = NULL,
Bool  checkable = FALSE 
) [inherited]

Definition at line 250 of file Menu.cc.

{
    menu_item *item;
    char *ms;

    Stop();
  
    item = 0;
    // create new menu item or use topdummy
    if (topdummy) {
       item = (menu_item*)topdummy;
       FREE_MENU_STRING(item->label);
       FREE_MENU_STRING(item->key_binding);
       if (item->user_data)
         FREE_TOP_POINTER(item->user_data);
       topdummy = 0;
    } else {
      item = MALLOC_MENU_ITEM();
      // chain or initialize menu_item list
      if (last) {
       menu_item *prev = (menu_item*)last;
       prev->next = item;
       item->prev = prev;
       last = (wxMenuItem*)item;
      } else {
       top = last = (wxMenuItem*)item;
       item->prev = NULL;
      }
    }
    // initialize menu_item
    if ((long)help == -1) {
      /* Hack to avoid parse: */
      char *s;
      s = copystring(label);
      ms = MAKE_MENU_STRING(s);
      item->label = ms;
      item->key_binding = NULL;
    } else {
      wxGetLabelAndKey(label, &item->label, &item->key_binding);
      ms = MAKE_MENU_STRING(item->label);
      item->label = ms;
      ms = MAKE_MENU_STRING(item->key_binding);
      item->key_binding = ms;
    }
    if (help == (char *)-1)
      ms = help;
    else
      ms = MAKE_MENU_STRING(help);
    item->help_text = ms;
    item->ID        = id; 
    item->enabled   = TRUE;
    item->set       = FALSE;
    item->contents  = NULL;
    item->next      = NULL;
    item->user_data = NULL;
    item->type      = checkable ? MENU_TOGGLE : MENU_BUTTON;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMenu::Append ( long  id,
char *  label,
wxMenu submenu,
char *  help = NULL 
) [inherited]

Definition at line 308 of file Menu.cc.

{
  menu_item *item;
  void *tm;

  /* enforce one-menu-owner: */
  if (submenu->owner)
    return;

  Stop();

  // do the same thing as if appending a "button"
  Append(id, label, help, FALSE);
  // change data for submenu
  item            = (menu_item*)last;
  item->type      = MENU_CASCADE;
  item->contents  = (menu_item*)submenu->top;
  tm = BUNDLE_TOP_MENU(submenu);
  item->user_data = tm;
  submenu->owner = (wxMenuItem **)item;
#ifdef MZ_PRECISE_GC
  children->Append(submenu);
#endif
}

Here is the call graph for this function:

void wxMenu::AppendSeparator ( void  ) [inherited]

Definition at line 333 of file Menu.cc.

{
    menu_item * item;

    Stop();

    // do the same thing as if appending a "button"
    Append(-1, NULL, NULL, FALSE);
    // change data for separator
    item = (menu_item*)last;
    item->type      = MENU_SEPARATOR;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMenu::Break ( void  ) [inline, inherited]

Definition at line 72 of file Menu.h.

{}; // not supported
void wxMenu::Check ( long  id,
Bool  flag 
) [inherited]

Definition at line 438 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found)
       found->set = flag;
}

Here is the call graph for this function:

Bool wxMenu::Checked ( long  id) [inherited]

Definition at line 446 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found)
      return found->set;
    return FALSE;
}

Here is the call graph for this function:

Bool wxMenu::Delete ( long  id) [inherited]

Definition at line 406 of file Menu.cc.

{
  return DeleteItem(id, -1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool wxMenu::DeleteByPosition ( int  pos) [inherited]

Definition at line 411 of file Menu.cc.

{
  if (pos > -1)
    return DeleteItem(0, pos);
  else
    return FALSE;
}

Here is the call graph for this function:

Bool wxMenu::DeleteItem ( long  id,
int  pos 
) [inherited]

Definition at line 346 of file Menu.cc.

{
  menu_item *found, *prev;

  if (id == -1)
    return FALSE;

  for (found = (menu_item*)top; found && pos--; found = found->next) {
    if ((pos < 0) && (found->ID == id))
      break;
  }

  prev = found->prev;

  if (found) {
    Stop();

    if (!prev) {
      top = (wxMenuItem*)found->next;
      if (found->next)
       found->next->prev = NULL;
      if (!top) {
       last = 0;
       Append(-1, NULL); /* Reinstate topdummy */
       topdummy = top;
      }
      if (owner)
       ((menu_item *)owner)->contents = (menu_item *)top;
    } else {
      prev->next = found->next;
      if (prev->next)
       prev->next->prev = prev;
      if (!found->next)
       last = (wxMenuItem*)prev;
    }

    FREE_MENU_STRING(found->label);
    FREE_MENU_STRING(found->key_binding);
    if (found->help_text != (char *)-1)
      FREE_MENU_STRING(found->help_text);

    /* If there's a submenu, let it go. */
    if (found->contents) {
      wxMenu *mnu;
      mnu = EXTRACT_TOP_MENU(found);
      mnu->owner = NULL;
      if (found->user_data)
       FREE_TOP_POINTER(found->user_data);
#ifdef MZ_PRECISE_GC
      children->DeleteObject(mnu);
#endif
    }

    FREE_MENU_ITEM(found);

    return TRUE;
  } else
    return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wxMenu::Enable ( long  id,
Bool  flag 
) [inherited]

Definition at line 455 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found) {
      if (!flag && found->enabled)
       Stop();
      found->enabled = flag;
    }
}

Here is the call graph for this function:

int wxMenu::FindItem ( char *  label,
int  strip = 1 
) [inherited]

Definition at line 531 of file Menu.cc.

{
    char *label, *key;
    int  answer = -1;

    if (strip)
      wxGetLabelAndKey(itemstring, &label, &key);
    else
      label = itemstring;
    for (menu_item *item = (menu_item*)top; item; item=item->next) {
       if (!strcmp(label, item->label)) { // label found
           answer = item->ID;
           break; // found
       }
       if (item->contents) // has submenu => search in submenu
         if ((answer = EXTRACT_TOP_MENU(item)->FindItem(label)) > -1)
           break; // found
    }
    return answer;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* wxMenu::GetClientData ( void  ) [inline, inherited]

Definition at line 84 of file Menu.h.

{ return client_data; }
wxFont* wxMenu::GetFont ( void  ) [inline, inherited]

Definition at line 82 of file Menu.h.

{ return font; }
char * wxMenu::GetHelpString ( long  id) [inherited]

Definition at line 466 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found)
      return found->help_text;
    return NULL;
}

Here is the call graph for this function:

char * wxMenu::GetLabel ( long  id) [inherited]

Definition at line 475 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found)
      return found->label;
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * wxMenu::GetTitle ( void  ) [inherited]

Definition at line 484 of file Menu.cc.

{
    if (title)
      return ((menu_item*)title)->label;
    return NULL;
}

Definition at line 99 of file wxGC.cxx.

{
  GC_finalization_proc old_fn;
  void *old_data;

# ifdef MZ_PRECISE_GC
#  define ALLOW_NON_BASE 0
#  define CHECK_BASE 0
# else
#  ifdef wx_xt
#   define ALLOW_NON_BASE 0
#   define CHECK_BASE 0
#  else
#   ifdef WIN32
#    define ALLOW_NON_BASE 0
#    define CHECK_BASE 1
#    define CRASH_ON_NONBASE 1
#   else
#    define ALLOW_NON_BASE 1
#    define CHECK_BASE 0
#   endif
#  endif
# endif

# if CHECK_BASE || ALLOW_NON_BASE
  if (GC_base(this) != (void *)this) {
#  if ALLOW_NON_BASE
    return;
#  else
#   ifdef CRASH_ON_NONBASE
    *(long *)0x0 = 1;
#   else
    printf("Clean-up object is not the base object\n");
    abort();
#   endif
#  endif
  }
# endif

  GC_register_finalizer_ignore_self(gcOBJ_TO_PTR(this), 
                                CAST_GCP GC_cleanup, NULL, 
                                CAST_GCPP &old_fn, &old_data);

# if CHECK_BASE
  if (old_fn) {
#  ifdef CRASH_ON_NONBASE
       *(long *)0x0 = 1;
#  else
    printf("Object already has a clean-up\n");
    abort();
#  endif
  }
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wxMenu::Number ( void  ) [inherited]

Definition at line 419 of file Menu.cc.

{
  menu_item *found;
  int n = 0;

  for (found = (menu_item*)top; found; found = found->next) {
    n++;
  }

  if (n && topdummy)
    --n;

  return n;
}
void gc::operator delete ( void obj) [inline, inherited]
void gc::operator delete ( void obj) [inline, inherited]

Definition at line 287 of file gc_cpp.h.

                                           {
    GC_FREE( obj );}

Here is the caller graph for this function:

void gc::operator delete ( void ,
void  
) [inline, inherited]

Definition at line 291 of file gc_cpp.h.

{}
void gc::operator delete[] ( void obj) [inline, inherited]

Definition at line 305 of file gc_cpp.h.

                                             {
    gc::operator delete( obj );}

Here is the call graph for this function:

void gc::operator delete[] ( void ,
void  
) [inline, inherited]

Definition at line 309 of file gc_cpp.h.

{}
void* gc::operator new ( size_t  size) [inline, inherited]
void* gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]
void * gc::operator new ( size_t  size) [inline, inherited]

Definition at line 273 of file gc_cpp.h.

                                           {
    return GC_MALLOC( size );}

Here is the caller graph for this function:

void * gc::operator new ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 276 of file gc_cpp.h.

                                                            {
    if (gcp == UseGC) 
        return GC_MALLOC( size );
    else if (gcp == PointerFreeGC)
       return GC_MALLOC_ATOMIC( size );
    else
        return GC_MALLOC_UNCOLLECTABLE( size );}
void * gc::operator new ( size_t  size,
void p 
) [inline, inherited]

Definition at line 284 of file gc_cpp.h.

                                                    {
    return p;}
void * gc::operator new[] ( size_t  size) [inline, inherited]

Definition at line 296 of file gc_cpp.h.

                                             {
    return gc::operator new( size );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
GCPlacement  gcp 
) [inline, inherited]

Definition at line 299 of file gc_cpp.h.

                                                              {
    return gc::operator new( size, gcp );}

Here is the call graph for this function:

void * gc::operator new[] ( size_t  size,
void p 
) [inline, inherited]

Definition at line 302 of file gc_cpp.h.

                                                      {
    return p;}
void wxMenu::SetClientData ( void data) [inline, inherited]

Definition at line 85 of file Menu.h.

void wxMenu::SetHelpString ( long  id,
char *  help 
) [inherited]

Definition at line 491 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found) {
      char *ms;
      ms = MAKE_MENU_STRING(help);
      found->help_text = ms;
    }
}

Here is the call graph for this function:

void wxMenu::SetLabel ( long  id,
char *  label 
) [inherited]

Definition at line 502 of file Menu.cc.

{
    menu_item *found;
    found = (menu_item*)FindItemForId(id);
    if (found) {
      char *ms;
      Stop();
      wxGetLabelAndKey(label, &found->label, &found->key_binding);
      ms = MAKE_MENU_STRING(found->label);
      found->label = ms;
      ms = MAKE_MENU_STRING(found->key_binding);
      found->key_binding= ms;
    }
}

Here is the call graph for this function:

void wxMenu::SetTitle ( char *  title) [inherited]

Definition at line 517 of file Menu.cc.

{
    if (title) {
      menu_item *item;
      Stop();
      item = (menu_item*)title;
      wxGetLabelAndKey(label, &item->label, &item->key_binding);
    }
}

Here is the call graph for this function:

void wxMenu::SetWidth ( int  w) [inherited]

Definition at line 570 of file Menu.cc.

{
  requested_width = n;
}
void wxMenu::Stop ( void  ) [inherited]

Definition at line 650 of file Menu.cc.

{
  /* No way to get to menu bar right now... */
}

Here is the caller graph for this function:

void wxMenu::Unpop ( void  ) [inherited]

Definition at line 655 of file Menu.cc.

{
  if (X)
    XtCallActionProc(X->menu, "select", NULL, NULL, 0);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 146 of file wxGC.h.

WXTYPE wxObject::__type [inherited]

Definition at line 77 of file Object.h.

Definition at line 105 of file wxs_menu.cxx.


The documentation for this class was generated from the following file: