Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsComponentsDlg Class Reference

#include <nsComponentsDlg.h>

Inheritance diagram for nsComponentsDlg:
Inheritance graph
[legend]
Collaboration diagram for nsComponentsDlg:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { SKIP_DIALOG = 0, SHOW_DIALOG = 1, FORWARD_MOVE = 555, BACKWARD_MOVE = -555 }
enum  { SKIP_DIALOG = 0, SHOW_DIALOG = 1 }

Public Member Functions

 nsComponentsDlg ()
 ~nsComponentsDlg ()
int Parse (nsINIParser *aParser)
int Show (int aDirection)
int Hide (int aDirection)
int SetMsg0 (char *aMsg)
char * GetMsg0 ()
int SetCompList (nsComponentList *aCompList)
nsComponentListGetCompList ()
 nsComponentsDlg ()
 ~nsComponentsDlg ()
int Parse (nsINIParser *aParser)
int Show ()
int Hide ()
int SetMsg0 (char *aMsg)
char * GetMsg0 ()
int SetCompList (nsComponentList *aCompList)
nsComponentListGetCompList ()
int SetShowDlg (int aShowDlg)
int SetShowDlg (int aShowDlg)
int GetShowDlg ()
int GetShowDlg ()
int SetTitle (char *aTitle)
int SetTitle (char *aTitle)
char * GetTitle ()
char * GetTitle ()
void SetPageNum (int aPageNum)
void SetPageNum (int aPageNum)
int GetPageNum ()
int GetPageNum ()

Static Public Member Functions

static void Back (GtkWidget *aWidget, gpointer aData)
static void Next (GtkWidget *aWidget, gpointer aData)
static void RowSelected (GtkWidget *aWidget, gint aRow, gint aColumn, GdkEventButton *aEvent, gpointer aData)
static gboolean KeyPressed (GtkWidget *aWidget, GdkEventKey *aEvent, gpointer aData)
static void ToggleRowSelection (GtkWidget *aEvent, gint aRow, gboolean aToggleState)
static void Back (GtkWidget *aWidget, gpointer aData)
static void Next (GtkWidget *aWidget, gpointer aData)
static void RowSelected (GtkWidget *aWidget, gint aRow, gint aColumn, GdkEventButton *aEvent, gpointer aData)
static gboolean KeyPressed (GtkWidget *aWidget, GdkEventKey *aEvent, gpointer aData)
static void ToggleRowSelection (GtkWidget *aEvent, gint aRow, gint aColumn)

Protected Attributes

int mShowDlg
char * mTitle
char * mSubTitle
int mPageNum
int mWidgetsInit
GtkWidget * mTable

Private Member Functions

int ParseDependees (char *aCurrSec, nsComponent *aCurrComp, nsINIParser *aParser)
int ParseDependees (char *aCurrSec, nsComponent *aCurrComp, nsINIParser *aParser)

Private Attributes

char * mMsg0
nsComponentListmCompList

Detailed Description

Definition at line 49 of file nsComponentsDlg.h.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
SKIP_DIALOG 
SHOW_DIALOG 
FORWARD_MOVE 
BACKWARD_MOVE 

Definition at line 85 of file nsXInstallerDlg.h.

    {
        SKIP_DIALOG     = 0,
        SHOW_DIALOG     = 1,

        FORWARD_MOVE    = 555,
        BACKWARD_MOVE   = -555
    };
anonymous enum [inherited]
Enumerator:
SKIP_DIALOG 
SHOW_DIALOG 

Definition at line 85 of file nsXInstallerDlg.h.

    {
        SKIP_DIALOG     = 0,
        SHOW_DIALOG     = 1
    };

Constructor & Destructor Documentation

Definition at line 50 of file nsComponentsDlg.cpp.

Definition at line 56 of file nsComponentsDlg.cpp.


Member Function Documentation

void nsComponentsDlg::Back ( GtkWidget *  aWidget,
gpointer  aData 
) [static]

Definition at line 63 of file nsComponentsDlg.cpp.

