SetFrozen sets if the column is frozen.
(frozen bool)
| 251 | |
| 252 | // SetFrozen sets if the column is frozen. |
| 253 | func (tvc *TableViewColumn) SetFrozen(frozen bool) (err error) { |
| 254 | if frozen == tvc.frozen { |
| 255 | return nil |
| 256 | } |
| 257 | |
| 258 | var checkBoxes bool |
| 259 | if tvc.tv != nil { |
| 260 | checkBoxes = tvc.tv.CheckBoxes() |
| 261 | } |
| 262 | |
| 263 | old := tvc.frozen |
| 264 | defer func() { |
| 265 | if err != nil { |
| 266 | tvc.frozen = old |
| 267 | |
| 268 | if tvc.tv != nil { |
| 269 | tvc.create() |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | if tvc.tv != nil { |
| 274 | tvc.tv.hasFrozenColumn = tvc.tv.visibleFrozenColumnCount() > 0 |
| 275 | tvc.tv.SetCheckBoxes(checkBoxes) |
| 276 | tvc.tv.applyImageList() |
| 277 | } |
| 278 | }() |
| 279 | |
| 280 | if tvc.tv != nil && tvc.visible { |
| 281 | if err = tvc.destroy(); err != nil { |
| 282 | return |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | tvc.frozen = frozen |
| 287 | |
| 288 | if tvc.tv != nil && tvc.visible { |
| 289 | return tvc.create() |
| 290 | } |
| 291 | |
| 292 | return nil |
| 293 | } |
| 294 | |
| 295 | // Width returns the width of the column in pixels. |
| 296 | func (tvc *TableViewColumn) Width() int { |
no test coverage detected