⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rowcolc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 4 页
字号:
   Defer(False);} // End RowColC SetRowVisible//----------------------------------------------------------------------------// Method to return the alignment of a single column//RcAlignTRowColC::ColAlignment(int i) const{   if ( i < 0 || i >= colList.size() ) return XmALIGNMENT_CENTER;   return colList[i]->alignment;}//----------------------------------------------------------------------------// Method to return the alignment of a single row//RcAlignTRowColC::RowAlignment(int i) const{   if ( i < 0 || i >= rowList.size() ) return XmALIGNMENT_CENTER;   return rowList[i]->alignment;}//----------------------------------------------------------------------------// Method to return the column count//intRowColC::ColCount() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->colCount;}//----------------------------------------------------------------------------// Method to return the row count//intRowColC::RowCount() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->rowCount;}//----------------------------------------------------------------------------// Method to return the width adjust mode of a single column//RcAdjustTRowColC::ColWidthAdjust(int i) const{   if ( i < 0 || i >= colList.size() ) return RcADJUST_NONE;   return colList[i]->adjust;}//----------------------------------------------------------------------------// Method to return the width adjust mode of a single row//RcAdjustTRowColC::RowHeightAdjust(int i) const{   if ( i < 0 || i >= rowList.size() ) return RcADJUST_NONE;   return rowList[i]->adjust;}//----------------------------------------------------------------------------// Method to return the resize flag of a single column//BooleanRowColC::ColResize(int i) const{   if ( i < 0 || i >= colList.size() ) return False;   return colList[i]->resizeOk;}//----------------------------------------------------------------------------// Method to return the resize flag of a single row//BooleanRowColC::RowResize(int i) const{   if ( i < 0 || i >= rowList.size() ) return False;   return rowList[i]->resizeOk;}//----------------------------------------------------------------------------// Method to return the visibility flag of a single column//BooleanRowColC::ColVisible(int i) const{   if ( i < 0 || i >= colList.size() ) return False;   return colList[i]->visible;}//----------------------------------------------------------------------------// Method to return the visibility flag of a single row//BooleanRowColC::RowVisible(int i) const{   if ( i < 0 || i >= rowList.size() ) return False;   return rowList[i]->visible;}//----------------------------------------------------------------------------// Method to return the orientation//RcOrientTRowColC::Orientation() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->orient;}//----------------------------------------------------------------------------// Method to return the width resize policy//RcResizeTRowColC::ResizeWidth() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->wResizePolicy;}//----------------------------------------------------------------------------// Method to return the height resize policy//RcResizeTRowColC::ResizeHeight() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->hResizePolicy;}//----------------------------------------------------------------------------// Method to return the uniform columns flag//BooleanRowColC::UniformCols() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->uniformCols;}//----------------------------------------------------------------------------// Method to return the uniform rows flag//BooleanRowColC::UniformRows() const{   RowColPart	*rc = GetRowColPart(rcw);   return rc->uniformRows;}//----------------------------------------------------------------------------// Method to add a single child to the title row.  If "child" is NULL, it means//    the user wants an empty cell.//voidRowColC::AddTitleRowChild(Widget wp){   Defer(True);//// Add child//   RowColChildC	*child = new RowColChildC(wp);   if ( !titleRowWidget ) titleRowWidget = XtParent(wp);   if ( !titleRow       ) titleRow       = new RowC(this);   titleRow->AddChild(child);   child->row = titleRow;//// Add an event handler to detect child size changes//   if ( wp )      XtAddEventHandler(wp, StructureNotifyMask, False,			(XtEventHandler)HandleTitleResize, (XtPointer)this);//// Point to the appropriate column//   int	colNum = titleRow->childList.size() - 1;   if ( colNum < colList.size() )      child->col = (ColC*)colList[colNum];   Defer(False);} // End RowColC AddTitleRowChild//----------------------------------------------------------------------------// Methods to add several children to the title row//voidRowColC::AddTitleRowChildren(WidgetListC& list){   AddTitleRowChildren(list.start(), list.size());}voidRowColC::AddTitleRowChildren(Widget *list, int count){   Defer(True);   for (int i=0; i<count; i++) AddTitleRowChild(list[i]);   Defer(False);}//----------------------------------------------------------------------------// Methods to set the title row child list//voidRowColC::SetTitleRowChildren(WidgetListC& list){   SetTitleRowChildren(list.start(), list.size());}voidRowColC::SetTitleRowChildren(Widget *list, int count){   Defer(True);   if ( titleRow ) {      unsigned	ccnt = titleRow->childList.size();      for (int i=0; i<ccnt; i++) delete titleRow->childList[i];      titleRow->Reset();   }   titleRowWidget = NULL;   for (int i=0; i<count; i++) AddTitleRowChild(list[i]);   Defer(False);}//----------------------------------------------------------------------------// Method to add a single child to the title column.  If "child" is NULL, it//    means the user wants an empty cell.//voidRowColC::AddTitleColChild(Widget wp){   Defer(True);//// Add child//   RowColChildC	*child = new RowColChildC(wp);   if ( !titleColWidget ) titleColWidget = XtParent(wp);   if ( !titleCol       ) titleCol       = new ColC(this);   titleCol->AddChild(child);   child->col = titleCol;//// Add an event handler to detect child size changes//   if ( wp )      XtAddEventHandler(wp, StructureNotifyMask, False,			(XtEventHandler)HandleTitleResize, (XtPointer)this);//// Point to the appropriate row//   int	rowNum = titleCol->childList.size() - 1;   if ( rowNum < rowList.size() )      child->row = (RowC*)rowList[rowNum];   Defer(False);} // End RowColC AddTitleColChild//----------------------------------------------------------------------------// Methods to add several children to the title column//voidRowColC::AddTitleColChildren(WidgetListC& list){   AddTitleColChildren(list.start(), list.size());}voidRowColC::AddTitleColChildren(Widget *list, int count){   Defer(True);   for (int i=0; i<count; i++) AddTitleColChild(list[i]);   Defer(False);}//----------------------------------------------------------------------------// Methods to set the title column child list//voidRowColC::SetTitleColChildren(WidgetListC& list){   SetTitleColChildren(list.start(), list.size());}voidRowColC::SetTitleColChildren(Widget *list, int count){   Defer(True);   if ( titleCol ) {      unsigned	ccnt = titleCol->childList.size();      for (int i=0; i<ccnt; i++) delete titleCol->childList[i];      titleCol->Reset();   }   titleColWidget = NULL;   for (int i=0; i<count; i++) AddTitleColChild(list[i]);   Defer(False);}//----------------------------------------------------------------------------// Method to set the width//voidRowColC::SetWidth(int wd){   if ( wd == rcw->core.width ) return;   newWd = wd;   //cout <<"Setting " <<rcw->core.name <<" width to " <<wd <<endl;   if ( !deferred ) Refresh();   else		    changed = True;} // End SetWidth//----------------------------------------------------------------------------// Method to set the height//voidRowColC::SetHeight(int ht){   if ( ht == rcw->core.height ) return;   newHt = ht;   if ( !deferred ) Refresh();   else		    changed = True;} // End SetWidth/*----------------------------------------------------------------------- *  Callback for geometry request */voidRowColC::HandleGeometryRequest(Widget, RowColC *This, XtPointer data){   RowColGeometryCallbackStruct *geo = (RowColGeometryCallbackStruct *)data;   geo->desiredWd = This->PrefWidth();   geo->desiredHt = This->PrefHeight();}/*----------------------------------------------------------------------- *  Method to determine the preferred width */DimensionRowColC::PrefWidth(){   RowColPart	*rc = GetRowColPart(rcw);   if ( debug2 ) {      cout <<"RowColC(" <<rcw->core.name <<")::PrefWidth" <<endl;      cout <<"   width resize policy is ";      switch (rc->wResizePolicy) {	 case XmRESIZE_NONE: cout <<"NONE"; break;	 case XmRESIZE_GROW: cout <<"GROW"; break;	 case XmRESIZE_ANY:  cout <<"ANY";  break;      }      cout <<endl;   }//// Have the columns recalculate their preferred widths.//   if ( titleCol ) titleCol->CalcPrefSize();   unsigned	count = colList.size();   int	i;   for (i=0; i<count; i++) colList[i]->CalcPrefSize();//// If we can't change the total width we can stop here.  We did the above//   calculations anyway so we would know the preferred sizes of the children.//   if ( inResize || (exposed && rc->wResizePolicy == XmRESIZE_NONE) ) {      if ( debug2 ) cout <<"   no width resize is allowed" <<endl;      return (rc->setWidth>0) ? rc->setWidth : rcw->core.width;   }   Dimension	totalWd;//// If the columns are to be the same width, get the maximum//   if ( rc->uniformCols ) {      unsigned	visCount = 0;      int	maxWd = 0;      for (i=0; i<count; i++) {	 ColC	*col = (ColC*)colList[i];	 if ( col->visible ) {	    visCount++;	    if ( col->prefSize > maxWd ) maxWd = col->prefSize;	 }      }      totalWd = rc->marginWd*2 + (maxWd*visCount) + rc->colSpacing*(visCount-1);   } // End if columns need to be all the same width//// If the columns can be any size, add up the preferred widths//   else {      totalWd = rc->marginWd*2;      for (i=0; i<count; i++) {	 ColC	*col = (ColC*)colList[i];	 if ( col->visible ) totalWd += col->prefSize + rc->colSpacing;      }      totalWd -= rc->colSpacing;   }   if ( debug2 ) cout <<"   preferred width is " <<totalWd <<endl;   if ( exposed && rc->wResizePolicy == XmRESIZE_GROW ) {      Dimension	widgetWd = (rc->setWidth>0) ? rc->setWidth : rcw->core.width;      if ( totalWd < widgetWd ) {	 if ( debug2 ) cout <<"   the width is not allowed to shrink" <<endl;	 return widgetWd;      }   }   return totalWd;} // End PrefWidth/*----------------------------------------------------------------------- *  Method to determine the preferred height */DimensionRowColC::PrefHeight(){   RowColPart	*rc = GetRowColPart(rcw);   if ( debug2 ) {      cout <<"RowColC(" <<rcw->core.name <<")::PrefHeight" <<endl;      cout <<"   height resize policy is ";      switch (rc->hResizePolicy) {	 case XmRESIZE_NONE: cout <<"NONE"; break;	 case XmRESIZE_GROW: cout <<"GROW"; break;	 case XmRESIZE_ANY:  cout <<"ANY";  break;      }      cout <<endl;   }//// Have the rows recalculate their preferred heights//   if ( titleRow ) titleRow->CalcPrefSize();   unsigned	count = rowList.size();   int	i;   for (i=0; i<count; i++) rowList[i]->CalcPrefSize();//// If we can't change the total height we can stop here.  We did the above//   calculations anyway so we would know the preferred sizes of the children.//   if ( inResize || (exposed && rc->hResizePolicy == XmRESIZE_NONE) ) {      if ( debug2 ) cout <<"   no height resize is allowed" <<endl;      return (rc->setHeight>0) ? rc->setHeight : rcw->core.height;   }   Dimension	totalHt;//// If the rows are to be the same height, get the maximum//   if ( rc->uniformRows ) {      unsigned	visCount = 0;      int	maxHt = 0;      for (i=0; i<count; i++) {	 RowC	*row = (RowC*)rowList[i];	 if ( row->visible ) {	    visCount++;	    if ( row->prefSize > maxHt ) maxHt = row->prefSize;	 }      }      totalHt = rc->marginHt*2 + (maxHt*visCount) + rc->rowSpacing*(visCount-1);   } // End if rows need to be all the same height//// If the rows can be any size, add up the preferred heights//   else {      totalHt = rc->marginHt*2;      for (i=0; i<count; i++) {	 RowC	*row = (RowC*)rowList[i];	 if ( row->visible ) totalHt += row->prefSize + rc->rowSpacing;      }      totalHt -= rc->rowSpacing;   }   if ( debug2 ) cout <<"   preferred height is " <<totalHt <<endl;   if ( exposed && rc->hResizePolicy == XmRESIZE_GROW ) {      Dimension	widgetHt = (rc->setHeight>0) ? rc->setHeight : rcw->core.height;      if ( totalHt < widgetHt ) {	 if ( debug2 ) cout <<"   the height is not allowed to shrink" <<endl;	 return widgetHt;      }   }   return totalHt;} // End PrefHeight//-----------------------------------------------------------------------// Method to look up widget in list//intRowColC::ChildListIndexOf(Widget w) const{   u_int	count = childList.size();   for (int i=0; i<count; i++) {      RowColChildC	*child = childList[i];      if ( child->w == w ) return i;   }   return childList.NULL_INDEX;}BooleanRowColC::ChildListIncludes(Widget w) const{   return (ChildListIndexOf(w) != childList.NULL_INDEX);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -