Class: Newt::Form::ExitStruct
- Inherits:
-
Object
- Object
- Newt::Form::ExitStruct
- Defined in:
- ext/ruby_newt/ruby_newt.c
Instance Method Summary collapse
- #==(obj) ⇒ Object
- #component ⇒ Object
- #inspect ⇒ Object
- #key ⇒ Object
- #reason ⇒ Object
- #watch ⇒ Object
Instance Method Details
#==(obj) ⇒ Object
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
# File 'ext/ruby_newt/ruby_newt.c', line 820 static VALUE rb_ext_ExitStruct_equal(VALUE self, VALUE obj) { rb_newt_ExitStruct *rb_es; newtComponent co; void *data; if (NIL_P(obj)) return Qfalse; if (self == obj) return Qtrue; /* Compare components for backwards compatibility with newtRunForm(). */ if (rb_obj_is_kind_of(obj, cWidget)) { Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); Get_Widget_Data(obj, data); co = ((Widget_data *) data)->co; if (rb_es->es.reason == NEWT_EXIT_COMPONENT && rb_es->es.u.co == co) return Qtrue; } return Qfalse; } |
#component ⇒ Object
808 809 810 811 812 813 814 815 816 817 818 |
# File 'ext/ruby_newt/ruby_newt.c', line 808 static VALUE rb_ext_ExitStruct_component(VALUE self) { rb_newt_ExitStruct *rb_es; Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); if (rb_es->es.reason == NEWT_EXIT_COMPONENT) { return rb_hash_aref(rb_es->components, PTR2NUM(rb_es->es.u.co)); } else { return Qnil; } } |
#inspect ⇒ Object
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 |
# File 'ext/ruby_newt/ruby_newt.c', line 840 static VALUE rb_ext_ExitStruct_inspect(VALUE self) { rb_newt_ExitStruct *rb_es; VALUE classname = rb_class_name(rb_obj_class(self)); char *class = StringValuePtr(classname); Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); switch(rb_es->es.reason) { case NEWT_EXIT_HOTKEY: return rb_sprintf("#<%s:%p reason=%d, key=%d>", class, (void *) self, rb_es->es.reason, rb_es->es.u.key); case NEWT_EXIT_COMPONENT: return rb_sprintf("#<%s:%p reason=%d, component=%p>", class, (void *) self, rb_es->es.reason, rb_es->es.u.co); case NEWT_EXIT_FDREADY: return rb_sprintf("#<%s:%p reason=%d, watch=%d>", class, (void *) self, rb_es->es.reason, rb_es->es.u.watch); case NEWT_EXIT_TIMER: case NEWT_EXIT_ERROR: return rb_sprintf("#<%s:%p reason=%d>", class, (void *) self, rb_es->es.reason); default: return rb_call_super(0, NULL); } } |
#key ⇒ Object
797 798 799 800 801 802 803 804 805 806 |
# File 'ext/ruby_newt/ruby_newt.c', line 797 static VALUE rb_ext_ExitStruct_key(VALUE self) { rb_newt_ExitStruct *rb_es; Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); if (rb_es->es.reason == NEWT_EXIT_HOTKEY) return INT2NUM(rb_es->es.u.key); else return Qnil; } |
#reason ⇒ Object
778 779 780 781 782 783 784 |
# File 'ext/ruby_newt/ruby_newt.c', line 778 static VALUE rb_ext_ExitStruct_reason(VALUE self) { rb_newt_ExitStruct *rb_es; Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); return INT2NUM(rb_es->es.reason); } |
#watch ⇒ Object
786 787 788 789 790 791 792 793 794 795 |
# File 'ext/ruby_newt/ruby_newt.c', line 786 static VALUE rb_ext_ExitStruct_watch(VALUE self) { rb_newt_ExitStruct *rb_es; Data_Get_Struct(self, rb_newt_ExitStruct, rb_es); if (rb_es->es.reason == NEWT_EXIT_FDREADY) return INT2NUM(rb_es->es.u.watch); else return Qnil; } |