{
    DUMP("Back");
    if (aData != gCtx->cdlg) return;

    // hide this notebook page
    gCtx->cdlg->Hide(nsXInstallerDlg::BACKWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);

    gCtx->sdlg->Show(nsXInstallerDlg::BACKWARD_MOVE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nsComponentsDlg::Back ( GtkWidget *  aWidget,
gpointer  aData 
) [static]

Definition at line 332 of file nsComponentsDlg.cpp.

{
    if (mCompList)
        return mCompList;

    return NULL;
}

Definition at line 312 of file nsComponentsDlg.cpp.

{
    if (mMsg0)
        return mMsg0;

    return NULL;
}

Definition at line 70 of file nsXInstallerDlg.cpp.

{
    return mShowDlg;
}
char* nsXInstallerDlg::GetTitle ( ) [inherited]
char * nsXInstallerDlg::GetTitle ( ) [inherited]

Definition at line 87 of file nsXInstallerDlg.cpp.

{
    if (mTitle)
        return mTitle;

    return NULL;
}
int nsComponentsDlg::Hide ( void  ) [virtual]

Implements nsXInstallerDlg.

Definition at line 431 of file nsComponentsDlg.cpp.

{
    gtk_widget_hide(mTable);

    // disconnect and remove this dlg's nav btns
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);

    gtk_container_remove(GTK_CONTAINER(gCtx->back), gCtx->backLabel); 
    gtk_container_remove(GTK_CONTAINER(gCtx->next), gCtx->nextLabel); 

    gtk_widget_hide(gCtx->back);
    gtk_widget_hide(gCtx->next);

    return OK;
}
int nsComponentsDlg::Hide ( int  aDirection) [virtual]

Implements nsXInstallerDlg.

Definition at line 293 of file nsComponentsDlg.cpp.

{
    gtk_widget_hide(mTable);

    return OK;
}

Here is the caller graph for this function:

static gboolean nsComponentsDlg::KeyPressed ( GtkWidget *  aWidget,
GdkEventKey *  aEvent,
gpointer  aData 
) [static]
gboolean nsComponentsDlg::KeyPressed ( GtkWidget *  aWidget,
GdkEventKey *  aEvent,
gpointer  aData 
) [static]

Definition at line 357 of file nsComponentsDlg.cpp.

{
  DUMP("KeyPressed");

  if (aEvent->keyval == GDK_space)
      ToggleRowSelection(aWidget, sCurrRowSelected, TRUE);

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsComponentsDlg::Next ( GtkWidget *  aWidget,
gpointer  aData 
) [static]

Definition at line 79 of file nsComponentsDlg.cpp.

{
    DUMP("Next");
    if (aData != gCtx->cdlg) return;

       if (OK != nsSetupTypeDlg::VerifyDiskSpace())
           return;

    // hide this notebook page
    gCtx->cdlg->Hide(nsXInstallerDlg::FORWARD_MOVE);

    // disconnect this dlg's nav btn signal handlers
    gtk_signal_disconnect(GTK_OBJECT(gCtx->back), gCtx->backID);
    gtk_signal_disconnect(GTK_OBJECT(gCtx->next), gCtx->nextID);

    // show the next dlg
    gCtx->idlg->Show(nsXInstallerDlg::FORWARD_MOVE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nsComponentsDlg::Next ( GtkWidget *  aWidget,
gpointer  aData 
) [static]
int nsComponentsDlg::Parse ( nsINIParser aParser) [virtual]

Implements nsXInstallerDlg.

int nsComponentsDlg::Parse ( nsINIParser aParser) [virtual]

Implements nsXInstallerDlg.

Definition at line 99 of file nsComponentsDlg.cpp.

{
    int err = OK;
    char *showDlg = NULL;
    int bufsize = 0;

    char *currSec = (char *) malloc(strlen(COMPONENT) + 3);
    if (!currSec) return E_MEM;
    XI_VERIFY(gCtx);

    /* optional keys */
    err = aParser->GetStringAlloc(DLG_COMPONENTS, MSG0, &mMsg0, &bufsize);
    if (err != OK && err != nsINIParser::E_NO_KEY) goto BAIL; else err = OK;

    bufsize = 5;
    err = aParser->GetStringAlloc(DLG_COMPONENTS, SHOW_DLG, &showDlg, &bufsize);
    if (err != OK && err != nsINIParser::E_NO_KEY) goto BAIL; else err = OK;
    if (bufsize != 0 && showDlg)
    {
        if (0 == strncmp(showDlg, "TRUE", 4))
            mShowDlg = nsXInstallerDlg::SHOW_DIALOG;
        else if (0 == strncmp(showDlg, "FALSE", 5))
            mShowDlg = nsXInstallerDlg::SKIP_DIALOG;
    }

    bufsize = 0;
    err = aParser->GetStringAlloc(DLG_COMPONENTS, TITLE, &mTitle, &bufsize);
    if (err != OK  && err != nsINIParser::E_NO_KEY) goto BAIL; else err = OK;
    if (bufsize == 0)
            XI_IF_FREE(mTitle); 

BAIL:
    XI_IF_FREE(currSec);

    return err;
}

Here is the call graph for this function:

int nsComponentsDlg::ParseDependees ( char *  aCurrSec,
nsComponent aCurrComp,
nsINIParser aParser 
) [private]
int nsComponentsDlg::ParseDependees ( char *  aCurrSec,
nsComponent aCurrComp,
nsINIParser aParser 
) [private]
void nsComponentsDlg::RowSelected ( GtkWidget *  aWidget,
gint  aRow,
gint  aColumn,
GdkEventButton *  aEvent,
gpointer  aData 
) [static]

Definition at line 341 of file nsComponentsDlg.cpp.

{
    DUMP("RowSelected");

    sCurrRowSelected = aRow;

    // only toggle row selection state for clicks on the row
    if (aColumn == -1 && !aEvent)
        return;

    ToggleRowSelection(aWidget, aRow,
                       (aColumn == 0 && aEvent->button == 1));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void nsComponentsDlg::RowSelected ( GtkWidget *  aWidget,
gint  aRow,
gint  aColumn,
GdkEventButton *  aEvent,
gpointer  aData 
) [static]

Definition at line 321 of file nsComponentsDlg.cpp.

{
    if (!aCompList)
        return E_PARAM;

    mCompList = aCompList;

    return OK;
}
int nsComponentsDlg::SetMsg0 ( char *  aMsg)

Definition at line 301 of file nsComponentsDlg.cpp.

{
    if (!aMsg)
        return E_PARAM;

    mMsg0 = aMsg;
    
    return OK;
}
int nsComponentsDlg::SetMsg0 ( char *  aMsg)
void nsXInstallerDlg::SetPageNum ( int  aPageNum) [inherited]
void nsXInstallerDlg::SetPageNum ( int  aPageNum) [inherited]
int nsXInstallerDlg::SetShowDlg ( int  aShowDlg) [inherited]
int nsXInstallerDlg::SetShowDlg ( int  aShowDlg) [inherited]

Definition at line 58 of file nsXInstallerDlg.cpp.

{
    if ( aShowDlg != nsXInstallerDlg::SHOW_DIALOG &&
         aShowDlg != nsXInstallerDlg::SKIP_DIALOG )
        return E_PARAM;

    mShowDlg = aShowDlg;

    return OK;
}
int nsXInstallerDlg::SetTitle ( char *  aTitle) [inherited]

Definition at line 76 of file nsXInstallerDlg.cpp.

{
    if (!aTitle)
        return E_PARAM;
    
    mTitle = aTitle;

    return OK;
}
int nsXInstallerDlg::SetTitle ( char *  aTitle) [inherited]
int nsComponentsDlg::Show ( int  aDirection) [virtual]

Implements nsXInstallerDlg.

Definition at line 137 of file nsComponentsDlg.cpp.

{
    int err = OK;
    int customSTIndex = 0, i;
    int numRows = 0;
    int currRow = 0;
    GtkWidget *hbox = NULL;

    XI_VERIFY(gCtx);
    XI_VERIFY(gCtx->notebook);

    if (mWidgetsInit == FALSE)
    {
        customSTIndex = gCtx->sdlg->GetNumSetupTypes();
        sCustomST = gCtx->sdlg->GetSetupTypeList();
        for (i=1; i<customSTIndex; i++)
            sCustomST = sCustomST->GetNext();
        DUMP(sCustomST->GetDescShort());

        // create a new table and add it as a page of the notebook
        mTable = gtk_table_new(5, 1, FALSE);
        gtk_notebook_append_page(GTK_NOTEBOOK(gCtx->notebook), mTable, NULL);
        mPageNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(gCtx->notebook));
        gtk_widget_show(mTable);

        // 1st row: a label (msg0)
        // insert a static text widget in the first row
        GtkWidget *msg0 = gtk_label_new(mMsg0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), msg0, FALSE, FALSE, 0);
        gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 1, 2,
                         static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
                                  GTK_FILL, 20, 20);
        gtk_widget_show(msg0);

        // 2nd row: a CList with a check box for each row (short desc)
        GtkWidget *list = NULL;
        GtkWidget *scrollwin = NULL;
        GtkStyle *style = NULL;
        GdkBitmap *ch_mask = NULL;
        GdkPixmap *checked = NULL;
        GdkBitmap *un_mask = NULL;
        GdkPixmap *unchecked = NULL;
        gchar *dummy[2] = { " ", " " };
        nsComponent *currComp = sCustomST->GetComponents()->GetHead();
        GtkWidget *descLongTable = NULL;
        GtkWidget *frame = NULL;

        scrollwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
            GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

        list = gtk_clist_new(2);
        gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE);
        gtk_clist_column_titles_hide(GTK_CLIST(list));
        gtk_clist_set_column_auto_resize(GTK_CLIST(list), 0, TRUE);
        gtk_clist_set_column_auto_resize(GTK_CLIST(list), 1, TRUE);

        // determine number of rows we'll need
        numRows = sCustomST->GetComponents()->GetLengthVisible();
        for (i = 0; i < numRows; i++)
            gtk_clist_append(GTK_CLIST(list), dummy);
    
        style = gtk_widget_get_style(gCtx->window);
        checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, 
                  &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm);
        unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask,
                    &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm);

        while ((currRow < numRows) && currComp) // paranoia!
        {
            if (!currComp->IsInvisible())
            {
                if (currComp->IsSelected()) 
                    gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, 
                                         checked, ch_mask);
                else
                    gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, 
                                         unchecked, un_mask);

                gtk_clist_set_text(GTK_CLIST(list), currRow, 1,
                                   currComp->GetDescShort());
                currRow++;
            }

            currComp = currComp->GetNext();
        }

        // by default, first row selected upon Show()
        sCurrRowSelected = 0; 

        gtk_signal_connect(GTK_OBJECT(list), "select_row",
                           GTK_SIGNAL_FUNC(RowSelected), NULL);
        gtk_signal_connect(GTK_OBJECT(list), "key_press_event",
                           GTK_SIGNAL_FUNC(KeyPressed), NULL);
        gtk_container_add(GTK_CONTAINER(scrollwin), list);
        gtk_widget_show(list);
        gtk_widget_show(scrollwin);

        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), scrollwin, TRUE, TRUE, 0);
        gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 2, 3,
                         static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
                     static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
                      20, 0);

        // XXX     3rd row: labels for ds avail and ds reqd

        // 4th row: a frame with a label (long desc)
        descLongTable = gtk_table_new(1, 1, FALSE);
        gtk_widget_show(descLongTable);

        gtk_table_attach(GTK_TABLE(mTable), descLongTable, 0, 1, 4, 5,
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
                     20, 20);
        frame = gtk_frame_new(gCtx->Res("DESCRIPTION"));
        gtk_table_attach_defaults(GTK_TABLE(descLongTable), frame, 0, 1, 0, 1);
        gtk_widget_show(frame);

        sDescLong = gtk_label_new(
            sCustomST->GetComponents()->GetFirstVisible()->GetDescLong());
        gtk_label_set_line_wrap(GTK_LABEL(sDescLong), TRUE);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), sDescLong, FALSE, FALSE, 20);
        gtk_widget_show(hbox);

        gtk_table_attach_defaults(GTK_TABLE(descLongTable), hbox, 0, 1, 0, 1);
        gtk_widget_show(sDescLong);

        mWidgetsInit = TRUE;
    }
    else
    {
        gtk_notebook_set_page(GTK_NOTEBOOK(gCtx->notebook), mPageNum);
        gtk_widget_show(mTable);
    }

    // signal connect the buttons
    gCtx->backID = gtk_signal_connect(GTK_OBJECT(gCtx->back), "clicked",
                   GTK_SIGNAL_FUNC(nsComponentsDlg::Back), gCtx->cdlg);
    gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked",
                   GTK_SIGNAL_FUNC(nsComponentsDlg::Next), gCtx->cdlg);

    // show back btn again after setup type dlg where we couldn't go back
    gtk_widget_set_sensitive(gCtx->back, TRUE);

    if (aDirection == nsXInstallerDlg::BACKWARD_MOVE) // from install dlg
      gtk_button_set_label(GTK_BUTTON(gCtx->next), GTK_STOCK_GO_FORWARD);

    return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsComponentsDlg::Show ( void  ) [virtual]

