0012121: Optimization of existing selection classes
[occt.git] / src / OpenGl / OpenGl_label.cxx
CommitLineData
7fd59977 1
2#include <OpenGl_tgl_all.hxx>
3
4#include <stddef.h>
5#include <stdio.h>
6
7#include <OpenGl_cmn_varargs.hxx>
8#include <OpenGl_telem_attri.hxx>
9#include <OpenGl_tsm.hxx>
10#include <OpenGl_telem.hxx>
11#include <OpenGl_telem_inquire.hxx>
12
13static TStatus LabelAdd( TSM_ELEM_DATA, Tint, cmn_key* );
14static TStatus LabelPrint( TSM_ELEM_DATA, Tint, cmn_key* );
15static TStatus LabelInquire( TSM_ELEM_DATA, Tint, cmn_key* );
16
17static TStatus (*MtdTbl[])( TSM_ELEM_DATA, Tint, cmn_key* ) =
18{
19 0, /* PickTraverse */
20 0, /* Display */
21 LabelAdd,
22 0, /* Delete */
23 LabelPrint,
24 LabelInquire
25};
26
27
28MtblPtr
29TelLabelInitClass( TelType *el )
30{
31 *el = TelLabel;
32 return MtdTbl;
33}
34
35static TStatus
36LabelAdd( TSM_ELEM_DATA d, Tint n, cmn_key *k )
37{
38 ((tsm_elem_data)(d.pdata))->ldata = k[0]->data.ldata;
39
40 return TSuccess;
41}
42
43
44static TStatus
45LabelPrint( TSM_ELEM_DATA data, Tint n, cmn_key *k )
46{
47 fprintf( stdout, "TelLabel. Value = %d\n", data.ldata);
48 fprintf( stdout, "\n" );
49
50 return TSuccess;
51}
52
53static TStatus
54LabelInquire( TSM_ELEM_DATA data, Tint n, cmn_key *k )
55{
56 Tint i;
57
58 for( i = 0; i < n; i++ )
59 {
60 switch( k[i]->id )
61 {
62 case INQ_GET_SIZE_ID:
63 {
64 k[i]->data.ldata = sizeof( Tint );
65 break;
66 }
67 case INQ_GET_CONTENT_ID:
68 {
69 TEL_INQ_CONTENT *c;
70 Teldata *w;
71
72 c = (tel_inq_content)k[i]->data.pdata;
73 w = c->data;
74 c->act_size = 0;
75 w->idata = data.ldata;
76 break;
77 }
78 }
79 }
80
81 return TSuccess;
82}