1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #include "PtRawDrawContainer.h"
40 /* prototype declarations */
41 PtWidgetClass_t
*CreateRawDrawContainerClass( void );
43 /* widget class pointer - class structure, create function */
44 PtWidgetClassRef_t WRawDrawContainer
= { NULL
, CreateRawDrawContainerClass
};
45 PtWidgetClassRef_t
*PtRawDrawContainer
= &WRawDrawContainer
;
50 static void raw_draw_container_dflts( PtWidget_t
*widget
)
52 widget
->flags
|= ( Pt_OPAQUE
);
58 static void raw_draw_container_draw( PtWidget_t
*widget
, PhTile_t
*damage
)
60 RawDrawContainerWidget
*rdc
= ( RawDrawContainerWidget
* ) widget
;
61 rdc
->draw_f( widget
, damage
);
65 // Class creation function
67 PtWidgetClass_t
*CreateRawDrawContainerClass( void )
69 // define our resources
70 static PtResourceRec_t resources
[] = {
71 { RDC_DRAW_FUNC
, Pt_CHANGE_INVISIBLE
, 0,
72 Pt_ARG_IS_POINTER( RawDrawContainerWidget
, draw_f
), 0 }
75 // set up our class member values
76 static PtArg_t args
[] = {
77 { Pt_SET_VERSION
, 110},
78 { Pt_SET_STATE_LEN
, sizeof( RawDrawContainerWidget
) },
79 { Pt_SET_DFLTS_F
, (long)raw_draw_container_dflts
},
80 { Pt_SET_DRAW_F
, (long)raw_draw_container_draw
},
81 { Pt_SET_FLAGS
, Pt_RECTANGULAR
| Pt_OPAQUE
, Pt_RECTANGULAR
| Pt_OPAQUE
},
82 { Pt_SET_NUM_RESOURCES
, sizeof( resources
) / sizeof( resources
[0] ) },
83 { Pt_SET_RESOURCES
, (long)resources
, sizeof( resources
) / sizeof( resources
[0] ) },
86 // create the widget class
87 return( PtRawDrawContainer
->wclass
= PtCreateWidgetClass(
88 PtContainer
, 0, sizeof( args
)/sizeof( args
[0] ), args
) );