Ignore:
Timestamp:
Mar 29, 2010, 3:13:30 PM (12 years ago)
Author:
dmik
Message:

branches/kmk: Implemented LuPopplerInputButton? and made it switch state on mouse clicks.

Location:
branches/kmk/Lucide/plugins/lupoppler
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/kmk/Lucide/plugins/lupoppler/lupibutton.cpp

    r320 r327  
     1
     2/*
     3 *  This file was generated by the SOM Compiler.
     4 *  Generated using:
     5 *     SOM incremental update: 2.24
     6 */
     7
     8
    19/* ***** BEGIN LICENSE BLOCK *****
    210 * Version: CDDL 1.0/LGPL 2.1
     
    4856
    4957
     58SOM_Scope void SOMLINK init_widgetButton(LuPopplerInputButton *somSelf,
     59                                          Environment *ev, somInitCtrl* ctrl,
     60                                         LuPopplerDocument* aDoc,
     61                                         long aPagenum, Page* aPage,
     62                                         FormWidgetButton* aFormWidgetButton)
     63{
     64    LuPopplerInputButtonData *somThis; /* set in BeginInitializer */
     65    somInitCtrl globalCtrl;
     66    somBooleanVector myMask;
     67    LuPopplerInputButton_BeginInitializer_init_widgetButton;
     68
     69    LuPopplerInputButton_Init_LuPopplerInputField_init_widget(somSelf, ev, ctrl,
     70                                                              aDoc, aPagenum, aPage,
     71                                                              aFormWidgetButton);
     72    LuPopplerInputButton_Init_LuInputButton_somDefaultInit(somSelf, ctrl);
     73
     74    /* local LuPopplerInputField initialization code */
     75
     76    somThis->widget = aFormWidgetButton;
     77}
     78
     79
     80SOM_Scope void SOMLINK somDestruct(LuPopplerInputButton *somSelf,
     81                                   octet doFree, som3DestructCtrl* ctrl)
     82{
     83    LuPopplerInputButtonData *somThis; /* set in BeginDestructor */
     84    somDestructCtrl globalCtrl;
     85    somBooleanVector myMask;
     86    LuPopplerInputButton_BeginDestructor;
     87
     88    /* local LuPopplerInputField deinitialization code */
     89
     90    LuPopplerInputButton_EndDestructor;
     91}
     92
     93
    5094SOM_Scope LuInputButton_ButtonType  SOMLINK getButtonType(LuPopplerInputButton *somSelf,
    5195                                                           Environment *ev)
    5296{
    5397    LuPopplerInputButtonData *somThis = LuPopplerInputButtonGetData(somSelf);
    54     LuPopplerInputButtonMethodDebug("LuPopplerInputButton","getButtonType");
    5598
    56     return (LuPopplerInputButton_parent_LuInputButton_getButtonType(somSelf,
    57                                                                     ev));
     99    LuInputButton_ButtonType type = LuInputButton_Undefined;
     100
     101    switch ( somThis->widget->getButtonType() ) {
     102        case formButtonCheck:   type = LuInputButton_Check; break;
     103        case formButtonPush:    type = LuInputButton_Push; break;
     104        case formButtonRadio:   type = LuInputButton_Radio; break;
     105        default:
     106            break;
     107    }
     108
     109    return type;
    58110}
    59111
     
    62114{
    63115    LuPopplerInputButtonData *somThis = LuPopplerInputButtonGetData(somSelf);
    64     LuPopplerInputButtonMethodDebug("LuPopplerInputButton","getState");
    65116
    66     return (LuPopplerInputButton_parent_LuInputButton_getState(somSelf,
    67                                                                ev));
     117    return somThis->widget->getState();
    68118}
    69119
     
    72122{
    73123    LuPopplerInputButtonData *somThis = LuPopplerInputButtonGetData(somSelf);
    74     LuPopplerInputButtonMethodDebug("LuPopplerInputButton","setState");
    75124
    76     LuPopplerInputButton_parent_LuInputButton_setState(somSelf,
    77                                                        ev, aState);
     125    somThis->widget->setState( aState );
    78126}
    79127
     
    82130{
    83131    LuPopplerInputButtonData *somThis = LuPopplerInputButtonGetData(somSelf);
    84     LuPopplerInputButtonMethodDebug("LuPopplerInputButton","getText");
    85132
    86     return (LuPopplerInputButton_parent_LuInputButton_getText(somSelf,
    87                                                               ev));
     133    return somThis->widget->getOnStr();
    88134}
    89135
     
    92138{
    93139    LuPopplerInputButtonData *somThis = LuPopplerInputButtonGetData(somSelf);
    94     LuPopplerInputButtonMethodDebug("LuPopplerInputButton","getSiblings");
    95140
    96     return (LuPopplerInputButton_parent_LuInputButton_getSiblings(somSelf,
    97                                                                   ev));
     141    int count = somThis->widget->getNumSiblingsID();
     142
     143    LuInputButton_SiblingSequence* siblings = (LuInputButton_SiblingSequence *)
     144        SOMMalloc( sizeof( LuInputButton_SiblingSequence ) );
     145    siblings->_maximum = count;
     146    siblings->_length = count;
     147    siblings->_buffer = (unsigned long *)SOMMalloc( sizeof( unsigned long * ) * count );
     148
     149    unsigned *ids = somThis->widget->getSiblingsID();
     150    for ( int i = 0; i < count; ++i )
     151        siblings->_buffer[ i ] = ids[ i ];
     152
     153    return siblings;
    98154}
    99155
  • branches/kmk/Lucide/plugins/lupoppler/lupibutton.idl

    r320 r327  
    33
    44#include <luibutton.idl>
     5#include <lupifield.idl>
     6
     7interface FormWidgetButton; // declared in poppler/Form.h
    58
    69/**
     
    912 * This interface exposes the FormWidgetButton poppler class.
    1013 */
    11 interface LuPopplerInputButton : LuInputButton
     14interface LuPopplerInputButton : LuPopplerInputField, LuInputButton
    1215{
     16    void init_widgetButton( inout somInitCtrl ctrl, in LuPopplerDocument aDoc,
     17                            in long aPagenum, in Page aPage,
     18                            in FormWidgetButton aFormWidgetButton );
    1319
    1420#ifdef __SOMIDL__
     
    1622    implementation
    1723    {
     24        releaseorder: init_widgetButton;
     25
     26        init_widgetButton: init;
     27        somDestruct: override;
     28
    1829        getButtonType: override;
    1930        getState: override;
     
    2233        getSiblings: override;
    2334
    24         LuInputButton::ButtonType mButtonType;
    25         boolean mState;
    26         string mText;
     35        FormWidgetButton widget;
     36
     37        passthru C_h_before =  ""
     38            ""
     39            "#include <Form.h>"
     40            "";
     41
     42        passthru C_xh_before =  ""
     43            ""
     44            "#include <Form.h>"
     45            "";
    2746    };
    2847
  • branches/kmk/Lucide/plugins/lupoppler/lupoppler.cpp

    r324 r327  
    6262#include "lupoppler.xih"
    6363#include "lupifield.xih"
     64#include "lupibutton.xih"
     65#include "lupitext.xih"
    6466#include "cpconv.h"
    6567
     
    346348                src_x, src_y,
    347349                src_width, src_height,
    348                 NULL, /* links */
     350                gFalse, /* printing (allow links) */
    349351                document->doc->getCatalog() );
    350352
     
    15081510        return NULL;
    15091511
    1510     LuDocument_LuInputFieldSequence *fields = NULL;
    1511 
    1512     fields = (LuDocument_LuInputFieldSequence *)
     1512    LuDocument_LuInputFieldSequence *fields = (LuDocument_LuInputFieldSequence *)
    15131513        SOMMalloc( sizeof( LuDocument_LuInputFieldSequence ) );
    15141514    fields->_maximum = count;
     
    15171517
    15181518    for (int i = 0; i < widgets->getNumWidgets(); ++i) {
    1519         fields->_buffer[i] = new LuPopplerInputField( ev, somSelf, pagenum, page,
    1520                                                       widgets->getWidget( i ) );
     1519        FormWidget *widget = widgets->getWidget( i );
     1520        switch( widget->getType() ) {
     1521            case formButton:
     1522                fields->_buffer[ i ] = static_cast< LuPopplerInputField * >(
     1523                    new LuPopplerInputButton( ev, somSelf, pagenum, page,
     1524                        static_cast< FormWidgetButton * >( widget ) ) );
     1525                break;
     1526            case formText:
     1527                fields->_buffer[ i ] = static_cast< LuPopplerInputField * >(
     1528                    new LuPopplerInputText( ev, somSelf, pagenum, page,
     1529                        static_cast< FormWidgetText * >( widget ) ) );
     1530                break;
     1531//          case formChoice:
     1532//              fields->_buffer[ i ] = static_cast< LuPopplerInputField * >(
     1533//                  new LuPopplerInputChoice( ev, somSelf, pagenum, page,
     1534//                      static_cast< FormWidgetChoice * >( widget ) ) );
     1535//              break;
     1536//          case formSignature:
     1537//              fields->_buffer[ i ] = static_cast< LuPopplerInputField * >(
     1538//                  new LuPopplerInputSignature( ev, somSelf, pagenum, page,
     1539//                      static_cast< FormWidgetSignature * >( widget ) ) );
     1540//              break;
     1541            default:
     1542                fields->_buffer[ i ] =
     1543                    new LuPopplerInputField( ev, somSelf, pagenum, page, widget );
     1544                break;
     1545        }
    15211546    }
    15221547
Note: See TracChangeset for help on using the changeset viewer.