1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2013-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19-module(cdv_fun_cb).
20
21-export([col_to_elem/1,
22	 col_spec/0,
23	 get_info/1,
24	 get_detail_cols/1]).
25
26-include_lib("wx/include/wx.hrl").
27-include("crashdump_viewer.hrl").
28
29%% Defines
30-define(COL_MOD,    0).
31-define(COL_UNIQ,  ?COL_MOD+1).
32-define(COL_INDEX,  ?COL_UNIQ+1).
33-define(COL_ADDR, ?COL_INDEX+1).
34-define(COL_NADDR,  ?COL_ADDR+1).
35-define(COL_REFC,  ?COL_NADDR+1).
36
37%% Callbacks for cdv_virtual_list_wx
38col_to_elem(id) -> col_to_elem(?COL_MOD);
39col_to_elem(?COL_MOD)   -> #fu.module;
40col_to_elem(?COL_UNIQ)  -> #fu.uniq;
41col_to_elem(?COL_INDEX) -> #fu.index;
42col_to_elem(?COL_ADDR)  -> #fu.address;
43col_to_elem(?COL_NADDR) -> #fu.native_address;
44col_to_elem(?COL_REFC)  -> #fu.refc.
45
46col_spec() ->
47    [{"Module",         ?wxLIST_FORMAT_LEFT,   200},
48     {"Uniq",           ?wxLIST_FORMAT_RIGHT,  100},
49     {"Index",          ?wxLIST_FORMAT_RIGHT,  50},
50     {"Address",        ?wxLIST_FORMAT_LEFT,   120},
51     {"Native Address", ?wxLIST_FORMAT_LEFT,   120},
52     {"Refc",           ?wxLIST_FORMAT_RIGHT,  50}].
53
54get_info(_) ->
55    {ok,Info,TW} = crashdump_viewer:funs(),
56    {Info,TW}.
57
58get_detail_cols(_) ->
59    {[{module, ?COL_MOD}],false}.
60