Implements nsXInstallerDlg.

Definition at line 267 of file nsComponentsDlg.cpp.

{
    int err = OK;
    int customSTIndex = 0, i;
    int numRows = 0;
    int currRow = 0;
    GtkWidget *hbox = NULL;

    XI_VERIFY(gCtx);
    XI_VERIFY(gCtx->notebook);

    if (mWidgetsInit == FALSE)
    {
        customSTIndex = gCtx->sdlg->GetNumSetupTypes();
        sCustomST = gCtx->sdlg->GetSetupTypeList();
        for (i=1; i<customSTIndex; i++)
            sCustomST = sCustomST->GetNext();
        DUMP(sCustomST->GetDescShort());

        // create a new table and add it as a page of the notebook
        mTable = gtk_table_new(5, 1, FALSE);
        gtk_notebook_append_page(GTK_NOTEBOOK(gCtx->notebook), mTable, NULL);
        mPageNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(gCtx->notebook));
        gtk_widget_show(mTable);

        // 1st row: a label (msg0)
        // insert a static text widget in the first row
        GtkWidget *msg0 = gtk_label_new(mMsg0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), msg0, FALSE, FALSE, 0);
        gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 1, 2,
                         static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
                                  GTK_FILL, 20, 20);
        gtk_widget_show(msg0);

        // 2nd row: a CList with a check box for each row (short desc)
        GtkWidget *list = NULL;
        GtkWidget *scrollwin = NULL;
        GtkStyle *style = NULL;
        GdkBitmap *ch_mask = NULL;
        GdkPixmap *checked = NULL;
        GdkBitmap *un_mask = NULL;
        GdkPixmap *unchecked = NULL;
        gchar *dummy[2] = { " ", " " };
        nsComponent *currComp = sCustomST->GetComponents()->GetHead();
        GtkWidget *descLongTable = NULL;
        GtkWidget *frame = NULL;

        scrollwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin),
            GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);

        list = gtk_clist_new(2);
        gtk_clist_set_selection_mode(GTK_CLIST(list), GTK_SELECTION_BROWSE);
        gtk_clist_column_titles_hide(GTK_CLIST(list));
        gtk_clist_set_column_width(GTK_CLIST(list), 0, 20);
        gtk_clist_set_column_width(GTK_CLIST(list), 1, 200);
        gtk_clist_set_row_height(GTK_CLIST(list), 17);
        
        // determine number of rows we'll need
        numRows = sCustomST->GetComponents()->GetLengthVisible();
        for (i = 0; i < numRows; i++)
            gtk_clist_append(GTK_CLIST(list), dummy);
    
        style = gtk_widget_get_style(gCtx->window);
        checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, 
                  &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm);
        unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask,
                    &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm);

        while ((currRow < numRows) && currComp) // paranoia!
        {
            if (!currComp->IsInvisible())
            {
                if (currComp->IsSelected()) 
                    gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, 
                                         checked, ch_mask);
                else
                    gtk_clist_set_pixmap(GTK_CLIST(list), currRow, 0, 
                                         unchecked, un_mask);

                gtk_clist_set_text(GTK_CLIST(list), currRow, 1,
                                   currComp->GetDescShort());
                currRow++;
            }

            currComp = sCustomST->GetComponents()->GetNext();
        }

        // by default, first row selected upon Show()
        sCurrRowSelected = 0; 

        gtk_signal_connect(GTK_OBJECT(list), "select_row",
                           GTK_SIGNAL_FUNC(RowSelected), NULL);
        gtk_signal_connect(GTK_OBJECT(list), "key_press_event",
                           GTK_SIGNAL_FUNC(KeyPressed), NULL);
        gtk_container_add(GTK_CONTAINER(scrollwin), list);
        gtk_widget_show(list);
        gtk_widget_show(scrollwin);

        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), scrollwin, TRUE, TRUE, 0);
        gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 2, 3,
            static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
                     static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
                      20, 0);

        // XXX     3rd row: labels for ds avail and ds reqd

        // 4th row: a frame with a label (long desc)
        descLongTable = gtk_table_new(1, 1, FALSE);
        gtk_widget_show(descLongTable);

        gtk_table_attach(GTK_TABLE(mTable), descLongTable, 0, 1, 4, 5,
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
                     20, 20);
        frame = gtk_frame_new(gCtx->Res("DESCRIPTION"));
        gtk_table_attach_defaults(GTK_TABLE(descLongTable), frame, 0, 1, 0, 1);
        gtk_widget_show(frame);

        sDescLong = gtk_label_new(
            sCustomST->GetComponents()->GetFirstVisible()->GetDescLong());
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), sDescLong, FALSE, FALSE, 20);
        gtk_widget_show(hbox);

        gtk_table_attach_defaults(GTK_TABLE(descLongTable), hbox, 0, 1, 0, 1);
        gtk_widget_show(sDescLong);

        mWidgetsInit = TRUE;
    }
    else
    {
        gtk_notebook_set_page(GTK_NOTEBOOK(gCtx->notebook), mPageNum);
        gtk_widget_show(mTable);
    }

    // signal connect the buttons
    gCtx->backID = gtk_signal_connect(GTK_OBJECT(gCtx->back), "clicked",
                   GTK_SIGNAL_FUNC(nsComponentsDlg::Back), gCtx->cdlg);
    gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked",
                   GTK_SIGNAL_FUNC(nsComponentsDlg::Next), gCtx->cdlg);

    // show both back and next buttons
    gCtx->backLabel = gtk_label_new(gCtx->Res("BACK"));
    gCtx->nextLabel = gtk_label_new(gCtx->Res("NEXT"));
    gtk_container_add(GTK_CONTAINER(gCtx->back), gCtx->backLabel);
    gtk_container_add(GTK_CONTAINER(gCtx->next), gCtx->nextLabel);
    gtk_widget_show(gCtx->backLabel);
    gtk_widget_show(gCtx->nextLabel);
    gtk_widget_show(gCtx->back);
    gtk_widget_show(gCtx->next);

    GTK_WIDGET_SET_FLAGS(gCtx->next, GTK_CAN_DEFAULT);
    gtk_widget_grab_default(gCtx->next);
    gtk_widget_grab_focus(gCtx->next);

    return err;
}

