fix pop box width problems

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@188 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1997-11-29 12:36:18 +00:00
parent f40513a025
commit 7e87267600
5 changed files with 33 additions and 24 deletions

View File

@ -33,11 +33,11 @@
\********************************************************************/
PopBox *
actionBox (Widget parent)
actionBox (Widget parent, int width, int drop_down_width)
{
PopBox *popGUI;
popGUI = popBox (parent);
popGUI = popBox (parent, width, drop_down_width);
/* build the action menu */
AddPopBoxMenuItem (popGUI, "Buy");

View File

@ -44,7 +44,7 @@ static void selectCB (Widget w, XtPointer cd, XtPointer cb );
\********************************************************************/
PopBox *
popBox (Widget parent)
popBox (Widget parent, int width, int drop_width)
{
Widget combobox;
XmString str;
@ -66,14 +66,13 @@ popBox (Widget parent)
XmNmarginWidth, 0,
XmNselectionPolicy, XmSINGLE_SELECT,
XmNvalue, "",
/* hack alert -- the width of the combobox should be relative to the font, should
* be relative to the size of the cell in which it will fit. Basically, these
* values should not be hard-coded, but should be conmputed somehow */
XmNwidth, 53,
XmNdropDownWidth, 103,
XmNwidth, width,
NULL);
if (10 < drop_width) {
XtVaSetValues (combobox, XmNdropDownWidth, drop_width, NULL);
}
popData -> combobox = combobox;
/* add callbacks to detect a selection */

View File

@ -1715,7 +1715,8 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
* Set up the menubar menu-items. *
* Menu structures must be initialized before any code is *
* executed. Some compilers insist on this, although gcc is *
* freindly about this. *
* freindly about this. Note that some of the activityMenu *
* values are changed below. Be careful with which row is which. *
\******************************************************************/
MenuItem reportMenu[] = {
{ "Simple...", &xmPushButtonWidgetClass, 'S', NULL, NULL, True,
@ -1758,15 +1759,6 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
NULL,
};
/* some compilers don't like dynamic data in initializers;
* so rather than inlining these, we initialize here ... :-(
* Just be careful not to scramble the order of the rows.
* See also some additional activityMenu futzing about below
*/
activityMenu[2].callback_data=(XtPointer)regData;
activityMenu[3].callback_data=(XtPointer)regData;
activityMenu[6].callback_data=(XtPointer)regData;
activityMenu[8].callback_data=(XtPointer)(regData->dialog); /* destroy callback */
/******************************************************************\
* Set quarks, create regData, compute register display type *
@ -1881,6 +1873,12 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
* Setup the menubar at the top of the window *
\******************************************************************/
/* Be careful not to scramble the order of the rows. */
activityMenu[2].callback_data=(XtPointer)regData;
activityMenu[3].callback_data=(XtPointer)regData;
activityMenu[6].callback_data=(XtPointer)regData;
activityMenu[8].callback_data=(XtPointer)(regData->dialog); /* destroy callback */
/* can't adjust the balance on a ledger window */
if (1 != regData->numAcc) {
activityMenu[2].sensitive = False;
@ -2276,15 +2274,23 @@ regWindowLedger( Widget parent, Account **acclist, int ledger_type )
/* create action box for the first time */
regData->actbox = actionBox (reg);
{
int width;
width = XbaeMatrixGetColumnPixelWidth (reg, regData->cellColLocation[ACTN_CELL_ID]);
/* hack alert -- we do want popbox drop-down width to be font dependant */
regData->actbox = actionBox (reg, width, 55);
}
/* create the xfer account box for the first time */
/* but first, find the topmost group */
{
AccountGroup *grp;
int width;
grp = xaccGetRootGroupOfAcct (regData->blackacc[0]);
regData->xfrmbox = xferBox (reg, grp);
regData->xtobox = xferBox (reg, grp);
width = XbaeMatrixGetColumnPixelWidth (reg, regData->cellColLocation[XFRM_CELL_ID]);
/* hack alert -- we do want popbox drop-down width to be font dependant */
regData->xfrmbox = xferBox (reg, grp, width, 103);
regData->xtobox = xferBox (reg, grp, width, 103);
}
/******************************************************************\

View File

@ -53,12 +53,12 @@ XferBoxTraverse (PopBox *popGUI, AccountGroup *grp)
}
PopBox *
xferBox (Widget parent, AccountGroup *grp)
xferBox (Widget parent, AccountGroup *grp, int width, int drop_down_width)
{
PopBox *popGUI;
Account * acc;
popGUI = popBox (parent);
popGUI = popBox (parent, width, drop_down_width);
XferBoxTraverse (popGUI, grp);

View File

@ -103,6 +103,10 @@ String fbRes[] = {
"*recn*cellMarginHeight: 0",
/* combobox -- don't want the cell to be outlined */
"*reg*popbox*shadowThickness: 0",
"*reg*popbox*list*shadowThickness: 1", /* we *do* want the combobox scroll bar to show, thoguh */
"*reg*popbox*list*thickness: 24", /* slider width ignored ... why ??? */
"*reg*popbox*list*VertScrollBar*width: 24", /* slider width ignored ... why ??? */
"*reg*popbox*list*troughColor: #9999aa", /* ignored -- why ???*/
NULL,
};