Пример #1
0
Color
Widget_colorIndex( Handle self, Bool set, int index, Color color)
{
    if ( !set) {
        if ( index < 0 || index > ciMaxId) return clInvalid;
        switch ( index) {
        case ciFore:
            return opt_InPaint ? inherited-> get_color ( self) : apc_widget_get_color( self, ciFore);
        case ciBack:
            return opt_InPaint ? inherited-> get_backColor ( self) : apc_widget_get_color( self, ciBack);
        default:
            return apc_widget_get_color( self, index);
        }
    } else {
        enter_method;
        SingleColor s;
        s. color = color;
        s. index = index;
        if (( index < 0) || ( index > ciMaxId)) return clInvalid;
        if ( !opt_InPaint) my-> first_that( self, (void*)single_color_notify, &s);

        if ( var-> handle == nilHandle) return clInvalid; /* aware of call from Drawable::init */
        if ((( color & clSysFlag) != 0) && (( color & wcMask) == 0))
            color |= var-> widgetClass;
        if ( opt_InPaint) {
            switch ( index) {
            case ciFore:
                inherited-> set_color ( self, color);
                break;
            case ciBack:
                inherited-> set_backColor ( self, color);
                break;
            default:
                apc_widget_set_color ( self, color, index);
            }
        } else {
            switch ( index) {
            case ciFore:
                opt_clear( optOwnerColor);
                break;
            case ciBack:
                opt_clear( optOwnerBackColor);
                break;
            }
            apc_widget_set_color( self, color, index);
            my-> repaint( self);
        }
    }
    return 0;
}
Пример #2
0
void
Timer_stop( Handle self)
{
   if ( !is_opt( optActive)) return;
   apc_timer_stop( self);
   opt_clear( optActive);
}
Пример #3
0
Handle
Window_icon( Handle self, Bool set, Handle icon)
{
   if ( var-> stage > csFrozen) return nilHandle;

   if ( !set) {
      if ( apc_window_get_icon( self, nilHandle)) {
         HV * profile = newHV();
         Handle i = Object_create( "Prima::Icon", profile);
         sv_free(( SV *) profile);
         apc_window_get_icon( self, i);
         --SvREFCNT( SvRV((( PAnyObject) i)-> mate));
         return i;
      } else
         return nilHandle;
   }

   if ( icon && !kind_of( icon, CImage)) {
       warn("Illegal object reference passed to Window::icon");
       return nilHandle;
   }
   my-> first_that( self, (void*)icon_notify, (void*)icon);
   apc_window_set_icon( self, icon);
   opt_clear( optOwnerIcon);
   return nilHandle;
}
Пример #4
0
void
Drawable_end_paint_info( Handle self)
{
   clear_font_abc_caches( self);
   opt_clear( optInDrawInfo);
   var-> splinePrecision = var-> splinePrecision_saved;
}
Пример #5
0
SV *
Widget_hint( Handle self, Bool set, SV *hint)
{
    enter_method;
    if ( set) {
        if ( var-> stage > csFrozen) return nilSV;
        my-> first_that( self, (void*)hint_notify, (void*)hint);
        free( var-> hint);
        var-> hint = duplicate_string( SvPV_nolen( hint));
        opt_assign( optUTF8_hint, prima_is_utf8_sv(hint));
        if ( application && (( PApplication) application)-> hintVisible &&
                (( PApplication) application)-> hintUnder == self)
        {
            SV   * hintText   = my-> get_hint( self);
            Handle hintWidget = (( PApplication) application)-> hintWidget;
            if ( strlen( var-> hint) == 0)
                my-> set_hintVisible( self, 0);
            if ( hintWidget)
                CWidget(hintWidget)-> set_text( hintWidget, hintText);
            sv_free( hintText);
        }
        opt_clear( optOwnerHint);
    } else {
        hint = newSVpv( var-> hint ? var-> hint : "", 0);
        if ( is_opt( optUTF8_hint)) SvUTF8_on( hint);
        return hint;
    }
    return nilSV;
}
Пример #6
0
Bool
apc_timer_set_timeout( Handle self, int timeout)
{
   objCheck false;
   if ( is_opt( optActive)) {
      KillTimer(( HWND)(( PWidget) var owner)-> handle, var handle);
      if ( !SetTimer(( HWND)(( PWidget) var owner)-> handle, var handle, timeout, nil)) {
         opt_clear( optActive);
         apiErr;
         return false;
      }
   }
   sys s. timer. timeout = timeout;
   return true;
}
Пример #7
0
SV *
Widget_palette( Handle self, Bool set, SV * palette)
{
    int colors;
    if ( !set)
        return inherited-> palette( self, set, palette);

    if ( var-> stage > csFrozen) return nilSV;
    if ( var-> handle == nilHandle) return nilSV; /* aware of call from Drawable::init */

    colors = var-> palSize;
    free( var-> palette);
    var-> palette = read_palette( &var-> palSize, palette);
    opt_clear( optOwnerPalette);
    if ( colors == 0 && var-> palSize == 0)
        return nilSV; /* do not bother apc */
    if ( opt_InPaint)
        apc_gp_set_palette( self);
    else
        apc_widget_set_palette( self);
    return nilSV;
}
Пример #8
0
Bool
apc_timer_create( Handle self, Handle owner, int timeout)
{
   Bool reset = false;
   objCheck false;
   dobjCheck( owner) false;

   if (( DHANDLE( owner) != sys owner) && ( var handle != nilHandle) && is_opt( optActive)) {
      if ( !KillTimer(( HWND)(( PWidget) var owner)-> handle, var handle)) apiErr;
      remove_timer( self, var owner);
      reset = true;
   }
   sys owner = DHANDLE( owner);
   if ( !( var handle = add_timer( self, owner))) return false;
   sys s. timer. timeout = timeout;
   if ( reset) {
      if ( !SetTimer(( HWND)(( PWidget) owner)-> handle, var handle, sys s. timer. timeout, nil)) {
         opt_clear( optActive);
         apiErrRet;
      }
   }
   return true;
}