APTR ImageButton(CONST_STRPTR text, CONST_STRPTR image)
{
    APTR obj, img;

    img = MUI_NewObject("Dtpic.mui", MUIA_Dtpic_Name, image, TAG_DONE);

    if (text)
    {
        obj = VGroup,
            Child, HCenter(img),
            Child, TextObject, text, MUIA_Text_PreParse, "\033c", End,
        End;
    }
    else
    {
        obj = img;
    }

    return obj;
}
Exemple #2
0
Object *ScreenModeProperties__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    struct ScreenModeProperties_DATA *data;	 
    Object *width, *height, *depth,
           *def_width, *def_height;
	   
    Object *autoscroll;
    
    ULONG id;
    
    self = (Object *)DoSuperNewTags
    (
        CLASS, self, NULL,
	MUIA_Group_Horiz, TRUE,
        Child, (IPTR)ColGroup(4),
	    Child, (IPTR)Label1(__(MSG_WIDTH)),
	    Child, HLeft(width = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_width = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_HEIGHT)),
	    Child, HLeft(height = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_height = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_DEPTH)),
	    Child, HLeft(depth = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)RectangleObject, End,
	    Child, (IPTR)RectangleObject, End,		
	End,  
	    
	Child, (IPTR)MUI_MakeObject(MUIO_VBar, 20),
	    
	Child, (IPTR)HCenter(HGroup,
	    Child, (IPTR)Label1(__(MSG_AUTOSCROLL)),
	    Child, (IPTR)(autoscroll = (Object *)CheckMarkObject, End),
	End),
	
        TAG_MORE, (IPTR)message->ops_AttrList
    );
    
    if (!self)
        goto err;
    
    data = INST_DATA(CLASS, self);    
    
    data->width      = width;
    data->height     = height;
    data->depth      = depth;
    data->def_width  = def_width;
    data->def_height = def_height;
    data->autoscroll = autoscroll;
    
    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Width, MUIV_TriggerValue
    );
    
    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Height, MUIV_TriggerValue
    );
    
    DoMethod
    (
        depth, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Depth, MUIV_TriggerValue
    );
    
    DoMethod
    (
        def_width, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)width, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_width, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
    
    DoMethod
    (
        def_height, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)height, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_height, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
        
    id = GetTagData(MUIA_ScreenModeProperties_DisplayID, INVALID_ID, message->ops_AttrList); 
    set(self, MUIA_ScreenModeProperties_DisplayID, id);
    
    return self;

err:
    CoerceMethod(CLASS, self, OM_DISPOSE);
    return NULL;
}