void WIDGET_HOTKEY_LIST::OnSize( wxSizeEvent& aEvent )
{
    // Handle this manually - wxTreeListCtrl screws up the width of the first column
    wxDataViewCtrl* view = GetDataView();

    if( !view )
        return;

    wxRect rect = GetClientRect();
    view->SetSize( rect );

#ifdef wxHAS_GENERIC_DATAVIEWCTRL
    {
        wxWindow* view = GetView();
        view->Refresh();
        view->Update();
    }
#endif

    // Find the maximum width of the hotkey column
    int hk_column_width = 0;

    for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
    {
        const wxString& text = GetItemText( item, 1 );
        int width = WidthFor( text );

        if( width > hk_column_width )
            hk_column_width = width;
    }

    if( hk_column_width < HOTKEY_MIN_WIDTH )
        hk_column_width = HOTKEY_MIN_WIDTH;
    else if( hk_column_width <= 0 )
        hk_column_width = 1;

    int name_column_width = rect.width - hk_column_width - HORIZ_MARGIN;

    if( name_column_width <= 0 )
        name_column_width = 1;

    SetColumnWidth( 1, hk_column_width );
    SetColumnWidth( 0, name_column_width );
}
Пример #2
0
/*
 *  call-seq:
 *     view.to_s                        =>  String
 *
 *  Returns a String (binary) representation of the underlying buffer managed by this DataView instance.
 *
 * === Examples
 *     buf = ArrayBuffer.new("buffer")  =>  ArrayBuffer
 *     view = DataView.new(buf)         =>  DataView
 *     view.to_s                        =>  "buffer"
 *
*/
static VALUE rb_data_view_to_s(VALUE obj)
{
    GetDataView(obj);
    return rb_array_buffer_to_s(view->buf);
}
Пример #3
0
/*
 *  call-seq:
 *     view.byte_offset                  =>  Fixnum
 *
 *  Returns the offset into the underlying buffer managed by this DataView instance.
 *
 * === Examples
 *     view = DataView.new("buffer")     =>  DataView
 *     view.byte_offset                  =>  0
 *
 *     view = DataView.new("buffer", 2)  =>  DataView
 *     view.byte_offset                  =>  2
 *
*/
static VALUE rb_data_view_byte_offset(VALUE obj)
{
    GetDataView(obj);
    return ULONG2NUM(view->byte_offset);
}
Пример #4
0
/*
 *  call-seq:
 *     view.buffer                     =>  String
 *
 *  Returns the underlying buffer managed by this DataView instance.
 *
 * === Examples
 *     view = DataView.new("buffer")   =>  DataView
 *     view.buffer                     =>  ArrayBuffer
 *
*/
static VALUE rb_data_view_buffer(VALUE obj)
{
    GetDataView(obj);
    return view->buf;
}
Пример #5
0
/*
 *  call-seq:
 *     view.byte_length                =>  Fixnum
 *
 *  Returns the size of the underlying buffer managed by this DataView instance.
 *
 * === Examples
 *     view = DataView.new("buffer")   =>  DataView
 *     view.byte_length                =>  6
 *
*/
static VALUE rb_data_view_byte_length(VALUE obj)
{
    GetDataView(obj);
    return ULONG2NUM(view->byte_length);
}