Here is the call graph for this function:

void nsComponentsDlg::ToggleRowSelection ( GtkWidget *  aEvent,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 512 of file nsComponentsDlg.cpp.

{
    int numRows = 0, currRow = 0;
    GtkStyle *style = NULL;
    GdkBitmap *ch_mask = NULL;
    GdkPixmap *checked = NULL;
    GdkBitmap *un_mask = NULL;
    GdkPixmap *unchecked = NULL;
    nsComponent *currComp = sCustomST->GetComponents()->GetHead();
    
    style = gtk_widget_get_style(gCtx->window);
    checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, 
              &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm);
    unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask,
                &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm);

    numRows = sCustomST->GetComponents()->GetLengthVisible();
    while ((currRow < numRows) && currComp) // paranoia!
    {
        if (!currComp->IsInvisible())
        {
            if (aRow == currRow)
            {
                // update long desc
                gtk_label_set_text(GTK_LABEL(sDescLong),
                                   currComp->GetDescLong());
                gtk_widget_show(sDescLong);

                // don't toggle checkbox for clicks on component text
                if (aColumn != 0)
                   break;

                if (currComp->IsSelected())
                {
                    DUMP("Toggling off...");
                    currComp->SetUnselected();
                }
                else
                {
                    DUMP("Toggling on...");
                    currComp->SetSelected();
                }
                currComp->ResolveDependees(currComp->IsSelected(),
                                            sCustomST->GetComponents());
                break;
            }
            currRow++;
        }
        currComp = sCustomST->GetComponents()->GetNext();
    }

    // after resolving dependees redraw all checkboxes in one fell swoop
    currRow = 0;
    currComp = sCustomST->GetComponents()->GetHead();
    while ((currRow < numRows) && currComp) // paranoia!
    {
        if (!currComp->IsInvisible())
        {
            if (currComp->IsSelected())
            {
                gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, 
                                     checked, ch_mask);
            }
            else
            {
                gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, 
                                     unchecked, un_mask);
            }
            currRow++;
        }
        currComp = sCustomST->GetComponents()->GetNext();
    }
}

