Module: RWin::Application
- Defined in:
- ext/rwin/rwin.c
Defined Under Namespace
Classes: CancelDefWindowProc
Constant Summary collapse
- IS_GUIAPP =
IS_GUIAPP- COMCTL_MAJOR_VERSION =
COMCTL_MAJOR_VERSION- COMCTL_MINOR_VERSION =
COMCTL_MINOR_VERSION
Class Method Summary collapse
- .automsgloop ⇒ Object
- .CancelDefWindowProc(*args) ⇒ Object
- .count_opened_window ⇒ Object
- .dlgmsgloop ⇒ Object
-
.external_encoding ⇒ Object
Encoding.
- .external_encoding=(enc) ⇒ Object
- .GetCursor ⇒ Object
- .GetCursorPos ⇒ Object
- .hInstance ⇒ Object
- .hrsc2ref(v_handle) ⇒ Object
- .hwnd2ref(v_handle) ⇒ Object
- .is_unicode? ⇒ Boolean
-
.msgloop ⇒ Object
Message loops.
- .quit! ⇒ Object
- .SetCursor(v_cur) ⇒ Object
- .ShowCursor(v_show) ⇒ Object
Class Method Details
.automsgloop ⇒ Object
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'ext/rwin/rwin.c', line 165
static VALUE
rwapp_automsgloop(){
MSG msg;
#if RWIN_USEMULTITHREAD
while(TRUE){
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
if (msg.message==WM_QUIT) break;
if (!((activewin && TranslateAccelerator(activewin->hwnd,activewin->haccel,&msg)) ||
activewin && (INT_PTR)RwDlgProc==GetWindowLongPtr(activewin->hwnd,DWLP_DLGPROC) &&
IsDialogMessage(activewin->hwnd, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else { /* for Ruby Thread */
if(!GetQueueStatus(QS_ALLEVENTS)){
rb_thread_call_without_gvl((void*(*)(void*))WaitMessage, 0, RUBY_UBF_IO, 0);
}
}
}
#else
while(GetMessage(&msg, NULL, 0, 0)){
if (!((activewin && TranslateAccelerator(activewin->hwnd,activewin->haccel,&msg)) ||
activewin && (INT_PTR)RwDlgProc==GetWindowLongPtr(activewin->hwnd,DWLP_DLGPROC) &&
IsDialogMessage(activewin->hwnd, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
#endif
// destroy_all_win(0);
rb_exit(msg.wParam);
}
|
.CancelDefWindowProc(*args) ⇒ Object
287 288 289 290 291 292 293 294 295 |
# File 'ext/rwin/rwin.c', line 287
static VALUE
rw_msg_new_and_set_retval(int argc, VALUE *argv, VALUE klass){
RwCancelDefWindowProc *rcp;
VALUE obj = TypedData_Make_Struct(cRwCancelDefWndProc, RwCancelDefWindowProc, &rw_candefwndprc_d_type, rcp);
if (argc>0) {
rcp->retval = NIL_P(argv[0]) ? 1 : NUM2ULONG_PTR(argv[0]);
}
return obj;
}
|
.count_opened_window ⇒ Object
342 343 344 345 |
# File 'ext/rwin/rwin.c', line 342 static VALUE rwapp_count_opened_window(){ return INT2FIX(aaCount(winlist)); } |
.dlgmsgloop ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'ext/rwin/rwin.c', line 132
static VALUE
rwapp_dlgmsgloop(){
MSG msg;
#if RWIN_USEMULTITHREAD
while(TRUE){
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
if (msg.message == WM_QUIT) break;
if (!((activewin && TranslateAccelerator(activewin->hwnd,activewin->haccel,&msg)) ||
activewin && IsDialogMessage(activewin->hwnd, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else { /* for Ruby Thread */
if(!GetQueueStatus(QS_ALLEVENTS)){
rb_thread_call_without_gvl((void*(*)(void*))WaitMessage, 0, RUBY_UBF_IO, 0);
}
}
}
#else
while(GetMessage(&msg, NULL, 0, 0)){
if (!((activewin && TranslateAccelerator(activewin->hwnd,activewin->haccel,&msg)) ||
activewin && IsDialogMessage(activewin->hwnd, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
#endif
rb_exit(msg.wParam);
}
|
.external_encoding ⇒ Object
Encoding
297 298 299 300 |
# File 'ext/rwin/rwin.c', line 297 static VALUE rwapp_get_externalenc(){ return external_encoding; } |
.external_encoding=(enc) ⇒ Object
301 302 303 304 305 306 |
# File 'ext/rwin/rwin.c', line 301
static VALUE
rwapp_set_externalenc(VALUE klass, VALUE enc){
external_encoding = enc;
rw_external_enc = rb_enc_from_index(rb_to_encoding_index(external_encoding));
return enc;
}
|
.GetCursor ⇒ Object
876 877 878 879 880 881 |
# File 'ext/rwin/rw_resources.c', line 876
static VALUE
rwapp_getcursor(){
HANDLE hCursor = GetCursor();
VALUE v_cursor = Get_rsc(hCursor);
return NIL_P(v_cursor) ? ULONG_PTR2NUM((ULONG_PTR)hCursor) : v_cursor;
}
|
.GetCursorPos ⇒ Object
265 266 267 268 269 270 271 272 273 274 |
# File 'ext/rwin/rwin.c', line 265 static VALUE rwapp_getcursorpos(VALUE mod){ VALUE robj; POINT pt; GetCursorPos(&pt); robj = rb_ary_new2(2); rb_ary_store(robj, 0, INT2FIX(pt.x)); rb_ary_store(robj, 1, INT2FIX(pt.y)); return robj; } |
.hInstance ⇒ Object
98 99 100 101 |
# File 'ext/rwin/rwin.c', line 98
static VALUE
rwapp_hinstance(){
return INT2NUM((INT_PTR)hInstance);
}
|
.hrsc2ref(v_handle) ⇒ Object
356 357 358 359 360 361 |
# File 'ext/rwin/rwin.c', line 356
static VALUE
rwapp_hrsc2ref(VALUE klass, VALUE v_handle){
VALUE wobj;
if(wobj=Get_rsc(NUM2ULONG_PTR(v_handle))) return wobj;
return Qnil;
}
|
.hwnd2ref(v_handle) ⇒ Object
347 348 349 350 351 352 353 354 |
# File 'ext/rwin/rwin.c', line 347
static VALUE
rwapp_hwnd2ref(VALUE klass, VALUE v_handle){
VALUE wobj;
int hsearch = NUM2ULONG_PTR(v_handle);
if(wobj=Get_childwin(hsearch)) return wobj;
if(wobj=Get_win(hsearch)) return wobj;
return Qnil;
}
|
.is_unicode? ⇒ Boolean
308 309 310 311 312 313 314 315 |
# File 'ext/rwin/rwin.c', line 308 static VALUE is_unicodep(){ #ifdef UNICODE return Qtrue; #else return Qfalse; #endif } |
.msgloop ⇒ Object
Message loops
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'ext/rwin/rwin.c', line 104
static VALUE
rwapp_msgloop(){
MSG msg;
#if RWIN_USEMULTITHREAD
while(TRUE){
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
if (msg.message == WM_QUIT) break;
if (!(activewin && TranslateAccelerator(activewin->hwnd, activewin->haccel, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else { /* for Ruby's Thread */
if(!GetQueueStatus(QS_ALLEVENTS)){
rb_thread_call_without_gvl((void*(*)(void*))WaitMessage, 0, RUBY_UBF_IO, 0);
}
}
}
#else
while(GetMessage(&msg, NULL, 0, 0)){
if (!(activewin && TranslateAccelerator(activewin->hwnd, activewin->haccel, &msg))){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
#endif
rb_exit(msg.wParam);
}
|
.quit! ⇒ Object
259 260 261 262 263 |
# File 'ext/rwin/rwin.c', line 259 static VALUE rwapp_quit_app(VALUE mod){ PostQuitMessage(0); return Qnil; } |
.SetCursor(v_cur) ⇒ Object
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 |
# File 'ext/rwin/rw_resources.c', line 859
static VALUE
rwapp_setcursor(VALUE mod, VALUE v_cur){
HCURSOR hc;
RwCursor *rc;
switch(TYPE(v_cur)){
case T_FIXNUM: case T_BIGNUM:
hc = (HCURSOR)NUM2ULONG_PTR(v_cur);
break;
default:
RwCursor_Data_Get_Struct(v_cur, rc);
RwCheckResource(rc);
hc = rc->hcursor;
}
SetCursor(hc);
return v_cur;
}
|
.ShowCursor(v_show) ⇒ Object
883 884 885 886 887 |
# File 'ext/rwin/rw_resources.c', line 883
static VALUE
rwapp_showcursor(VALUE mod, VALUE v_show){
BOOL bShow = (!v_show || NIL_P(v_show)) ? FALSE : TRUE;
return INT2FIX(ShowCursor(bShow));
}
|