Class: Notcurses::NcmenuItem

Inherits:
Object
  • Object
show all
Defined in:
ext/notcurses/src/notcurses_wrap.c,
ext/notcurses/src/notcurses_wrap.c

Overview

Proxy of C Notcurses::NcmenuItem struct

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

call-seq:

NcmenuItem.new

Class constructor.



57128
57129
57130
57131
57132
57133
57134
57135
57136
57137
57138
57139
57140
# File 'ext/notcurses/src/notcurses_wrap.c', line 57128

SWIGINTERN VALUE
_wrap_new_NcmenuItem(int argc, VALUE *argv, VALUE self) {
  struct ncmenu_item *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (struct ncmenu_item *)calloc(1, sizeof(struct ncmenu_item));
  DATA_PTR(self) = result;
  return self;
fail:
  return Qnil;
}

Instance Method Details

#desc(*args) ⇒ Object

call-seq:

desc -> char const *

Get value of attribute.



56918
56919
56920
56921
56922
56923
56924
56925
56926
56927
56928
56929
56930
56931
56932
56933
56934
56935
56936
56937
56938
56939
56940
56941
56942
56943
56944
56945
56946
56947
56948
56949
56950
56951
56952
56953
56954
56955
56956
56957
56958
56959
56960
56961
56962
56963
56964
56965
56966
56967
56968
# File 'ext/notcurses/src/notcurses_wrap.c', line 56918

SWIGINTERN VALUE
_wrap_NcmenuItem_desc_get(int argc, VALUE *argv, VALUE self) {
  struct ncmenu_item *arg1 = (struct ncmenu_item *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  char *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncmenu_item, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncmenu_item *","desc", 1, self )); 
  }
  arg1 = (struct ncmenu_item *)(argp1);
  result = (char *) ((arg1)->desc);
  {
    VALUE hash = rb_hash_new();
    VALUE obj;
    
    if (result == NULL) {
      obj = Qnil;
    } else {
      // Convert C string to Ruby string
      obj = rb_str_new2(result);
    }
    
    rb_hash_aset(hash, ID2SYM(rb_intern("return")), obj);
    vresult = hash;
  }
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncmenu_item *");
    if (!ty) ty = SWIGTYPE_p_ncmenu_item;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  return vresult;
fail:
  return Qnil;
}

#desc=(*args) ⇒ Object

call-seq:

desc=(x) -> char const *

Set new value for attribute.



56850
56851
56852
56853
56854
56855
56856
56857
56858
56859
56860
56861
56862
56863
56864
56865
56866
56867
56868
56869
56870
56871
56872
56873
56874
56875
56876
56877
56878
56879
56880
56881
56882
56883
56884
56885
56886
56887
56888
56889
56890
56891
56892
56893
56894
56895
56896
56897
56898
56899
56900
56901
56902
56903
56904
56905
56906
56907
56908
56909
56910
56911
56912
56913
56914
56915
# File 'ext/notcurses/src/notcurses_wrap.c', line 56850

SWIGINTERN VALUE
_wrap_NcmenuItem_desc_set(int argc, VALUE *argv, VALUE self) {
  struct ncmenu_item *arg1 = (struct ncmenu_item *) 0 ;
  char *arg2 = (char *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  int res2 ;
  char *buf2 = 0 ;
  int alloc2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncmenu_item, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncmenu_item *","desc", 1, self )); 
  }
  arg1 = (struct ncmenu_item *)(argp1);
  res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","desc", 2, argv[0] ));
  }
  arg2 = (char *)(buf2);
  if (arg2) {
    size_t size = strlen((const char *)((const char *)(arg2))) + 1;
    arg1->desc = (char const *)(char *)memcpy(malloc((size)*sizeof(char)), arg2, sizeof(char)*(size));
  } else {
    arg1->desc = 0;
  }
  vresult = rb_ary_new();
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncmenu_item *");
    if (!ty) ty = SWIGTYPE_p_ncmenu_item;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    VALUE obj = arg2 ? rb_str_new2(arg2) : Qnil;
    rb_hash_aset(vresult, ID2SYM(rb_intern("desc")), obj);
  }
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return vresult;
fail:
  if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
  return Qnil;
}

#shortcut(*args) ⇒ Object

call-seq:

shortcut -> Ncinput

Get value of attribute.



57052
57053
57054
57055
57056
57057
57058
57059
57060
57061
57062
57063
57064
57065
57066
57067
57068
57069
57070
57071
57072
57073
57074
57075
57076
57077
57078
57079
57080
57081
57082
57083
57084
57085
57086
57087
57088
57089
57090
57091
57092
57093
57094
57095
57096
57097
57098
57099
57100
57101
# File 'ext/notcurses/src/notcurses_wrap.c', line 57052

SWIGINTERN VALUE
_wrap_NcmenuItem_shortcut_get(int argc, VALUE *argv, VALUE self) {
  struct ncmenu_item *arg1 = (struct ncmenu_item *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  ncinput *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncmenu_item, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncmenu_item *","shortcut", 1, self )); 
  }
  arg1 = (struct ncmenu_item *)(argp1);
  result = (ncinput *)& ((arg1)->shortcut);
  {
    VALUE hash = rb_hash_new();
    VALUE obj;
    
    if (strcmp("ncinput *", "void") == 0) {
      obj = Qnil;
    } else {
      obj = SWIG_Ruby_NewPointerObj(result, SWIGTYPE_p_ncinput, 0);
    }
    
    rb_hash_aset(hash, ID2SYM(rb_intern("return")), obj);
    vresult = hash;
  }
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncmenu_item *");
    if (!ty) ty = SWIGTYPE_p_ncmenu_item;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  return vresult;
fail:
  return Qnil;
}

#shortcut=(*args) ⇒ Object

call-seq:

shortcut=(x) -> Ncinput

Set new value for attribute.



56989
56990
56991
56992
56993
56994
56995
56996
56997
56998
56999
57000
57001
57002
57003
57004
57005
57006
57007
57008
57009
57010
57011
57012
57013
57014
57015
57016
57017
57018
57019
57020
57021
57022
57023
57024
57025
57026
57027
57028
57029
57030
57031
57032
57033
57034
57035
57036
57037
57038
57039
57040
57041
57042
57043
57044
57045
57046
57047
57048
57049
# File 'ext/notcurses/src/notcurses_wrap.c', line 56989

SWIGINTERN VALUE
_wrap_NcmenuItem_shortcut_set(int argc, VALUE *argv, VALUE self) {
  struct ncmenu_item *arg1 = (struct ncmenu_item *) 0 ;
  ncinput *arg2 = (ncinput *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncmenu_item, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncmenu_item *","shortcut", 1, self )); 
  }
  arg1 = (struct ncmenu_item *)(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_ncinput, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "ncinput *","shortcut", 2, argv[0] )); 
  }
  arg2 = (ncinput *)(argp2);
  if (arg1) (arg1)->shortcut = *arg2;
  vresult = rb_ary_new();
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncmenu_item *");
    if (!ty) ty = SWIGTYPE_p_ncmenu_item;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("ncinput *");
    if (!ty) ty = SWIGTYPE_p_ncinput;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg2, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("shortcut")), obj);
  }
  return vresult;
fail:
  return Qnil;
}