Here is the call graph for this function:

void nsComponentsDlg::ToggleRowSelection ( GtkWidget *  aEvent,
gint  aRow,
gboolean  aToggleState 
) [static]

Definition at line 369 of file nsComponentsDlg.cpp.

{
    int numRows = 0, currRow = 0;
    GtkStyle *style = NULL;
    GdkBitmap *ch_mask = NULL;
    GdkPixmap *checked = NULL;
    GdkBitmap *un_mask = NULL;
    GdkPixmap *unchecked = NULL;
    nsComponent *currComp = sCustomST->GetComponents()->GetHead();
    
    style = gtk_widget_get_style(gCtx->window);
    checked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &ch_mask, 
              &style->bg[GTK_STATE_NORMAL], (gchar **)check_on_xpm);
    unchecked = gdk_pixmap_create_from_xpm_d(gCtx->window->window, &un_mask,
                &style->bg[GTK_STATE_NORMAL], (gchar **)check_off_xpm);

    numRows = sCustomST->GetComponents()->GetLengthVisible();
    while ((currRow < numRows) && currComp) // paranoia!
    {
        if (!currComp->IsInvisible())
        {
            if (aRow == currRow)
            {
                // update long desc
                gtk_label_set_text(GTK_LABEL(sDescLong),
                                   currComp->GetDescLong());
                gtk_widget_show(sDescLong);

                if (aToggleState) {
                  if (currComp->IsSelected()) {
                    DUMP("Toggling off...");
                    currComp->SetUnselected();
                  } else {
                    DUMP("Toggling on...");
                    currComp->SetSelected();
                  }
                }
                currComp->ResolveDependees(currComp->IsSelected(),
                                            sCustomST->GetComponents());
                break;
            }
            currRow++;
        }
        currComp = currComp->GetNext();
    }

    // after resolving dependees redraw all checkboxes in one fell swoop
    currRow = 0;
    currComp = sCustomST->GetComponents()->GetHead();
    while ((currRow < numRows) && currComp) // paranoia!
    {
        if (!currComp->IsInvisible())
        {
            if (currComp->IsSelected())
            {
                gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, 
                                     checked, ch_mask);
            }
            else
            {
                gtk_clist_set_pixmap(GTK_CLIST(aWidget), currRow, 0, 
                                     unchecked, un_mask);
            }
            currRow++;
        }
        currComp = currComp->GetNext();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 86 of file nsComponentsDlg.h.

char * nsComponentsDlg::mMsg0 [private]

Definition at line 85 of file nsComponentsDlg.h.

int nsXInstallerDlg::mPageNum [protected, inherited]

Definition at line 98 of file nsXInstallerDlg.h.

int nsXInstallerDlg::mShowDlg [protected, inherited]

Definition at line 95 of file nsXInstallerDlg.h.

char* nsXInstallerDlg::mSubTitle [protected, inherited]

Definition at line 97 of file nsXInstallerDlg.h.

GtkWidget * nsXInstallerDlg::mTable [protected, inherited]

Definition at line 100 of file nsXInstallerDlg.h.

char * nsXInstallerDlg::mTitle [protected, inherited]

Reimplemented in nsWelcomeDlg.

Definition at line 96 of file nsXInstallerDlg.h.

int nsXInstallerDlg::mWidgetsInit [protected, inherited]

Definition at line 99 of file nsXInstallerDlg.h.


The documentation for this class was generated from the following files: