Mobile Communication Direct

UiStyler 作成


  1. Visual Studioのプロジェクト フォルダにヘッダーファイルをコピーする。
  2. ユーザー インターフェイス スタイラーで作成されたファイル。



    一応、ヘッダーファイルの名前を変える。(任意)

  3. ヘッダーファイルをプロジェクトに追加する。


  4. コードを追加する。
  5. コード
    
    #include	<iostream>
    
    using namespace std;
    
    
    /* These include files are needed for the following template code.            */
    #include <stdio.h> 
    #include <uf.h>
    #include <uf_defs.h>
    #include <uf_exit.h>
    #include <uf_ui.h>
    #include <uf_styler.h>
    #include <uf_mb.h> 
    //#include <dnCreateThreeFigure.h>
    #include "DIALOG_MAIN.h"
    
    /* The following definition defines the number of callback entries */
    /* in the callback structure:                                      */
    /* UF_STYLER_callback_info_t MAIN_cbs */
    #define MAIN_CB_COUNT ( 6 + 1 ) /* Add 1 for the terminator */
     
    
    /*--------------------------------------------------------------------------
    The following structure defines the callback entries used by the       
    styler file.  This structure MUST be passed into the user function,    
    UF_STYLER_create_dialog along with MAIN_CB_COUNT.                       
    --------------------------------------------------------------------------*/
    static UF_STYLER_callback_info_t MAIN_cbs[MAIN_CB_COUNT] = 
    {
     {UF_STYLER_DIALOG_INDEX, UF_STYLER_CONSTRUCTOR_CB  , 0, MAIN_MAIN_con},
     {UF_STYLER_DIALOG_INDEX, UF_STYLER_DESTRUCTOR_CB   , 0, MAIN_MAIN_des},
     {UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB           , 0, MAIN_MAIN_ok},
     {UF_STYLER_DIALOG_INDEX, UF_STYLER_CANCEL_CB       , 0, MAIN_MAIN_cancel},
     {MAIN_TOGGLE_DRAW_0    , UF_STYLER_VALUE_CHANGED_CB, 0, MAIN_change_TOGGLE_DRAW_0},
     {MAIN_TOGGLE_DRAW_1    , UF_STYLER_VALUE_CHANGED_CB, 0, MAIN_change_TOGGLE_DRAW_1},
     {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
    };
    
    
    
    /*--------------------------------------------------------------------------
    UF_MB_styler_actions_t contains 4 fields.  These are defined as follows:
     
    Field 1 : the name of your dialog that you wish to display.
    Field 2 : any client data you wish to pass to your callbacks.
    Field 3 : your callback structure.
    Field 4 : flag to inform menubar of your dialog location.  This flag MUST  
              match the resource set in your dialog!  Do NOT ASSUME that changing 
              this field will update the location of your dialog.  Please use the 
              UIStyler to indicate the position of your dialog.
    --------------------------------------------------------------------------*/
    static UF_MB_styler_actions_t actions[] = {
        { "dnCreateThreeFigure.dlg",  NULL,   MAIN_cbs,  UF_MB_STYLER_IS_NOT_TOP },
        { NULL,  NULL,  NULL,  0 } /* This is a NULL terminated list */
    };
    
    
    void	ShowDialog(void)
    {
        int  response   = 0;
        int  error_code = 0;
     
        if ( ( UF_initialize() ) != 0 ) 
               return;
    
        if ( ( error_code = UF_STYLER_create_dialog ( "dnCreateThreeFigure.dlg",
               MAIN_cbs,      /* Callbacks from dialog */
               MAIN_CB_COUNT, /* number of callbacks*/
               NULL,        /* This is your client data */
               &response ) ) != 0 )
        {
              char fail_message[133];
    
              /* Get the user function fail message based on the fail code.*/
              UF_get_fail_message(error_code, fail_message);
              UF_UI_set_status (fail_message);
              printf ( "%s\n", fail_message ); 
        }
    
    
        UF_terminate();                             
        return;
    }
    
    
    /*-------------------------------------------------------------------------*/
    /*---------------------- UIStyler Callback Functions ----------------------*/
    /*-------------------------------------------------------------------------*/
    
    /* -------------------------------------------------------------------------
     * Callback Name: MAIN_MAIN_con
     * This is a callback function associated with an action taken from a
     * UIStyler object. 
     *
     * Input: dialog_id   -   The dialog id indicate which dialog this callback
     *                        is associated with.  The dialog id is a dynamic,
     *                        unique id and should not be stored.  It is
     *                        strictly for the use in the UG/Open API:
     *                               UF_STYLER_ask_value(s) 
     *                               UF_STYLER_set_value   
     *        client_data -   Client data is user defined data associated
     *                        with your dialog.  Client data may be bound
     *                        to your dialog with UF_MB_add_styler_actions
     *                        or UF_STYLER_create_dialog.                 
     *        callback_data - This structure pointer contains information
     *                        specific to the UIStyler Object type that  
     *                        invoked this callback and the callback type.
     * -----------------------------------------------------------------------*/
    int MAIN_MAIN_con ( int dialog_id,
                 void * client_data,
                 UF_STYLER_item_value_type_p_t callback_data)
    {
         /* Make sure User Function is available. */  
         if ( UF_initialize() != 0) 
              return ( UF_UI_CB_CONTINUE_DIALOG );
    
         /* ---- Enter your callback code here ----- */
    
         UF_terminate ();
    
        /* Callback acknowledged, do not terminate dialog */
        return (UF_UI_CB_CONTINUE_DIALOG); 
        /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */
        /* for this callback type.  You must continue dialog construction.*/
    
    }
    
    〜〜〜〜〜〜〜〜 以下省略 〜〜〜〜〜〜〜〜
    					
  6. ダイアログ ファイルをカスタム フォルダに追加する。

  7. 完了

 


<戻る>